Anthropic provides two analytics APIs, and which one you use depends on which Claude product your organization manages:
The two APIs use different key types, created in different places by different roles. This page describes which API fits your organization and how to create the right key.
| API | Key type | Created in | Who can create it | What it covers |
|---|---|---|---|---|
| Claude Code Analytics API | Admin API key (sk-ant-admin01-...) | Claude Console > Settings > Admin keys | Organization admin | Daily Claude Code metrics per user: sessions, lines of code, commits, pull requests, tool acceptance, and estimated cost by model |
| Claude Enterprise Analytics API | Analytics API key | claude.ai > Analytics > API keys | Primary owner | Organization-wide engagement and adoption (user activity, active-user summaries, project, skill, and connector usage), plus cost and usage reports |
The key types are not interchangeable: an Admin API key cannot call the Claude Enterprise Analytics API, and an Analytics API key cannot call the Admin API. If your organization uses both the Claude Platform and Claude Enterprise, you can provision both keys and use each API for its own data.
Looking for API usage and cost data rather than product analytics? See the Usage and Cost API, which explains the right path for both Claude Console and Claude Enterprise organizations.
The Claude Code Analytics API is available to every organization with access to the Admin API, and is free to use.
Sign in as an organization admin
Only organization members with the admin role can create Admin API keys. See Organization roles and permissions for the full role list.
Create an Admin API key
Go to Claude Console > Settings > Admin keys, click Create key, name the key, and click Create. Copy the displayed secret key (starting with sk-ant-admin01-) and store it in your secrets manager. The full secret is displayed only once.
Call the API
Pass the key in the x-api-key header:
curl "https://api.anthropic.com/v1/organizations/usage_report/claude_code?starting_at=2025-09-08" \
--header "anthropic-version: 2023-06-01" \
--header "x-api-key: $ADMIN_API_KEY"For the available metrics, request parameters, and response schema, see the Claude Code Analytics API guide and the API reference.
The Claude Enterprise Analytics API is available to Claude Enterprise organizations. Engagement and adoption data is available on all Enterprise plans. The cost and usage endpoints apply to usage-based Enterprise plans; for seat-based Enterprise plans, they reflect usage credits only.
Sign in as the primary owner
Only the primary owner of the organization can enable API access and create Analytics API keys.
Enable API access and create a key
Go to claude.ai > Analytics > API keys and enable public API access, then create an Analytics API key. Keys carry the read:analytics scope. Copy the displayed secret and store it in your secrets manager.
Call the API
Pass the key in the x-api-key header. Endpoints live under https://api.anthropic.com/v1/organizations/analytics/. For request examples, parameters, and response schemas, see the Claude Enterprise Analytics API reference guide.
The Claude Enterprise Analytics API provides:
For an overview of the engagement and adoption data, see Claude Enterprise Analytics API: access, engagement, and adoption data. For endpoint details, parameters, and response schemas, see the Claude Enterprise Analytics API reference guide.
Track Claude Code sessions, code changes, and tool usage with an Admin API key.
Track API token usage and costs for your organization.
Endpoint reference for engagement, adoption, and cost data.
Audit and compliance data uses its own key types.
Was this page helpful?