← Blog

How to Create an Anthropic API Key (Full Walkthrough)

2026-09-02 · 4 min read · SubToAPI Team

Creating an Anthropic API key takes about two minutes once you have a Console account. You sign into console.anthropic.com, open the API Keys section, click "Create Key," give it a name, and copy the value immediately — it's the only time you'll see it in full. The rest of this guide walks through each step in detail, including the settings that trip people up (workspaces, permissions, key naming) and what to do right after you have the key.

If you just want the fastest path, skip to the "Create the key" section below. If you want to understand the decisions along the way — like whether to scope the key to a workspace or use it across a whole organization — read the full walkthrough.

Before You Start: Prerequisites

You need three things before you can create a working key:

  1. An Anthropic account — sign up at console.anthropic.com with an email address or Google login.
  2. A verified payment method — API keys work on pay-as-you-go billing, not the same subscription as Claude.ai. You'll need to add a card and typically load a small credit balance before your key can make live requests.
  3. Console access — if you're joining an existing organization, someone with admin rights needs to invite you first.

Without a payment method attached, you can create a key, but every request will fail with a billing error. This is the most common reason a "correctly created" key doesn't work.

Create the Key

Once logged into the Console:

  1. Open the left sidebar and click API Keys.
  2. Click Create Key.
  3. Give the key a descriptive name — not "test" or "key1." Use something that identifies the environment and purpose, like prod-backend-checkout or staging-support-bot. You'll thank yourself later when you have a dozen keys and need to revoke one without guessing.
  4. If your organization uses workspaces, choose which workspace the key belongs to. Workspaces isolate usage and billing between teams or projects — useful if multiple people or apps share one Anthropic account.
  5. Click Create Key. The full key value, starting with sk-ant-, is shown once.

Copy it immediately into a secure location: a password manager, a secrets vault, or an environment variable file that isn't committed to version control. Anthropic doesn't store the plaintext key — if you lose it, you have to generate a new one.

Naming and Organizing Keys From the Start

It's tempting to create one key and reuse it everywhere. Don't. Separate keys by environment and by application, even in a small project:

This isolation means a leaked development key doesn't compromise production traffic, and if usage spikes unexpectedly you can tell immediately which key is responsible by checking the Console's usage dashboard per key.

Test the Key Before Writing Application Code

Confirm the key works with a plain curl request before wiring it into your app:

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-sonnet-4-5",
    "max_tokens": 100,
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'

A successful response returns a JSON object with a content array. A 401 means the key wasn't sent correctly or was revoked; a billing error means the payment method isn't fully verified.

Set Usage Limits (Recommended)

In the Console, under billing or usage settings, you can set monthly spend limits per key or per workspace. This is worth doing before you ship anything to production — a bug that loops API calls or a leaked key being abused can generate a large bill overnight if there's no ceiling. Setting a hard cap is cheap insurance.

Rotating and Revoking Keys

Keys don't expire automatically, so rotation is manual. Good practice:

When You Need More Than a Raw Key

A raw Anthropic API key is designed for direct, server-side use by one application. If you're distributing access across a team, multiple internal tools, or customer-facing products, managing individual sk-ant- keys gets harder fast: everyone shares one spend limit, there's no per-app usage breakdown, and revoking access for one tool means touching shared credentials.

SubToAPI sits on top of your existing Claude access and issues separate application keys (sub_live_...) per app or team member, with streaming, tool use, and usage metadata included, so you get per-key visibility without managing a pile of raw Anthropic keys by hand. You can see the request format in the quickstart and messages docs, and pricing starts at €9/month on the Solo plan with a free trial at signup.

FAQ

Do I need a separate account to create an Anthropic API key?

No, but you do need a Console account (console.anthropic.com) with a verified payment method. This is separate from a Claude.ai chat subscription — API usage is billed independently, pay-as-you-go.

Why does my newly created key return a billing error?

Almost always because no payment method is attached, or the account hasn't loaded any prepaid credit yet. Add and verify a card in the Console's billing settings, then retest the key with a simple curl request.

Can I create multiple API keys for one Anthropic account?

Yes, and you should. Create separate keys per environment (dev, staging, production) and per application, with descriptive names, so you can track usage and revoke access individually without affecting other systems.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →