---
title: Analytics APIs
url: https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/analytics-api
description: Understand which analytics API and API key your organization needs, then provision access to Claude Code productivity metrics or Claude Enterprise engagement and adoption data.
---

Anthropic provides two product analytics APIs, and which one you use depends on which Claude product your organization manages:

* The **Claude Code Analytics API** reports daily Claude Code productivity metrics for organizations that use the Claude Platform. It is part of the [Admin API](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/admin-api) and uses an Admin API key.
* The **Claude Enterprise Analytics API** reports organization-wide engagement, adoption, and cost data across Claude products (chat, projects, Claude Code, and more) for Claude Enterprise organizations. It uses an Analytics API key created in claude.ai.

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.

## Which API do you need?

| API | Key type | Created in | Who can create it | What it covers |
| ----- | ----- | ----- | ----- | ----- |
| **Claude Code Analytics API** | Admin API key | [Admin keys](https://code.saschaberens.de/_h/platform.claude.com/settings/admin-keys) page in the Claude Console | Organization admin | Daily Claude Code metrics for each user: sessions, lines of code, commits, pull requests, tool acceptance, and estimated cost by model |
| **Claude Enterprise Analytics API** | Analytics API key | [claude.ai > Organization settings > API](https://code.saschaberens.de/admin-settings/api-access) | Primary owner | Organization-wide engagement and adoption (user activity, active-user summaries, project, skill, and connector usage), plus cost and usage reports |

The two key types differ in what they can call:

* An **Admin API key** (`sk-ant-admin01-...`) cannot call the Claude Enterprise Analytics API.
* An **Analytics API key** is a key created in claude.ai with the `read:analytics` scope. Besides the Claude Enterprise Analytics API, it works with the [Usage and Cost Analytics API](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/usage-cost-analytics-api) and the legacy [Usage and Cost API](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/usage-cost-api). To call Admin API endpoints such as members and invites, a key created in claude.ai needs other scopes (see [Choose scopes for a Claude Enterprise key](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/admin-api-keys#choose-scopes-for-a-claude-enterprise-key)).

The Claude Code Analytics API and the Claude Enterprise Analytics API both appear under the [Admin API reference](https://code.saschaberens.de/_h/platform.claude.com/docs/en/api/beta/organization), but they are separate APIs. If your organization uses both the Claude Platform and Claude Enterprise, you can provision both keys and use each API for its own data.

<Note>
  Looking for token usage and cost data rather than product analytics? See the [Usage and Cost Analytics API](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/usage-cost-analytics-api), which serves both Claude Console and Claude Enterprise organizations.
</Note>

<Note>
  If you want to view engagement and adoption data in the product rather than programmatically, use the [Analytics dashboard](https://code.saschaberens.de/analytics/activity) in claude.ai. For governance and auditing use cases (individual user actions, raw activity events, conversation content), see the [Compliance API](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/compliance-api).
</Note>

## Get access to the Claude Code Analytics API

The Claude Code Analytics API is available to every organization with access to the [Admin API](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/admin-api), and is free to use.

<Steps>
  <Step title="Create an Admin API key">
    Follow the steps in [Create an Admin API key](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/admin-api-keys#create-a-key-for-a-claude-console-organization).
  </Step>

  <Step title="Call the API">
    Pass the key in the `x-api-key` header:

    ```bash
    curl "https://code.saschaberens.de/_h/api.anthropic.com/v1/organizations/usage_report/claude_code?starting_at=2025-09-08" \
      -H "anthropic-version: 2026-10-21" \
      -H "x-api-key: $ANTHROPIC_ADMIN_KEY"
    ```
  </Step>
</Steps>

For the available metrics, request parameters, and response schema, see the [Claude Code Analytics API](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/claude-code-analytics-api) guide and the [API reference](https://code.saschaberens.de/_h/platform.claude.com/docs/en/api/beta/organization/usage_report/retrieve_claude_code).

## Get access to the Claude Enterprise Analytics API

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.

<Steps>
  <Step title="Sign in as the primary owner">
    Only the primary owner of the organization can enable API access and create Analytics API keys.
  </Step>

  <Step title="Enable API access and create a key">
    Go to [claude.ai > Organization settings > API](https://code.saschaberens.de/admin-settings/api-access) 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.
  </Step>

  <Step title="Call the API">
    Pass the key in the `x-api-key` header and include the [`anthropic-version`](https://code.saschaberens.de/_h/platform.claude.com/docs/en/api/versioning) header on every request. Endpoints live under `https://code.saschaberens.de/_h/api.anthropic.com/v1/organizations/analytics/`. For request examples, parameters, and response schemas, see the [Claude Enterprise Analytics API reference](https://code.saschaberens.de/_h/platform.claude.com/docs/en/api/beta/organization/analytics).
  </Step>
</Steps>

The Claude Enterprise Analytics API provides:

* **User activity:** per-user daily metrics across chat (conversations, messages, projects, files, artifacts), Claude Code (sessions, commits, pull requests, lines of code, tool actions), Chat and Cowork unified (chat activity and Cowork sessions), and other Claude products
* **Activity summaries:** organization-level daily, weekly, and monthly active users, seat counts, and pending invites
* **Project, skill, and connector usage:** adoption breakdowns for chat projects, skills, and connectors
* **Cost and usage reports:** per-user and organization-level token usage and cost over time (usage-based Enterprise plans)

<Note>
  The cost and usage report endpoints under `/v1/organizations/analytics/` (`usage_report`, `cost_report`, `user_usage_report`, and `user_cost_report`) are legacy and remain supported. For new integrations, use the [Usage and Cost Analytics API](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/usage-cost-analytics-api). To move an existing integration, see [Migrate from the Claude Enterprise usage and cost reports](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/usage-cost-analytics-api#migrate-from-enterprise-analytics-reports). The other Claude Enterprise Analytics API endpoints are not legacy.
</Note>

For endpoint details, parameters, and response schemas, see the [Claude Enterprise Analytics API reference](https://code.saschaberens.de/_h/platform.claude.com/docs/en/api/beta/organization/analytics). The following sections cover data freshness, metric definitions, and operational guidance that apply across those endpoints.

## Data availability and freshness

Claude Enterprise Analytics API data is available for dates on or after January 1, 2026.

**Engagement and adoption endpoints** (user activity, summaries, projects, skills, connectors) return a per-day snapshot for the date you specify. Data for a given day is typically available by about 13:00–13:30 UTC the following day (a 1-day lag). Until then, the most recent available day is usually 2 days before the current UTC date. Data arrives later on days when an upstream data pipeline runs late, and exact freshness varies by query. Rather than assuming a fixed time, check the error response: requesting a date that is not yet available returns a 400 error naming the most recent available day. If data is not available well past the typical lag, it usually indicates a data pipeline failure on Anthropic’s side; contact support if the gap persists.

**Cost and usage endpoints** follow a different freshness model. Data is typically available within 4 hours of the underlying usage but might take up to 24 hours. Values can be revised as late events arrive and reconciliation runs, until about 7 days after the end of the calendar month. For example, values for October 1 can change until about November 7. For invoicing-grade totals, query only months that ended at least 7 days ago.

<Note>
  Cost and usage responses include a `data_refreshed_at` timestamp. If you omit `ending_at`, it defaults to 31 days after `starting_at` or the current time, whichever is earlier. That range can run past `data_refreshed_at`, and data after that time is incomplete. For stable results across repeated calls, set `ending_at` to a value at or before a previously returned `data_refreshed_at`.
</Note>

## How metrics are defined

**Active users.** A user counts as active for a day if any of the following is true:

* They sent at least one chat message in Claude.
* They had at least one Claude Code session (local or remote) associated with your Claude Enterprise organization that included tool use or git activity.
* They had at least one Cowork session with tool use or message activity.

**Chat and Cowork unified.** Chat and Cowork unified brings Cowork’s features into claude.ai chat. Most activity in Chat and Cowork unified is reported under the `chat_cowork_unified` product value, not `chat` or `cowork`.

In user activity and in skill, connector, and plugin usage, this usage appears in the `chat_cowork_unified_metrics` object. In activity summaries, it is counted in `chat_cowork_unified_daily_active_user_count`, `chat_cowork_unified_weekly_active_user_count`, and `chat_cowork_unified_monthly_active_user_count`.

When a user starts using Chat and Cowork unified, their usage moves out of your chat and Cowork figures and into the Chat and Cowork unified figures. Usage from days before a user starts using Chat and Cowork unified stays under chat or Cowork. Organization-wide figures, such as total token usage, total cost, and overall active user counts, do not change. Cost and usage reports filtered by product leave Chat and Cowork unified usage out unless `products[]` includes `chat_cowork_unified`.

Some activity from users of Chat and Cowork unified, such as voice mode, can still be reported under chat or Cowork. A user’s activity can also be split between products on the day they start using Chat and Cowork unified. The same is true on the day it is turned off for them. How the activity splits is not guaranteed.

A user can appear in both the chat or Cowork counts and the Chat and Cowork unified counts. This can occur on a day when they use Chat and Cowork unified and some of their activity is still reported under chat or Cowork. Weekly and monthly counts can include them in both when the window has activity of both kinds, even on different days. For example, the window might cover days before and after they started using Chat and Cowork unified.

When you filter user activity by project, each day’s project activity is counted in one place only. If a user sent a chat message in Chat and Cowork unified that day, all their project activity is counted in `chat_cowork_unified_metrics.chat`. Otherwise, it is counted in `chat_metrics`.

**Per-product metric blocks.** Per-product metric objects (for example, Office Agent or Cowork metrics on a user-activity record) are always present on every record. Organizations without usage of that product see zero counts rather than a `null` object. The exception is Chat and Cowork unified: on deployments that do not offer it, its fields are left out of the response. Individual fields inside these objects can be `null`, which means the value is not available. For example, when you filter user activity by project, `distinct_skills_used_count` in `chat_metrics` is `null`. The [Claude Enterprise Analytics API reference](https://code.saschaberens.de/_h/platform.claude.com/docs/en/api/beta/organization/analytics) shows which fields can be `null`.

**Connector names.** Connector names are normalized across sources. For example, `Atlassian MCP server`, `mcp-atlassian`, and `atlassian_MCP` all appear as `atlassian` in the connector usage endpoint.

## Working with the API

**Pagination cursors are bound to the query that issued them.** On the cost and usage endpoints, do not change query parameters mid-sequence: if you change `products[]`, `group_by[]`, `order_by`, the date range, or any filter and pass an old cursor, the request returns a 400 error. To change parameters, restart from the first page without a cursor.

**List parameters use bracket notation.** Repeat the parameter for each value, for example `products[]=chat&products[]=claude_code`.

**Amount fields are decimal strings in cents.** Currency amounts are returned as decimal strings such as `"41280.000000"` (which represents $412.80 USD). To convert to dollars, parse as a decimal and divide by 100. Avoid binary floating-point parsing for values that might exceed several million dollars.

**Rate limits apply at the organization level**, not for each key, with a default of 60 requests per minute across all endpoints in this API. If that is not sufficient for your use case, contact your Anthropic account team to discuss adjusting the limit.

## Versioning

Send the `anthropic-version` header on every request; see [API versions](https://code.saschaberens.de/_h/platform.claude.com/docs/en/api/versioning) for the available versions.

## Known limitations

### Claude Code through Amazon Bedrock

If your organization uses Claude Code through Amazon Bedrock, the Claude Enterprise Analytics API does not return Claude Code activity for that usage.

### Claude Code and Cowork with customer-managed encryption keys

If your organization uses [customer-managed encryption keys](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/cmek), Anthropic leaves some details of Claude Code and Cowork use out of its usage analytics, to protect your data. As a result, do not use the following Claude Enterprise Analytics API numbers to measure how much your organization uses Claude Code or Cowork. They can be zero or lower than actual use:

* **Code changes:** In user activity, these fields in `claude_code_metrics.core_metrics` can be zero: `lines_of_code` (lines added and removed) and `commit_count`. The `pull_request_count` field can be lower than the real number of pull requests.
* **Skills started with a slash command:** If a user starts a skill in Claude Code or Cowork by typing a slash command, such as `/skill-name`, that use is not counted. This applies to skill usage, and to Cowork skill counts in user activity. Skills that Claude invokes without a slash command are still counted.

For other analytics changes with customer-managed encryption keys, see [What CMEK covers on Claude Enterprise](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/cmek-coverage-claude-enterprise#turned-off-or-changed).

## Next steps

<CardGroup cols={2}>
  <Card title="Claude Code Analytics API" href="https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/claude-code-analytics-api">
    Track Claude Code sessions, code changes, and tool usage with an Admin API key.
  </Card>

  <Card title="Usage and Cost Analytics API" href="https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/usage-cost-analytics-api">
    Track token usage and costs for your organization.
  </Card>

  <Card title="Claude Enterprise Analytics API reference" href="https://code.saschaberens.de/_h/platform.claude.com/docs/en/api/beta/organization/analytics">
    Endpoint reference for engagement, adoption, and cost data.
  </Card>

  <Card title="Set up the Compliance API" href="https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/compliance-api-access">
    Audit and compliance data uses its own key types.
  </Card>
</CardGroup>
