Admin API keys and tokens
Get the credential a program uses to manage your Claude Console or Claude Enterprise organization: an Admin API key or a token with the org:admin scope.
Is this the key you need? Admin API keys and tokens manage an organization. To call Claude instead, for example to send a message, see Authentication.
A program that holds an Admin API key or token can manage your organization. Depending on the credential, it can manage members, invites, and workspaces through the Admin API, read activity records through the Compliance API, or report usage and cost through the Usage and Cost Analytics API. This page helps you choose the credential and get it.
Which credential you use depends on where you manage your organization: in the Claude Console (platform.claude.com) or in Claude Enterprise (claude.ai).
| Organization | Use | What it reaches |
|---|---|---|
| A Claude Console organization | A Console Admin API key or a token with the org:admin scope | The whole organization |
| A Claude Enterprise organization | An Enterprise Admin API key | What its scopes allow |
On Claude Models on Google Cloud (Anthropic managed) or Claude Platform on AWS, use that platformâs credentials instead of an Admin API key. For the Admin API endpoints you can call on those platforms, see Cloud platforms on the Admin API page. For the Activity Feed on those platforms, see Set up the Compliance API.
There are two kinds of API key, each named for its main job:
| Key | What it works with |
|---|---|
| Developer API key | The APIs that call Claude, such as Messages, Files, and Managed Agents |
| Admin API key | The APIs that manage and report on an organization, such as the Admin API and the Compliance API |
An Admin API key canât call Claude. The Claude Console calls a Developer API key an âAPI keyâ and lists these keys on its API keys page.
Claude Console organizations
An individual Console account canât create an Admin API key. To use the Admin API, set up an organization, as the Admin API pageâs Availability section describes. In an organization, use one of two credentials to manage the whole organization:
- A Console Admin API key fits either an automated job with no identity provider or a tool that takes only a key. The key is a stored secret that belongs to the organization, not to a person. See Create a key for a Claude Console organization.
- A token with the
org:adminscope fits either a person at a terminal or an automated job whose platform has an identity provider. The token is short-lived and acts as a person or a service account. With only this scope, it canât call Claude. See Get an access token with theorg:adminscope.
The two differ in a few places:
- Only a Console Admin API key, not a token, reads the Compliance APIâs Activity Feed. See Query the Activity Feed.
- Only a token with the
org:adminscope manages service accounts and federation.
Create a key for a Claude Console organization
Before you start:
- You need the admin role in a Claude Console organization. See the Admin API pageâs Organization roles and permissions section.
- If the key needs to read the Activity Feed, enable the Compliance API before you create the key, as Set up the Compliance API describes. A key created before then canât read the feed, so replace it with a new one.
Open Admin keys settings
Sign in to the Claude Console and go to the Admin keys page (
platform.claude.com/keys/admin-keys).Create the key
Click Create admin key, name the key, select a key expiration, and click Add.
Copy and store the secret
Copy the displayed secret, which starts with
sk-ant-admin01-, and store it in your secrets manager. The full secret is shown only once.
What a Console Admin API key works with
A Console Admin API key manages the Claude Console organization it was created in. The key has no scopes to choose, so a program that holds it can call these APIs:
| API | Use it to |
|---|---|
| Admin API | Manage members, invites, workspaces, and Developer API keys |
| Usage and Cost Analytics API | Report token usage and cost |
| Usage and Cost API (legacy) | Report usage and cost |
| Rate Limits API | Read your organizationâs rate limits and set workspace limits |
| Claude Code Analytics API | Report on Claude Code productivity |
| Compliance API Activity Feed | Read organization-wide activity events |
A key that you create while the Safety Cases API is available to your organization also reaches that API.
Get an access token with the org:admin scope
How you get the token depends on who makes the calls:
- A person at a terminal: Sign in with the
antCLI and theorg:adminscope, as the following commands show. - An automated job whose platform has an identity provider: Use Workload Identity Federation. An admin creates a federation rule that grants the
org:adminscope. See the Manage WIF with the Admin API pageâs Bootstrap a workload to manage WIF section.
A person needs the admin role to sign in with the org:admin scope. For the role a service account needs, see Permission boundaries on the WIF reference page.
You need the latest version of the ant CLI. To check yours, compare the output of ant --version with the newest release on the CLIâs GitHub releases page. To install the latest version, use one of these methods:
brew install anthropics/tap/antFor Linux environments, download the release binary directly.
VERSION=2.16.0
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
case $(uname -m) in
x86_64) ARCH=amd64 ;;
aarch64) ARCH=arm64 ;;
esac
curl -fsSL "https://github.com/anthropics/anthropic-cli/releases/download/v${VERSION}/ant_${VERSION}_${OS}_${ARCH}.tar.gz" \
| sudo tar -xz -C /usr/local/bin antYou can find all releases on the GitHub releases page.
You can also install the CLI from source with go install, which requires Go 1.26.10 or later.
go install github.com/anthropics/anthropic-cli/v2/cmd/ant@latestgo install places the binary in $(go env GOPATH)/bin. Add that directory to your PATH if it isnât already there:
export PATH="$PATH:$(go env GOPATH)/bin"On Windows, you can install the CLI inside Windows Subsystem for Linux (WSL) with the Linux steps. If you sign in with the CLI inside WSL, also run your code there so that it finds your sign-in.
Unlike a usual sign-in, which works in one workspace, an admin sign-in can make changes across your organization.
The following commands change environment variables, so run them in a shell that you keep for administration. They list your profiles, unset ANTHROPIC_API_KEY, sign in under a separate profile with the org:admin scope, and export the token. The --admin flag in the ant auth login command adds the org:admin scope to the scopes that a sign-in already requests.
The sign-in also makes the admin profile the CLIâs active profile. Your other shells use it too. Until you switch back, clients in those shells that use the active profile, such as the ant CLI, can run as an admin.
# List your profiles. An asterisk marks the active one.
# Note it, so that you can switch back later:
ant profile list
# Unset the API key variable.
# While that variable is set, the SDK and the CLI use the key and not the token:
unset ANTHROPIC_API_KEY
ant auth login --profile admin --admin
export ANTHROPIC_AUTH_TOKEN=$(ant auth print-credentials \
--profile admin --access-token)In this shell, the SDK and the ant CLI send the exported token on every call, whichever profile is active.
For organization webhooks, sign in another way, as the Sign in for organization webhooks section describes.
Renew the access token and clean up
The token in ANTHROPIC_AUTH_TOKEN is short-lived, and nothing renews it there. When requests start to return 401, follow these steps:
- Rerun the
exportcommand, which gets a new token if the old one has expired. - If requests still return 401, sign in again with the same
ant auth logincommand that you used, and rerun theexportcommand.
When you finish your admin work, undo what the sign-in commands changed. What to run for the active profile depends on whether you have a profile other than the one you signed in under:
- You have another profile: Switch back to the profile that was active before you signed in. If it was
default, runant profile activate default. - You have no other profile:
ant auth logout --allrevokes the tokens on the server and removes every profile and credential. Run it so that the profile you signed in under doesnât stay the active one.
If you switched back, the profile you signed in under keeps its credential on disk. If you wonât need that credential for your next admin session, run ant auth logout --profile with the profileâs name, such as admin. That revokes its tokens on the server and deletes the credential.
The unset and export commands changed environment variables only in the shell where you ran them. To undo them, do one of these:
- Close that shell.
- To keep using the shell, unset
ANTHROPIC_AUTH_TOKEN, and setANTHROPIC_API_KEYagain if you use it.
Sign in for organization webhooks
The organization webhooks endpoints accept an org:admin token. The token must be scoped to the default workspace or to no workspace. See that pageâs Before you start section. To get a token that isnât scoped to a workspace, run the sign-in commands earlier on this page with two changes:
- In the
ant auth logincommand, pass--scope "org:admin"in place of--admin. - Use another profile name, such as
webhooks, in both theant auth loginandant auth print-credentialscommands.
With only the org:admin scope, that profile canât call Claude or run your usual commands.
Claude Enterprise organizations
In a Claude Enterprise organization, the Admin API and the Compliance API take an Enterprise Admin API key. So does every other API listed on the Enterprise Admin API key scopes page.
Create a key for a Claude Enterprise organization
A key that holds only Compliance API scopes is also called a Compliance Access Key. A key that holds only read:analytics is also called an Analytics API key.
Before you start:
- You need the primary owner or organization owner role in a Claude Enterprise organization. See the User management pageâs Organization roles section.
- A primary owner can select any scope. An organization owner can select only Compliance API scopes and only on a key for their own organization. See Who can select which scopes on the Enterprise Admin API key scopes page.
- If the key needs Compliance API scopes, first enable the Compliance API, as Set up the Compliance API describes.
- If the key needs
read:analytics, first get access to the Claude Enterprise Analytics API. See Get access to the Claude Enterprise Analytics API.
Key access
When you select a Compliance API scope in claude.ai, the key form can show Key access options:
- Only this organization: The key is for your organization. This option is selected by default.
- All organizations: The keyâs Compliance API scopes reach all linked organizations. Only the primary owner can select this option. The key can then hold only Compliance API, group, and audit scopes.
Create the key in claude.ai
Choose the scopes
List every scope your program needs. For what a scope allows, see Enterprise Admin API key scopes. You canât add a scope to the key later.
Open API settings
Sign in to claude.ai and open your organizationâs API settings, at Organization settings > API. Find the Keys section.
Name the key and select its scopes
Click Create key and name the key. If the key needs Compliance API scopes, select them first.
If Key access appears, choose which organizations the key reaches. See Key access.
Then, select any other scopes.
Create the key
Click Create. If the key has the
delete:compliance_user_datascope, also click Confirm and create key.Copy and store the secret
Copy the displayed secret, which starts with
sk-ant-api01-, and store it in your secrets manager. The full secret is shown only once.
Use the key or access token
Send a key or a token in the Authorization header as Bearer <credential>. A key also works in the x-api-key header. Each APIâs page has complete request examples.
If a key lacks a scope that an endpoint needs, the call fails with 403 Forbidden. The error message names the scopes the endpoint accepts.
Replace an Admin API key
An Enterprise Admin API key doesnât expire. To replace a key of either kind, follow these steps:
- Create a new key. Follow this pageâs steps for your kind of organization.
- Switch your program to the new key. Check that its calls succeed.
- Delete the old key. Where you delete it depends on its kind:
- Console Admin API key: Delete it on the Admin keys page in the Claude Console.
- Enterprise Admin API key: Delete it in your organizationâs API settings in claude.ai, at Organization settings > API.
Was this page helpful?