Claude Platform Docs
AdminOrganization

Admin API

Manage organization members, workspaces, invites, and API keys programmatically with the Admin API, using an Admin API key, an org:admin OAuth token, or a personal or service account key.

The Admin API lets you manage your organization’s members, workspaces, invites, and API keys programmatically instead of by hand in the Claude Console.

Availability

The Admin API is available to Claude Console and Claude Enterprise organizations.

If your company has a Claude Console organization, you can use the Admin API with that organization; see the Admin API keys and tokens page. An individual Console account must first set up an organization on the Organization settings page (platform.claude.com/settings/organization) in the Claude Console.

Claude Enterprise (claude.ai) organizations call the Admin API with an Enterprise Admin API key created in claude.ai. From this page, only the members, invites, and organization info endpoints apply to them. Outside this page, they can also call the following APIs and endpoints:

For members, invites, groups, and custom roles, see User management.

Cloud platforms lists the endpoints you can call on Claude Models on Google Cloud (Anthropic managed) and Claude Platform on AWS.

Authentication

The Admin API accepts any of these three credentials:

  • A Console Admin API key (starting with sk-ant-admin...) sent in the x-api-key header or the authorization: Bearer header. Only organization members with the admin role can provision one. See Admin API keys and tokens.
  • An OAuth bearer token with the org:admin scope, sent in the authorization: Bearer header. A user needs the admin role to obtain one. See OAuth bearer token. For the role a service account needs, see Permission boundaries on the Workload Identity Federation (WIF) reference page.
  • A personal key or service account key scoped to the organization, sent in the x-api-key header or the authorization: Bearer header. The key has the permissions of its linked account. See Key types on the Developer API keys page.

An Admin API key covers most endpoints, but the service-account, federation-issuer, and federation-rule endpoints accept only an org:admin OAuth token. The following examples call the organization info endpoint with an OAuth token and with an Admin API key.

The SDK exposes the endpoints on this page under client.organization, and the ant CLI under ant organization. The examples on this page use the default client, which reads an Admin API key from ANTHROPIC_API_KEY or an OAuth bearer token from ANTHROPIC_AUTH_TOKEN. The comments in each list example say whether it fetches more pages or reads only the first. For each endpoint’s parameters and responses, see the Admin API reference.

OAuth bearer token

You need the latest version of the ant CLI. To install it, see Installation in the CLI quickstart.

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.

CLI
# 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.

Call the Admin API with the exported token:

client = anthropic.Anthropic()

organization = client.organization.retrieve()

print(f"id: {organization.id}")
print(f"name: {organization.name}")

The token in ANTHROPIC_AUTH_TOKEN is short-lived, and nothing renews it there. When requests start to return 401, follow these steps:

  1. Rerun the export command, which gets a new token if the old one has expired.
  2. If requests still return 401, sign in again with the same ant auth login command that you used, and rerun the export command.

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, run ant profile activate default.
  • You have no other profile: ant auth logout --all revokes 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 set ANTHROPIC_API_KEY again if you use it.

For CI and other non-interactive workloads, mint the token with Workload Identity Federation instead of logging in interactively. See Manage WIF with the Admin API.

Admin API key

To create an Admin API key for your organization type, see Admin API keys and tokens.

client = anthropic.Anthropic()

organization = client.organization.retrieve()

print(f"id: {organization.id}")
print(f"name: {organization.name}")

How the Admin API works

Authenticate with any credential from Authentication, then manage the following resources:

  • Organization members and their roles
  • Organization invites
  • Workspaces and their members
  • API keys
  • Service accounts, federation issuers, and federation rules (org:admin OAuth token only)

Common uses include automating onboarding and offboarding, managing workspace access, and auditing API keys.

Organization roles and permissions

Claude Console organizations have five organization-level roles. For details, see API Console roles and permissions.

RolePermissions
userCan use playground
claude_code_userCan use playground and Claude Code
developerCan use playground and manage API keys
billingCan use playground and manage billing details
adminCan do all of the preceding, plus manage users

Claude Enterprise organizations have a different set of roles, including owners and a primary owner. See Organization roles.

Key concepts

Organization members

List organization membersPreview with links to the API reference available — press Tab until focus enters the card, Escape to return., update their roles, and remove them.

List the members of your organization:

client = anthropic.Anthropic()

users = client.organization.users.list(limit=10)

# Automatically fetches more pages as needed, so `limit` sets the page size, not the total.
for user in users:
    print(f"{user.id}: {user.email} ({user.role})")

Update a member’s role:

client = anthropic.Anthropic()

user = client.organization.users.update(
    "user_01WxYzAbCdEfGhJkMnPqRsTu", role="developer"
)

print(f"id: {user.id}")
print(f"role: {user.role}")

Remove a member from the organization:

client = anthropic.Anthropic()

removed_user = client.organization.users.remove("user_01WxYzAbCdEfGhJkMnPqRsTu")

print(f"id: {removed_user.id}")

Organization invites

Invite users to your organization and manage pending invitesPreview with links to the API reference available — press Tab until focus enters the card, Escape to return..

Invite a user to your organization:

client = anthropic.Anthropic()

invite = client.organization.invites.create(email="user@example.com", role="developer")

print(f"id: {invite.id}")
print(f"email: {invite.email}")
print(f"status: {invite.status}")
print(f"expires_at: {invite.expires_at}")

List pending, accepted, and expired invites:

client = anthropic.Anthropic()

invites = client.organization.invites.list(limit=10)

# Automatically fetches more pages as needed, so `limit` sets the page size, not the total.
for invite in invites:
    print(f"{invite.id}: {invite.email} ({invite.status})")

Delete an invite:

client = anthropic.Anthropic()

deleted_invite = client.organization.invites.delete("invite_015gWxHNr6h6TdRPZTmuCGnn")

print(f"id: {deleted_invite.id}")

Workspaces

See Workspaces for Console and API examples.

Workspace members

Manage user access to specific workspacesPreview with links to the API reference available — press Tab until focus enters the card, Escape to return..

Add a member to a workspace:

client = anthropic.Anthropic()

member = client.organization.workspaces.members.add(
    "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",
    user_id="user_01WxYzAbCdEfGhJkMnPqRsTu",
    workspace_role="workspace_developer",
)

print(f"user_id: {member.user_id}")
print(f"workspace_role: {member.workspace_role}")

List the members of a workspace:

client = anthropic.Anthropic()

members = client.organization.workspaces.members.list(
    "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ", limit=10
)

# Automatically fetches more pages as needed, so `limit` sets the page size, not the total.
for member in members:
    print(f"{member.user_id}: {member.workspace_role}")

Update a workspace member’s role:

client = anthropic.Anthropic()

member = client.organization.workspaces.members.update(
    "user_01WxYzAbCdEfGhJkMnPqRsTu",
    workspace_id="wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",
    workspace_role="workspace_admin",
)

print(f"user_id: {member.user_id}")
print(f"workspace_role: {member.workspace_role}")

Remove a member from a workspace:

client = anthropic.Anthropic()

removed_member = client.organization.workspaces.members.remove(
    "user_01WxYzAbCdEfGhJkMnPqRsTu", workspace_id="wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"
)

print(f"user_id: {removed_member.user_id}")

API keys

Monitor and manage API keysPreview with links to the API reference available — press Tab until focus enters the card, Escape to return.. Each key in the response includes these fields:

  • expires_at: when the key expires. It’s null for a key without an expiration (see Key expiration).
  • principal: the identity the key acts as (see Key types). It’s {"type": "user_actor", "user_id": "user_..."} for a personal key, {"type": "service_account_actor", "service_account_id": "svac_..."} for a service account key, and null for a workspace key.
  • scope: where the key can work. It’s {"type": "workspace", "workspace_id": "wrkspc_..."} for a key scoped to one workspace, and {"type": "organization"} for a key scoped to the organization, which can work in several workspaces.

Filtering the list by workspace_id with the default workspace’s ID returns only keys scoped to the default workspace. A key scoped to the organization isn’t returned under any workspace_id filter. To list such keys, leave out workspace_id: the list then includes every Developer API key that your credential can list (see Developer API keys).

List the active API keys in a workspace:

client = anthropic.Anthropic()

api_keys = client.organization.api_keys.list(
    limit=10, status="active", workspace_id="wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"
)

# Automatically fetches more pages as needed, so `limit` sets the page size, not the total.
for api_key in api_keys:
    print(f"{api_key.id}: {api_key.name} ({api_key.status})")

Rename or deactivate an API key:

client = anthropic.Anthropic()

api_key = client.organization.api_keys.update(
    "apikey_01Rj2N8SVvo6BePZj99NhmiT", status="inactive", name="New Key Name"
)

print(f"id: {api_key.id}")
print(f"name: {api_key.name}")
print(f"status: {api_key.status}")

Service accounts

Create and manage service accounts (svac_...), the non-human identities that service account keys and Workload Identity Federation tokens act as. These endpoints, like the federation-issuer and federation-rule endpoints, require an org:admin OAuth token. See Service accounts in Manage WIF with the Admin API.

Federation issuers

Register the OIDC identity providers (fdis_...) whose tokens may assert workload identity for your organization. See Federation issuers in Manage WIF with the Admin API.

Federation rules

Manage the rules (fdrl_...) that map issuer tokens to service accounts and scopes. See Federation rules in Manage WIF with the Admin API.

Accessing organization info

The /v1/organizations/me endpoint returns the organization that your credential belongs to:

client = anthropic.Anthropic()

organization = client.organization.retrieve()

print(f"id: {organization.id}")
print(f"name: {organization.name}")
{
  "id": "12345678-1234-5678-1234-567812345678",
  "type": "organization",
  "name": "Organization Name"
}

For parameter details and response schemas, see the Organization Info API referencePreview with links to the API reference available — press Tab until focus enters the card, Escape to return..

Usage and cost reports

Track your organization’s usage and costs with the Usage and Cost Analytics API. The Usage and Cost API is the legacy API for this data.

Claude Code analytics

Monitor developer productivity and Claude Code adoption with the Claude Code Analytics API.

Rate limits

Read the rate limits configured for your organization and its workspaces, and set workspace rate limits, with the Rate Limits API.

Compliance API

Retrieve audit and activity data for your organization with the Compliance API. Admin API keys can read only the Activity Feed. The exception is the Safety Cases API: an Admin API key that you create while that API is available to your organization also reaches it. Through that API, the key can read flagged messages and respond to Safety Cases. For full access, see Set up the Compliance API.

Organization webhooks

Register webhook endpoints for events about enforcement actions on your organization’s user profiles with organization webhooks.

Cloud platforms

On the following cloud platforms, send requests to the platform’s base URL. Use the platform’s credentials instead of the ones under Authentication.

On Claude Platform on AWS, only these Admin API endpoints are available:

  • The workspace endpoints: create, get, list, update, and archive on /v1/organizations/workspaces.
  • The external key endpoints, for customer-managed encryption keys (CMEK): register, get, list, update, and delete on /v1/organizations/external_keys. Attaching a key to a workspace validates it.
  • The telemetry destination endpoints.
  • The compliance settings endpoints, to read and change the Compliance API setting: get and update on /v1/organizations/compliance_settings.
  • The Usage and Cost Analytics API endpoints, which are in beta: /v1/organizations/analytics/usage and /v1/organizations/analytics/cost.

For the base URL and credentials, see Making requests on Claude Platform on AWS.

On Claude Models on Google Cloud (Anthropic managed), use the organization-level base URL that Making requests on Claude Models on Google Cloud (Anthropic managed) describes. You can call these Admin API endpoints:

  • The workspace endpoints: create, get, list, update, and archive on /v1/organizations/workspaces.
  • The external key endpoints, for CMEK: create, get, list, update, and delete on /v1/organizations/external_keys. To verify and attach a key, follow Set up CMEK with Google Cloud KMS.
  • The Usage and Cost Analytics API endpoints, which are in beta: /v1/organizations/analytics/usage and /v1/organizations/analytics/cost.
  • The usage endpoint of the legacy Usage and Cost API: /v1/organizations/usage_report/messages.
  • The Rate Limits API endpoints that read limits: GET /v1/organizations/rate_limits and GET /v1/organizations/workspaces/{workspace_id}/rate_limits.

Best practices

  • Use meaningful names and descriptions for workspaces and API keys
  • Handle errors from failed operations
  • Regularly audit member roles and permissions
  • Archive unused workspaces and delete pending invites you no longer need
  • Monitor API key usage, audit each key’s expires_at (see Key expiration), and rotate keys periodically

FAQ

For workspace-specific questions, see the Workspaces FAQ.

Was this page helpful?