---
title: "Anthropic API Key Format (sk-ant-api03): Anatomy &amp; Security"
url: "https://bip39-phrase.com/anthropic-api-key-format/"
language: "en"
published: "2026-06-09T00:00:00+00:00"
updated: "2026-10-19T00:00:00+00:00"
---

[ Developers ](/topics/developers/) Published June 9, 2026 Updated October 19, 2026 

# Anthropic API Key Format (sk-ant-api03): Anatomy & Security

![Anthropic API Key Format (sk-ant-api03): Anatomy & Security](/wp-content/uploads/2025/02/anthropic-api-key-format-hero.webp) 

An Anthropic API key is a secret string that starts with `sk-ant-` (in its classic form `sk-ant-api03-`) and authenticates your requests to the Claude API. You create it in the Claude Console, where the full value is shown only once, and send it with every request, either as a bearer token in the `Authorization` header or in the older `x-api-key` header, according to Anthropic’s [API overview](https://platform.claude.com/docs/en/api/overview). Whoever holds the string can spend your credits, so it deserves the same care as a crypto private key: a long, high-entropy bearer secret that is mishandled mostly because people treat it as an ordinary configuration value. This guide breaks down the format, the other Anthropic credential types, and how to create, check, store and rotate a key.

## Anthropic API Key at a Glance

| Item                   | Details                                                                                                     |
| ---------------------- | ----------------------------------------------------------------------------------------------------------- |
| **Prefix**             | sk-ant-, classically sk-ant-api03-; Admin API keys use sk-ant-admin01-                                      |
| **Length**             | About 108 characters for an api03 key                                                                       |
| **Where to create it** | Claude Console, API keys page (platform.claude.com/settings/keys)                                           |
| **How to send it**     | Authorization: Bearer <key>, or the legacy x-api-key: <key> header                                          |
| **Shown**              | Once, at creation; afterwards only a masked hint                                                            |
| **Expiration**         | Chosen at creation: a preset from 3 hours to 30 days, a custom duration or never                            |
| **If it leaks**        | Disable or delete it in the Console; keys found in public GitHub repositories are deactivated automatically |

## Anatomy of a Key

A classic Anthropic production key begins with the prefix `sk-ant-api03-`, followed by a long random body:

```text
sk-ant-api03-AAAAAAAAAAAAAAAAAAAA...BBBBBBBBBBBBBBBBBBBB
```

Read left to right, the prefix is self-describing:

- **`sk`** — “secret key”, an industry convention that also opens OpenAI and Stripe secrets. It signals that the string is a private credential, not a publishable identifier.
- **`ant`** — the issuer, Anthropic. This namespacing lets secret-scanning tools tell an Anthropic key apart from an OpenAI or Stripe key at a glance.
- **`api03`** — the key format. Admin API keys carry `admin01` in the same place, which is how scanners tell the two apart.
- **The body** — random characters from the `A–Z a–z 0–9 - _` alphabet. The open-source secret scanner TruffleHog [matches an api03 key](https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/anthropic/anthropic.go) as 93 such characters followed by `AA`, which makes the whole token 108 characters long.

One detail matters for anyone coming from the crypto world: **there is no checksum**. A BIP39 mnemonic encodes a checksum in its final word, so a typo is usually caught the moment you try to import it. An Anthropic key has no such safety net: change one character and you simply get a `401 authentication_error`, with no hint about whether the key was mistyped, revoked or expired. Copy it whole, or not at all.

## Which Anthropic Credentials Exist?

Not every Anthropic credential is a regular API key. Anthropic’s [authentication guide](https://platform.claude.com/docs/en/manage-claude/authentication) and [Admin API key guide](https://platform.claude.com/docs/en/manage-claude/admin-api-keys) describe these:

| Credential                  | Typical prefix  | Created in                             | Used for                                                                          |
| --------------------------- | --------------- | -------------------------------------- | --------------------------------------------------------------------------------- |
| **Personal API key**        | sk-ant-         | Console, API keys page                 | Your own development; acts as you and stops working if you leave the organization |
| **Service account key**     | sk-ant-         | Console, linked to a service account   | CI pipelines, production services and agents                                      |
| **Workspace key** (legacy)  | sk-ant-api03-   | Console, inside a workspace            | Older integrations; belongs to the workspace, not a person                        |
| **Admin API key**           | sk-ant-admin01- | Console, Admin keys page (admins only) | Organization management, usage and cost reports                                   |
| **Claude Code OAuth token** | sk-ant-oat01-   | claude setup-token                     | Claude Code billed to a Pro, Max, Team or Enterprise subscription                 |

Personal and service account keys are identity-backed: when the person or service account is removed from the organization, the key stops working, so it can’t outlive its owner. For a server, a bot or a CI pipeline, use a service account key. The long-lived token that `claude setup-token` prints is different: according to the [Claude Code documentation](https://code.claude.com/docs/en/authentication), it lasts one year, authenticates against your Claude subscription and can only make model requests. Mixing up a subscription token and an API key is a common reason an integration “works on my machine” but fails in production.

The same split between an identifier and a secret shows up across the industry: our overview of [API keys on major cryptocurrency exchanges](/api-keys-popular-exchanges/) shows the pattern in a different domain.

## How to Generate One

Anthropic’s [key guide](https://platform.claude.com/docs/en/get-api-key) lists the steps:

1. Sign in to the **Claude Console** at `platform.claude.com`.
2. Open the **API keys** page (`platform.claude.com/settings/keys`).
3. Click **Create key**, give it a descriptive name (e.g. `prod-backend` or `ci-tests`), choose an expiration and set **Linked account** to yourself for a personal key or to a service account. You can also scope the key to one workspace.
4. Copy the key **immediately**. Like a freshly generated seed phrase, the full value is shown exactly once; after you close the dialog, only a masked preview remains.

That “shown once” behaviour is the most important parallel to crypto key management: **the moment of creation is the only moment you can back it up safely.** Treat the copy step with the same seriousness you would give to writing down a 24-word phrase.

## Validating a Key Locally

Before shipping, you can sanity-check a key in two cheap ways.

**1\. Shape check with a regex.** Confirm that the string at least looks like a classic key before sending it anywhere:

```text
^sk-ant-api03-[A-Za-z0-9_-]{93}AA$
```

Newer key types may use a different tag after `sk-ant-`, so treat a failed match as a reason to look closer, not as proof the key is invalid.

**2\. Live check with a free request.** Listing the available models with the [Models API](https://platform.claude.com/docs/en/api/models/list) uses no tokens and confirms the key is accepted:

```bash
curl https://api.anthropic.com/v1/models \
  -H "Authorization: Bearer $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"
```

A `200` with a list of models means the key works. Per Anthropic’s [error reference](https://platform.claude.com/docs/en/api/errors), a `401 authentication_error` means the key is malformed, revoked or expired, and a `402 billing_error` points to a payment problem rather than the key. A key that works in several workspaces also needs an `anthropic-workspace-id` header on each request, or the API answers with a `400`.

## Treat the Key Like a Seed Phrase

This is where our usual subject matter pays off. The mental model that keeps a BIP39 mnemonic safe is the same one that keeps an API key safe: a high-value bearer secret that does damage the moment it leaks. If you have read our breakdown of [what happens when a seed phrase is compromised](/bip39-seed-phrase-compromise/), the failure modes below will look familiar.

- **Never commit it to source control.** The most common key leak is a `.env` file or a hard-coded string pushed to a public repository. Anthropic’s [key safety article](https://support.claude.com/en/articles/9767949-api-key-best-practices-keeping-your-keys-safe-and-secure) explains that GitHub scans public repositories for Claude API keys, notifies Anthropic when it finds one, and Anthropic deactivates the key and emails the owner. That limits the damage, but bots may have copied the key first. The crypto-world equivalent is a screenshot of your seed phrase in a cloud photo library.
- **Use environment variables or a secrets manager**, never inline literals. Vault, AWS Secrets Manager, Doppler or an OS keychain all beat plaintext in a config file. The same goes for the RPC keys and deployer private keys in a blockchain project, such as the ones used to [deploy EVM smart contracts](/smart-contract-evm-what-it-is-and-how-it-works/).
- **Scope and isolate keys per environment.** One key for production, a separate one for staging, another for each developer. A leak then hits one environment, not your whole account, the same logic as keeping separate wallets for spending and savings.
- **Set spend limits and expirations, and monitor usage.** The Console lets you cap spend and watch per-key consumption, and an expiration date limits how long a leaked key stays useful. An unexpected spike is your earliest leak signal, just as an unexpected outgoing transaction is for a wallet.
- **Rotate on any suspicion.** In the Console, **Disable** is reversible and **Delete** is permanent. Revoking and reissuing an API key takes seconds, far easier than the irreversible “move all funds to a new wallet” routine a compromised seed phrase forces. Use that ease: when in doubt, rotate.

## Anthropic vs OpenAI API Keys

If your code talks to both providers, the differences below cause most “the key is definitely right but nothing works” bugs:

|                           | Anthropic                          | OpenAI                                       |
| ------------------------- | ---------------------------------- | -------------------------------------------- |
| **Prefix**                | sk-ant- (classic sk-ant-api03-)    | sk-proj-, sk-svcacct-, sk-admin-, legacy sk- |
| **Header**                | Authorization: Bearer or x-api-key | Authorization: Bearer                        |
| **Extra required header** | anthropic-version                  | None                                         |
| **Free live check**       | GET /v1/models                     | GET /v1/models                               |

The full breakdown of the other side is in our guide to the [OpenAI API key format](/openai-api-key-format/), and more developer material is collected in our [developer guides](/topics/developers/).

## Anthropic API Key Frequently Asked Questions

### Q1: What does the `sk-ant-api03` prefix mean?

It is a self-describing namespace: `sk` marks the string as a secret key, `ant` identifies Anthropic as the issuer, and `api03` marks the classic API key format. Admin keys use `sk-ant-admin01-` instead, and newer key types may carry a different tag after `sk-ant-`.

### Q2: What is the difference between an API key and an `sk-ant-oat01` token?

An API key is created in the Claude Console and billed to your organization’s API usage. An `oat01` token is an OAuth token, such as the one `claude setup-token` generates for Claude Code; it draws on a Claude subscription and can only make model requests. For servers, bots and CI pipelines, use an API key, ideally one linked to a service account.

### Q3: How long is an Anthropic API key, and does it have a checksum?

A classic `api03` key is 108 characters: the 13-character `sk-ant-api03-` prefix plus 95 random characters. Unlike a BIP39 mnemonic, it has **no checksum**: a single mistyped character produces a `401` error with no hint, so always copy the key whole.

### Q4: I lost my key. Can I recover it?

No. Like a seed phrase, the full value is shown only once, at creation, and even the Admin API returns only a partial hint. Create a new key and delete the old one in the Console.

### Q5: My key returns a 401 error. What should I check?

In order: confirm you copied the whole string with no leading or trailing whitespace; check in the Console that the key hasn’t been disabled, deleted or reached its expiration date; make sure you send it as `Authorization: Bearer` or `x-api-key`, not in the URL or body; and if both `ANTHROPIC_API_KEY` and `ANTHROPIC_AUTH_TOKEN` are set, unset one, since conflicting credentials can also be rejected. If in doubt, create a fresh key and try it.

[ Back to Blog ](/blog/)
