AI courses in English and Dutch, with certificate AI literacy you can evidence under the EU AI Act Invoice in your employer's name, also for teams
Black Friday33% off every e-learning and team plan, from 4 to 30 November (Cyber Monday)33% off until 30 Novends in 0d 0h 0mView the e-learnings

Claude API key: how to create one in the Claude Console

Claude API key: how to create one in the Claude Console

You create a Claude API key in the Claude Console at platform.claude.com, under API keys. You give the key a name, choose an expiry date and link it to yourself or to a service account. The Console shows the full key once, immediately after you create it. With that key you call the Claude API from your own software.

To use the key you need credit, because the API works with prepaid credits. The key itself is free, and a Claude Pro or Max subscription does not give you API access, although Max, Ultra and Team subscribers do get monthly API credit.

If you lose a key, create a new one. Store a key in an environment variable and never in your code, and give team members their own keys per workspace. If a key does not work, the error code tells you where the problem lies.

What is a Claude API key?

A Claude API key, also called an Anthropic API key, is a secret key that software uses to authenticate with Anthropic’s Claude API. Every request to the API carries that key, so Anthropic can tell which account is making the request and who pays for the usage.

A Claude API key and an Anthropic API key are the same thing. A key always starts with sk-ant- and belongs to one organisation in the Claude Console. With the key you access the API from your own script, an automation tool or an application, separately from the chat environment on claude.ai.

How do you create a Claude API key?

To create a Claude API key, follow these six steps in the Claude Console:

  1. Log in to the Claude Console at platform.claude.com, or create an account there.
  2. Open the API keys page via platform.claude.com/settings/keys.
  3. Click Create key and give the key a recognisable name, for example the name of the script that uses it.
  4. Choose an expiry date: 3 hours, 1 day, 7 days, 30 days, a custom period or Never.
  5. Set Linked account to yourself or to a service account, and optionally choose a workspace to restrict the key to.
  6. Copy the key that starts with sk-ant- and store it in a safe place straight away.

The expiry date is fixed when you create the key and cannot be changed afterwards. Only choose Never for a key you manage yourself and replace periodically.

Do you need to buy credit first?

Yes, you need credit before you can use a Claude API key, because Anthropic bills the API through prepaid credits. According to Anthropic, new users do get a small amount of free credit to test the API.

You buy credits in the Console via Billing, with a credit card. To do so you need the Admin or Billing role in the organisation. Purchased credits expire one year after purchase, and with auto-reload the Console tops up your balance automatically once it drops below a threshold you set.

Usage is charged per token: every request costs tokens for the input and for the answer. How tokens in AI are counted therefore directly determines how quickly your credit runs out. The prices per model are listed under Claude pricing, in the section on the API.

Is a Claude API key free?

Yes, creating a Claude API key is free, but using it is not. You pay for the tokens you use through the key, and a Claude subscription does not cover those costs.

According to Anthropic, a paid Claude subscription does not give you access to the API or the Console. The exceptions are Max, Ultra and Team, which receive monthly API credit. Anthropic sets that credit in dollars. Max gets 100 dollars a month in API credit and Ultra 200 dollars. Team gets 20 dollars per Standard seat or 100 dollars per Premium seat, up to a combined maximum of 500 dollars a month.

You claim the API credit after seven days via the claude.ai settings, and unused credit expires at the end of each billing period. Free, Pro and Enterprise are not eligible.

Where can you find your API key again?

You cannot find your API key again after creating it, because the Console shows the full key only once. On the API keys page you can still see the key’s name and settings afterwards, but not the key itself.

If you have lost the key, create a new one and set the old one to Disable or Delete. Disable can be reversed; Delete is permanent. An expired key can only be deleted.

How do you store an API key securely?

You store an API key securely in an environment variable or a secrets manager, never in the source code itself. Anthropic’s official SDKs read the ANTHROPIC_API_KEY variable automatically, so the key does not need to appear anywhere in your scripts.

A key in code that ends up on GitHub or in a shared folder gives anyone who finds it access to your credit. Replace a leaked key immediately: delete it in the Console and create a new one. A key with an expiry date limits the damage if it does happen.

Watch out if ANTHROPIC_API_KEY is set on your computer. According to Anthropic, Claude Code uses the key from ANTHROPIC_API_KEY instead of your subscription, so your usage is billed as API costs rather than within your Pro or Max limit.

How do you manage API keys for a team?

You manage API keys for a team with workspaces and service accounts in the Claude Console. A workspace separates projects or departments, each with its own keys, its own limits and its own overview of usage.

Anthropic distinguishes three types of key. A personal key acts on your behalf and stops working as soon as you leave the organisation. A service account key acts on behalf of a service account and keeps working when an employee leaves, which makes it suitable for automations. Workspace keys still exist, but Anthropic now describes them as legacy.

Also set your own spending limit via Billing and Spend limits. That limit sits below the maximum for your usage tier. Anthropic states that maximum in dollars: 500 dollars a month for Start, 1,000 dollars for Build and 200,000 dollars for Scale. According to Anthropic, new organisations sometimes start in an evaluation tier with lower limits, which rise automatically as the account builds up a usage history.

What do you do if your API key does not work?

If your API key does not work, the error code in the API’s response points to the cause. Four codes come up most often:

  • 401: the key is invalid, expired, disabled or copied incorrectly.
  • 400: your own spending limit has been reached, or a key without a workspace is missing the anthropic-workspace-id header.
  • 429: you are above your tier’s rate limit, or your tier’s monthly spending cap has been reached.
  • 529: Anthropic’s API is temporarily overloaded.

A 429 caused by your tier’s spending cap does not go away if you retry: usage stays paused until the first day of the next month, unless you request a higher tier. A 429 caused by the rate limit and a 529 are temporary. In a production workflow on my VPS I ran into both, and without retry logic in the code a script stops halfway.

Frequently asked questions about the Claude API key

Beyond creating a Claude API key, people often ask about alternatives to a key and what happens to their requests.

Can you use the Claude API without an API key?

Yes, for local development work you can use the Claude API without an API key by logging in to Anthropic’s CLI with ant auth login. You then log in to the Claude Console via the browser and receive a token bound to one workspace. For servers, CI and containers, Anthropic recommends Workload Identity Federation. If ANTHROPIC_API_KEY is set in your environment, that key takes precedence over any profile, according to the documentation.

Does Anthropic train on the data you send via your API key?

No, by default Anthropic does not train on the data you send via your API key, because the API falls under its commercial products. According to Anthropic’s Privacy Center, this applies to the API, the Console and the Team and Enterprise plans. The exceptions are material you submit as feedback yourself, participation in the Development Partner Program and an explicit opt-in to training.

Does a Claude API key also work on Amazon Bedrock?

On Amazon Bedrock you do not use a Claude API key, because there you authenticate with AWS credentials rather than with a key from the Claude Console. According to Anthropic’s documentation, on Bedrock you use AWS IAM credentials or a Bedrock bearer token. The prices for Claude via Bedrock are on the Amazon Bedrock pricing page, not in the Claude Console.

How do you learn to build with your first API key?

You learn to build with your first API key by automating one specific task, such as summarising incoming documents or drafting emails. The key only gives you access; the value lies in a good prompt, a fixed output format and a check on that output.

The AI Automation Course teaches you these steps without any technical background: building an automation for recurring work with Claude, with a check on the output. With a well-managed key and a clear task, the Claude Console is the starting point for your first working application.

Related articles

Claude programmeerinterface API-sleutel
Claude guide
Dennis van de Velde

Claude API: what it is and what you can do with it

The Claude API gives your own software direct access to Anthropic’s Claude models. Learn how it differs from claude.ai, which model to pick and what to watch in production.