Follow Discord
Sweep 27 Oct 2026 · 19:04Z Build v2.1.312 531 read Stable v2.1.308 Latest v2.1.312 Next v2.1.312 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

First request changedmanage-claude/claude-code-analytics-api

Nearest release: v2.1.312, published under an hour before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+12added
Lines−12removed
From line 19 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits12to this page, all time

### What’s the data retention period? ### What's the data retention period?

The whole hunk

from line 19, old and new numbered
/
lines
from line 19
1919* **Usage justification:** Provide metrics to justify and expand Claude Code adoption internally
2020 
2121<Check>
22 **Admin API credentials required.** These endpoints are part of the Admin API. You can access them using an [Admin API key](https://platform.claude.com/docs/en/manage-claude/admin-api-keys), an OAuth token with the `org:admin` scope, or a personal or service account key that isn't scoped to a workspace; workspace API keys don't work. See [Authentication](https://platform.claude.com/docs/en/manage-claude/admin-api#authentication) for details.
22 **Admin API credentials required.** These endpoints are part of the Admin API. You can access them using an [Admin API key](https://platform.claude.com/docs/en/manage-claude/admin-api-keys), an OAuth token with the `org:admin` scope, or a personal or service account key that isn’t scoped to a workspace; workspace API keys don’t work. See [Authentication](https://platform.claude.com/docs/en/manage-claude/admin-api#authentication) for details.
2323</Check>
2424 
2525<Note>
from line 32
3232 
3333## Quick start
3434 
35Get your organization's Claude Code analytics for a specific day:
35Get your organization’s Claude Code analytics for a specific day:
3636 
3737```bash cURL
3838curl "https://api.anthropic.com/v1/organizations/usage_report/claude_code?\
from line 45
4545<Tip>
4646 **Set a User-Agent header for integrations**
4747 
48 If you're building an integration, set your User-Agent header to help Anthropic understand usage patterns:
48 If you’re building an integration, set your User-Agent header to help Anthropic understand usage patterns:
4949 
5050 ```text wrap
5151 User-Agent: YourApp/1.0.0 (https://yourapp.com)
from line 59
5959### Key concepts
6060 
6161* **Daily aggregation:** Returns metrics for a single day specified by the `starting_at` parameter
62* **User-level data:** Each record represents one user's activity for the specified day
62* **User-level data:** Each record represents one user’s activity for the specified day
6363* **Productivity metrics:** Track sessions, lines of code, commits, pull requests, and tool usage
6464* **Token and cost data:** Monitor usage and estimated costs broken down by Claude model
6565* **Cursor-based pagination:** Handle large datasets with stable pagination using opaque cursors
from line 102
102102| ------------- | ------- | -------- | ----------------------------------------------------------------------- |
103103| `starting_at` | string | Yes | UTC date in YYYY-MM-DD format; returns metrics for this single day only |
104104| `limit` | integer | No | Number of records per page (default: 20, max: 1000) |
105| `page` | string | No | Opaque cursor token from previous response's `next_page` field |
105| `page` | string | No | Opaque cursor token from previous response’s `next_page` field |
106106 
107107### Available metrics
108108 
from line 121
121121* **num\_sessions:** Number of distinct Claude Code sessions initiated by this actor
122122* **lines\_of\_code.added:** Total number of lines of code added across all files by Claude Code
123123* **lines\_of\_code.removed:** Total number of lines of code removed across all files by Claude Code
124* **commits\_by\_claude\_code:** Number of git commits created through Claude Code's commit functionality
125* **pull\_requests\_by\_claude\_code:** Number of pull requests created through Claude Code's PR functionality
124* **commits\_by\_claude\_code:** Number of git commits created through Claude Code’s commit functionality
125* **pull\_requests\_by\_claude\_code:** Number of pull requests created through Claude Code’s PR functionality
126126 
127127#### Tool action metrics
128128 
from line 216
2162162. If `has_more` is `true` in the response, use the `next_page` value in your next request.
2172173. Continue until `has_more` is `false`.
218218 
219The cursor encodes the position of the last record and ensures stable pagination even as new data arrives. Each pagination session maintains a consistent data boundary to ensure you don't miss or duplicate records.
219The cursor encodes the position of the last record and ensures stable pagination even as new data arrives. Each pagination session maintains a consistent data boundary to ensure you don’t miss or duplicate records.
220220 
221221## Common use cases
222222 
from line 248
248248 
249249### Does this API include usage from Claude subscription plans?
250250 
251No. When someone signs in to Claude Code with a Claude subscription plan, such as Pro, Max, Team, or Enterprise, their usage is attributed to their claude.ai organization, and this API doesn't return it.
251No. When someone signs in to Claude Code with a Claude subscription plan, such as Pro, Max, Team, or Enterprise, their usage is attributed to their claude.ai organization, and this API doesn’t return it.
252252 
253253To track that usage, use one of these options:
254254 
255* **Claude Enterprise Analytics API:** Reports Claude Code activity for Claude Enterprise organizations and isn't available on other plans. See [Analytics APIs](https://platform.claude.com/docs/en/manage-claude/analytics-api).
255* **Claude Enterprise Analytics API:** Reports Claude Code activity for Claude Enterprise organizations and isn’t available on other plans. See [Analytics APIs](https://platform.claude.com/docs/en/manage-claude/analytics-api).
256256* **Analytics dashboard in claude.ai:** Available on Team and Enterprise plans. See [Track team usage with analytics](https://code.claude.com/docs/en/analytics).
257257* **OpenTelemetry export:** Works on any plan. See [Monitoring usage with OpenTelemetry](https://code.claude.com/docs/en/monitoring-usage).
258258 
259### What's the data retention period?
259### What’s the data retention period?
260260 
261261Historical Claude Code analytics data is retained and accessible through the API. There is no specified deletion period for this data.
262262 
from line 278
278278 
279279## See also
280280 
281The Claude Code Analytics API helps you understand and optimize your team's development workflow. Learn more about related features:
281The Claude Code Analytics API helps you understand and optimize your team’s development workflow. Learn more about related features:
282282 
283283* [Admin API](https://platform.claude.com/docs/en/manage-claude/admin-api)
284284* [Admin API reference](https://platform.claude.com/docs/en/api/beta/organization)
Feedback