Back to Getting Started
Getting Started

How to Get Your Claude API Key

Walkthrough of platform.claude.com signup and API key generation in under 30 seconds.

How to Get Your Claude API Key

You need an API

key to use Claude in your firm's workflows. This takes 30 seconds if you already have an Anthropic account, or 2 minutes if you're starting from scratch.

This guide covers the exact steps to generate your key, where to store it, and how to test it immediately.

What You're Getting

An Anthropic API

key is a string that starts with sk-ant-api03-. It authenticates every request your application makes to Claude. Without it, you can't access the API
.

You'll generate this key from the Anthropic Console at console.anthropic.com. The key never expires unless you manually delete it.

Prerequisites

You need:

  • A valid email address
  • A payment method (credit card or approved invoice billing)
  • 2 minutes

Anthropic requires payment information before issuing API

keys. There's no free tier for API
access. Expect to pay roughly $3 per million input tokens and $15 per million output tokens for Claude 3.5 Sonnet.

Step 1: Create Your Anthropic Account

Navigate to console.anthropic.com.

Click "Sign Up" in the top right corner.

Enter your email address and create a password. Use a company email if you're setting this up for firm use.

Check your inbox for a verification email from Anthropic. Click the verification link. This usually arrives within 60 seconds.

Log in to the Console with your new credentials.

Step 2: Add Payment Information

Anthropic will prompt you to add payment details immediately after your first login.

Click "Add Payment Method" or navigate to Settings > Billing.

Enter your credit card information. Anthropic accepts Visa, Mastercard, American Express, and Discover.

For invoice billing (available for accounts spending $500+/month), contact sales@anthropic.com with your firm name and estimated monthly usage.

Set a usage limit to prevent surprise bills. Navigate to Settings > Billing > Usage Limits. Set a monthly cap at $50 for testing or $500+ for production use.

Step 3: Generate Your API
Key

From the Console dashboard, click "API

Keys" in the left sidebar.

Click "Create Key" in the top right.

Name your key something specific. Use "Production - [Your App Name]" or "Testing - [Your Name]". Avoid generic names like "My Key" or "Test Key". You'll thank yourself when you have 6 keys and need to rotate one.

Click "Create Key".

Copy the key immediately. It displays once. The format looks like this:

sk-ant-api03-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Store this key in your password manager or secrets management system. Do not paste it into Slack, email, or any document that syncs to cloud storage.

Step 4: Test Your Key Immediately

Open your terminal.

Run this curl command, replacing YOUR_API_KEY with your actual key:

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet-20241022",
    "max_tokens": 100,
    "messages": [
      {"role": "user", "content": "Reply with just the word SUCCESS if you can read this."}
    ]
  }'

You should see a JSON response containing the word "SUCCESS". If you see an authentication error, double-check you copied the entire key including the sk-ant-api03- prefix.

Where to Store Your API
Key

Never hardcode API

keys in your application code. Use one of these methods:

Environment Variables (Recommended for Development)

Create a .env file in your project root:

ANTHROPIC_API_KEY=sk-ant-api03-your-key-here

Add .env to your .gitignore file immediately.

Load the variable in your code:

import os
from anthropic import Anthropic

client = Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY"))

Secrets Manager (Recommended for Production)

Use AWS Secrets Manager, Azure Key Vault, or Google Secret Manager.

Store your key with a descriptive name like prod/anthropic/api-key.

Retrieve it at runtime:

import boto3
from anthropic import Anthropic

def get_secret():
    client = boto3.client('secretsmanager', region_name='us-east-1')
    response = client.get_secret_value(SecretId='prod/anthropic/api-key')
    return response['SecretString']

anthropic_client = Anthropic(api_key=get_secret())

Config Files with Restricted Permissions

If you must use a config file, set permissions to 600 (owner read/write only):

chmod 600 config.ini

Never commit this file to version control.

Key Management Best Practices

Create separate keys for development, staging, and production. Name them clearly. This lets you rotate a compromised key without breaking all environments.

Rotate keys every 90 days. Set a calendar reminder. Generate a new key, update your applications, then delete the old key.

Monitor usage in the Console under Settings > Usage. Set up alerts for unusual spikes. A compromised key will show abnormal request patterns.

Delete unused keys immediately. Every active key is a potential security risk.

Common Issues and Fixes

"Invalid API

key" error: You likely copied the key incorrectly. Regenerate a new key and copy it again. The key should be 108 characters long.

"Rate limit exceeded" error: You're making too many requests. The default limit is 50 requests per minute for new accounts. Contact Anthropic support to request a limit increase.

"Insufficient credits" error: Add more funds to your account or increase your usage limit in Settings > Billing.

Key not working in production but works locally: Check that your production environment variables are set correctly. Print the first 10 characters of the key (not the full key) to verify it's loading properly.

Next Steps

You have a working API

key. Now integrate Claude into your application:

  1. Install the Anthropic Python SDK: pip install anthropic
  2. Review the API
    reference at docs.anthropic.com/api/reference
  3. Start with the Messages API
    for conversational interfaces
  4. Test with Claude 3.5 Haiku for speed or Claude 3.5 Sonnet for quality

Set up monitoring before you deploy to production. Track token usage, response times, and error rates. This prevents billing surprises and helps you optimize performance.

Revenue Institute

Reviewed by Revenue Institute

This guide is actively maintained and reviewed by the implementation experts at Revenue Institute. As the creators of The AI Workforce Playbook, we test and deploy these exact frameworks for professional services firms scaling without new headcount.

Revenue Institute

Need help turning this guide into reality? Revenue Institute builds and implements the AI workforce for professional services firms.

RevenueInstitute.com