Claude Platform Docs

Get your Claude API key

Create a Developer API key for the Claude API in the Claude Console, store it safely, and set it in your environment.

A Developer API key is a secret that lets your code call Claude. These steps create one in the Claude Console and set it in the ANTHROPIC_API_KEY environment variable, which the SDK and the CLI read.

Is this the key you need? A Developer API key calls Claude, and an Admin API key manages an organization. To compare them, see the two kinds of API key.

You might not need a key. To choose a method that doesn’t use one, see Choose your path on the Authentication page.

Before you begin

Your role must allow you to create a key. To check which roles can, see Who can create which key on the Developer API keys page.

Create a Developer API key

  1. Sign in to the Claude Console

    Go to the Claude Console and sign in or create an account if you don’t have one.

  2. Open the API keys page

    In the Claude Console, open the API keys page (platform.claude.com/keys/api-keys).

  3. Create a key

    Click Create key. If the dialog first offers other ways to connect, click Somewhere else or Continue with an API key. Then, name the key and choose its settings:

    • Expires: how long the key lasts. You can’t change it later (see Key expiration on the Developer API keys page).
    • Linked account: who the key acts as (see Key types on the Developer API keys page):
      • Your name, marked (you), for a personal key.
      • A service account, for a service account key. Only organization admins can pick one.
      • Not linked, for a legacy workspace key. Don’t use it for new integrations.
    • Scope: the workspace the key works in. If the key needs several workspaces, choose Organization. With that choice, each Claude API request must name a workspace in the anthropic-workspace-id header (see Select a workspace on the Developer API keys page).
  4. Copy and store the key

    The Console shows the full key only once. Copy it and store it somewhere safe, such as a secrets manager. If you lose it, create a new key.

If the Create key button is missing or disabled, your role might not allow it, or an organization admin might have turned off key creation. To find out why and what to do, see Who can create which key on the Developer API keys page.

These steps are for the Claude API. If you use Claude through a cloud platform, follow that platform’s authentication steps instead.

Use your Developer API key

Set the key as an environment variable for your current shell session:

export ANTHROPIC_API_KEY="sk-ant-..."

The SDK and the CLI read ANTHROPIC_API_KEY automatically. To set it for every new shell or on Windows, see API key on the CLI authentication options page.

To run the docs’ cURL samples with your key, see Run the docs’ samples with a key on the Developer API keys page.

For key types, expiration, and key management with the Admin API, see Developer API keys.

Next steps

Make your first request to Claude.

Was this page helpful?