Get Claude Code Usage Report
api/admin/usage_report/retrieve_claude_code
Nearest release: v2.1.245, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
api/admin/usage_report/retrieve_claude_code Changed · +28 / -31 lines
# Get Claude Code Usage Report ## Query parameters ## Returns ## Example ### Response (200) ## Get Claude Code Usage Report ### Query Parameters ### Returns ### Example #### Response
---- -title: Get Claude Code Usage Report -url: https://platform.claude.com/docs/en/api/admin/usage_report/retrieve_claude_code ---- +# Get Claude Code Usage Report -## Get Claude Code Usage Report +**GET** `/v1/organizations/usage_report/claude_code` -**get** `/v1/organizations/usage_report/claude_code` - Retrieve daily aggregated usage metrics for Claude Code users. Enables organizations to analyze developer productivity and build custom dashboards. -### Query Parameters +## Query parameters - `starting_at: string` UTC date in YYYY-MM-DD format. Returns metrics for this single day only. + pattern: ^\d{4}-\d{2}-\d{2}$ + - `limit: optional number` Number of records per page (default: 20, max: 1000). + default: 20, maximum: 1000, minimum: 1 + - `page: optional string` Opaque cursor token from previous response's `next_page` field. -### Returns +## Returns -- `ClaudeCodeUsageReport object { data, has_more, next_page }` +- `ClaudeCodeUsageReport object` - - `data: array of object { actor, core_metrics, customer_type, 7 more }` + - `data: array of object` List of Claude Code usage records for the requested date. - - `actor: object { email_address, type } or object { api_key_name, type }` + - `actor: object or object` The user or API key that performed the Claude Code actions. - - `UserActor object { email_address, type }` + - `UserActor object` - `email_address: string`
Actor type. Always `"user_actor"` for a user. - - `"user_actor"` + - `APIActor object` - - `APIActor object { api_key_name, type }` - - `api_key_name: string` Name of the API key used to perform Claude Code actions.
Actor type. Always `"api_actor"` for an API key. - - `"api_actor"` + - `core_metrics: object` - - `core_metrics: object { commits_by_claude_code, lines_of_code, num_sessions, pull_requests_by_claude_code }` - Core productivity metrics measuring Claude Code usage and impact. - `commits_by_claude_code: number`
Number of git commits created through Claude Code's commit functionality. - - `lines_of_code: object { added, removed }` + - `lines_of_code: object` Statistics on code changes made through Claude Code.
UTC day the usage metrics cover, as an RFC 3339 timestamp at midnight UTC (for example `2025-08-08T00:00:00Z`). + format: date-time + - `is_remote: boolean` Whether the usage came from remote Claude Code sessions, such as Claude Code on the web. Remote and local usage are reported as separate rows. - - `model_breakdown: array of object { estimated_cost, model, tokens }` + - `model_breakdown: array of object` Token usage and cost breakdown by AI model used. - - `estimated_cost: object { amount, currency }` + - `estimated_cost: object` Estimated cost for using this model
Name of the AI model used for Claude Code interactions. - - `tokens: object { cache_creation, cache_read, input, output }` + - `tokens: object` Token usage breakdown for this model
Type of terminal or environment where Claude Code was used. - - `tool_actions: map[object { accepted, rejected } ]` + - `tool_actions: map[object]` Breakdown of tool action acceptance and rejection rates by tool type.
Opaque cursor token for fetching the next page of results, or null if no more pages are available. -### Example +## Example -```http +```bash curl https://api.anthropic.com/v1/organizations/usage_report/claude_code \ -H 'anthropic-version: 2023-06-01' \ -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN" ``` -#### Response +### Response (200) ```json {