How to Get an Anthropic API Key in 2026 (Step-by-Step, Plus the New No-Key Option)

About Will

I run a multi-site content operation on Claude and Notion with autonomous agents — and I write about what we do, including what breaks.

Connect on LinkedIn →

Last verified: June 11, 2026 (Pacific Time).

Quick answer: sign in at console.anthropic.com (it now redirects to the same developer console as platform.claude.com), add a payment method under Settings → Billing, click API Keys → Create Key, name it, and copy it immediately — Anthropic shows the key exactly once. Keys start with sk-ant-. The whole process takes about five minutes.

Below is the full walkthrough, where to put the key so it doesn’t leak, the newer no-static-key option most tutorials haven’t caught up with, and the errors that account for nearly every failed first request.

What you need before you start

  • An email address (or Google / SSO login)
  • A payment method — your key will not work until billing is set up, even though you can create one
  • Five minutes

One distinction that confuses almost everyone: a Claude.ai subscription is not API access. Claude Pro, Max, and Team plans cover the Claude apps (web, desktop, mobile). The API is billed separately, by usage, through the developer console. You can have either one without the other — see our complete Claude pricing guide for how the two systems differ.

Step 1: Create your account

Go to console.anthropic.com — Anthropic’s developer console. (Both console.anthropic.com and platform.claude.com land in the same place in 2026; older tutorials treat them as different sites.) Sign up with email, Google, or SSO, and answer the brief onboarding questions about whether you’re an individual or an organization. For a tour of everything inside the console, see our Anthropic Console guide.

Step 2: Add billing

In the console, open Settings → Billing and add a credit card (self-serve accounts typically purchase prepaid usage credits). Skipping this step is the #1 reason a brand-new key returns errors — the key exists, but requests are rejected until the account can be billed.

Step 3: Create the key

Click API Keys in the left sidebar (direct link: platform.claude.com/settings/keys), then Create Key. Give it a descriptive name like my-app-dev — future you will thank present you when it’s time to rotate or revoke. If your organization uses multiple workspaces, note that keys are scoped to a workspace: the key only sees resources in the workspace it was created in.

Step 4: Copy it immediately

The key is displayed exactly once. It starts with sk-ant- followed by a long string. Copy it straight into a password manager, a .env file, or your secrets manager. If you lose it, there is no way to view it again — you revoke it and create a new one (takes a minute, harms nothing).

Where to put the key (and where never to put it)

Set it as an environment variable named ANTHROPIC_API_KEY — every official Anthropic SDK reads that variable automatically, so your code never contains the key:

  • macOS / Linux: export ANTHROPIC_API_KEY=sk-ant-...
  • Windows (PowerShell): setx ANTHROPIC_API_KEY "sk-ant-..."
  • Python: client = anthropic.Anthropic() — no key argument needed
  • TypeScript: const client = new Anthropic() — same

Never hardcode the key in source files, never commit it to a repository, and never paste it into a system prompt or chat message. Leaked Anthropic keys get scraped and drained like any other credential.

The 2026 no-key option: OAuth login

Newer than most guides: Anthropic’s CLI can authenticate without any static key. Run ant auth login and a browser window authorizes a short-lived OAuth profile on your machine — the SDKs and Claude Code pick it up automatically, and there is no permanent secret to leak or rotate. For CI servers and production workloads, Workload Identity Federation serves the same purpose. If you’re setting up a personal development machine in 2026, this is arguably the better default; create a static key when you need one for a deployed service.

Test your key

One request confirms everything works (Haiku keeps the test nearly free):

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "claude-haiku-4-5", "max_tokens": 32, "messages": [{"role": "user", "content": "Say hello"}]}'

A JSON response with a content array means you’re live.

Troubleshooting the four common errors

  • 401 authentication_error — the key is missing, mistyped, or revoked. Subtle 2026 variant: if both ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN are set, the SDK sends both and the API rejects the request — unset one.
  • 403 permission_error — the key works but lacks access to that model or feature; check your key’s workspace and your organization’s model access.
  • 429 rate_limit_error — you’re sending faster than your usage tier allows. The response includes a retry-after header; official SDKs retry automatically. For tier details and fixes, see our Claude rate limits guide.
  • Key created but every request fails — almost always billing not completed (Step 2).

FAQ

Is the Anthropic API free? No — it’s usage-priced per million tokens with no permanent free tier (current rates in our Claude pricing guide, including the June 2026 lineup with Fable 5).

Where do I find my existing API key? You can’t — Anthropic shows keys only at creation. Revoke the old one and create a replacement.

Does my Claude Pro or Max subscription include an API key? No. App subscriptions and API billing are separate systems; an API account starts at $0 and bills per token used.

What models can a new key use? The current lineup as of June 2026 — including Claude Fable 5, Opus 4.8, Sonnet 4.6, and Haiku 4.5; see everything that changed in June 2026.

Get alerted when Claude pricing or limits change

We track Anthropic’s models, pricing, and limits daily and send a short note when something changes that affects what you pay or build. Occasional, no spam.

Subscription Form

Sources

Track the AI tools you actually use
Live, vendor-neutral prices & limits for ChatGPT, Claude, Gemini, Perplexity and more — and we’ll email you the moment your tools change price or limits. Free, no hype.
See the live AI tracker →or set up your alerts

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *