usage-cost-analytics-api changedmanage-claude/usage-cost-analytics-api
Nearest release: v2.1.318, published 4 hours 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+18added
Lines−12removed
From line
56
where the diff opens
First seen
29 Oct 2026
this site's first read of the page
Recorded edits3to this page, all time
The whole hunk
from line 56, old and new numbered
/
from line 56
5656 time_bucket_width=1d&\
5757 group_by[]=model&\
5858 limit=10" \
59 -H "anthropic-version: 2023-06-01" \
59 -H "anthropic-version: 2026-10-21" \
6060 -H "anthropic-beta: analytics-usage-cost-2026-08-24" \
6161 -H "x-api-key: $ANTHROPIC_API_KEY"
6262 ```
from line 278
278278
279279The `actor` dimension is who a request is attributed to: a user, a service account, a federated cloud identity (an AWS or Google Cloud principal, for organizations that access Claude through their cloud platform), or, when none of those is behind the request, the API key itself. When you group by `actor`, each row’s `actor` is an object whose `type` says which kind it is. Usage that can’t be attributed to any identity has `actor: null`.
280280
281[Personal keys and service account keys](https://platform.claude.com/docs/en/manage-claude/authentication#key-types) act as the user or service account they’re linked to, so their requests show that identity as the `actor` and the key in `api_key_id`. Legacy workspace keys aren’t linked to an identity, so the key appears as both the `actor` and the `api_key_id`. The exception is a key that Claude Code creates for a member at sign-in: it lives in the [Claude Code workspace](https://platform.claude.com/docs/en/manage-claude/workspaces#claude-code-workspace), and its usage is attributed to that member. Requests made without an API key, such as from the Claude Console, from Claude Code after a [sign-in without an API key](https://code.claude.com/docs/en/authentication#sign-in-without-an-api-key), or with a [Workload Identity Federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation) token, have `api_key_id: null`. After a sign-in without an API key, the `actor` is the member who signed in; a federated workload’s `actor` is its service account. To include usage with no API key in an `api_key_ids[]` filter, add an empty entry: `api_key_ids[]=`.
281[Personal keys and service account keys](https://platform.claude.com/docs/en/manage-claude/authentication#key-types) act as the user or service account they’re linked to, so their requests show that identity as the `actor` and the key in `api_key_id`. Legacy workspace keys aren’t linked to an identity, so the key appears as both the `actor` and the `api_key_id`.
282282
283The `api_key_ids[]` and `actor_ids[]` filters answer different questions. `api_key_ids[]=apikey_...` matches every request the key authenticated, whoever it is attributed to. `actor_ids[]=apikey_...` matches only requests attributed to the key itself.
283Requests made without an API key, such as from the Claude Console or with a [Workload Identity Federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation) token, have `api_key_id: null`. With a Workload Identity Federation token, the `actor` is the service account the token acts as.
284284
285Whichever way a member signs in to Claude Code with their Claude Console account, the `actor` is that member. If Claude Code creates an API key at sign-in, `api_key_id` is that key, which lives in the [Claude Code workspace](https://platform.claude.com/docs/en/manage-claude/workspaces#claude-code-workspace). After a [sign-in without an API key](https://code.claude.com/docs/en/authentication#sign-in-without-an-api-key), `api_key_id` is `null`.
286
287Token usage from some [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) sessions is attributed to an Anthropic-managed service account (`svac_...`). For this usage, `api_key_id` is `null`. The account isn’t listed with the service accounts that you create. See [Find session usage across your organization](https://platform.claude.com/docs/en/managed-agents/session-observability#find-session-usage-across-your-organization).
288
289The `api_key_ids[]` and `actor_ids[]` filters answer different questions. `api_key_ids[]=apikey_...` matches every request the key authenticated, whoever it is attributed to. `actor_ids[]=apikey_...` matches only requests attributed to the key itself. To include usage with no API key in an `api_key_ids[]` filter, add an empty entry: `api_key_ids[]=`.
290
285291## Usage endpoint
286292
287293`GET /v1/organizations/analytics/usage` returns token counts by type. `order_by` accepts `total_tokens` (the default), `output_tokens`, `uncached_input_tokens`, `requests`, or `time`.
from line 302
296302 workspace_ids[]=wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ&\
297303 api_key_ids[]=apikey_01Rj2N8SVvo6BePZj99NhmiT&\
298304 group_by[]=service_tier" \
299 -H "anthropic-version: 2023-06-01" \
305 -H "anthropic-version: 2026-10-21" \
300306 -H "anthropic-beta: analytics-usage-cost-2026-08-24" \
301307 -H "x-api-key: $ANTHROPIC_API_KEY"
302308 ```
from line 457
451457 group_by[]=actor&\
452458 order_by=requests&\
453459 limit=25" \
454 -H "anthropic-version: 2023-06-01" \
460 -H "anthropic-version: 2026-10-21" \
455461 -H "anthropic-beta: analytics-usage-cost-2026-08-24" \
456462 -H "x-api-key: $ANTHROPIC_API_KEY"
457463 ```
from line 616
610616 group_by[]=model&\
611617 group_by[]=cost_type&\
612618 group_by[]=token_type" \
613 -H "anthropic-version: 2023-06-01" \
619 -H "anthropic-version: 2026-10-21" \
614620 -H "anthropic-beta: analytics-usage-cost-2026-08-24" \
615621 -H "x-api-key: $ANTHROPIC_API_KEY"
616622 ```
from line 826
820826ending_at=2026-09-08T00:00:00Z&\
821827group_by[]=model&\
822828bucket_width=1d" \
823 -H "anthropic-version: 2023-06-01" \
829 -H "anthropic-version: 2026-10-21" \
824830 -H "x-api-key: $ANTHROPIC_API_KEY"
825831```
826832
from line 840
834840 group_by[]=model&\
835841 time_bucket_width=1d&\
836842 limit=1000" \
837 -H "anthropic-version: 2023-06-01" \
843 -H "anthropic-version: 2026-10-21" \
838844 -H "anthropic-beta: analytics-usage-cost-2026-08-24" \
839845 -H "x-api-key: $ANTHROPIC_API_KEY"
840846 ```
from line 1002
9961002 group_by[]=cost_type&\
9971003 group_by[]=token_type&\
9981004 limit=1000" \
999 -H "anthropic-version: 2023-06-01" \
1005 -H "anthropic-version: 2026-10-21" \
10001006 -H "anthropic-beta: analytics-usage-cost-2026-08-24" \
10011007 -H "x-api-key: $ANTHROPIC_API_KEY"
10021008 ```
from line 1269
12631269 starting_at=2026-09-01T00:00:00Z&\
12641270 ending_at=2026-10-01T00:00:00Z&\
12651271 limit=100" \
1266 -H "anthropic-version: 2023-06-01" \
1272 -H "anthropic-version: 2026-10-21" \
12671273 -H "x-api-key: $ANTHROPIC_API_KEY"
12681274 ```
12691275
from line 1403
13971403 group_by[]=product&\
13981404 actor_types[]=user_actor&\
13991405 limit=100" \
1400 -H "anthropic-version: 2023-06-01" \
1406 -H "anthropic-version: 2026-10-21" \
14011407 -H "anthropic-beta: analytics-usage-cost-2026-08-24" \
14021408 -H "x-api-key: $ANTHROPIC_API_KEY"
14031409 ```
No line in this hunk matches that.