Analytics API changedgovernment/org-admin/analytics-api
Nearest release: v2.1.322, published 20 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 10 Nov 2026 22:32 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 10 Nov 2026 22:37 UTC.
Upstream edited
Recorded here
Lines+14added
Lines−5removed
From line
27
where the diff opens
First seen
10 Nov 2026
this site's first read of the page
Recorded edits2to this page, all time
The whole hunk
from line 27, old and new numbered
/
from line 27
2727Send your admin API key in the `x-api-key` header. Every request also needs the `anthropic-beta` header while the API is in beta. This request returns token usage for each model:
2828
2929```http theme={null}
30GET https://<claude-for-government-host>/gateway-api/v1/organizations/analytics/usage?starting_at=<start-time>&ending_at=<end-time>&group_by[]=model
30GET https://<claude-for-government-host>/gateway-api/v1/organizations/analytics/usage?starting_at=2026-10-31T00:00:00Z&ending_at=2026-11-07T00:00:00Z&group_by[]=model
3131x-api-key: <your-admin-api-key>
3232anthropic-beta: analytics-usage-cost-2026-08-24
3333```
from line 61
6161
6262## Read the response
6363
64Each row in `data` covers one period and one combination of the fields you group by. A day, hour, member, product, or model with no usage has no row. Count a missing row as zero if its period ends at or before `data_refreshed_at`. This is a response to the [example request](#send-a-request-to-the-analytics-api) for one week, shortened to one row and three of the `group` fields:
64Each row in `data` covers one period and one combination of the fields you group by. A day, hour, member, product, or model with no usage has no row. Count a missing row as zero if its period ends at or before `data_refreshed_at`. This is a response to the [example request](#send-a-request-to-the-analytics-api), shortened to one row and three of the `group` fields:
6565
6666```json theme={null}
6767{
from line 132
132132| `group` | What the row is split by. A field is `null` if you don't group by it, or if the usage has no value for it. The fields in `group` that the examples leave out are `null`. |
133133| `group.actor` | The member. `deleted` is `true` once a member is deactivated or moved to another organization. After a move, `name` and `email_address` are `null`, and `user_id` stays. |
134134| `uncached_input_tokens` | Input tokens neither read from nor written to the prompt cache. |
135| `cache_creation` | Input tokens written to the prompt cache, split by how long the cache keeps them (5 minutes or 1 hour). |
135| `cache_creation` | Input tokens written to the prompt cache, split into 5-minute and 1-hour cache writes. |
136136| `cache_read_input_tokens` | Input tokens read from the prompt cache. |
137137| `output_tokens` | Tokens that Claude generated. |
138138| `total_tokens` | Input and output tokens together, including input written to or read from the prompt cache. |
from line 139
139139| `server_tool_use` | `web_search_requests` is `0`. |
140140| `requests` | Requests that reached Claude, including ones that were canceled or that ended in an error. |
141141| `amount`, `list_amount` | Estimated cost in US cents, as a string. `list_amount` equals `amount`. |
142| `has_more`, `next_page` | Whether more rows remain, and the value of `page` that reads them. See [Read every page of results](#read-every-page-of-results). |
142143| `data_refreshed_at` | The time the figures run up to, as described under [How current the figures are](#how-current-the-figures-are). |
143144
144145### What the estimated cost covers
from line 166
165166
166167### Read every page of results
167168
168While `has_more` is `true`, send the same request again with `page` set to the value of `next_page`. Send the other parameters as they were. You can change `limit`. To read many rows, set `limit` to `1000`.
169While `has_more` is `true`, send the same request again with `page` set to the value of `next_page`. Without `page`, you get the first page again. Send the other parameters as they were. You can change `limit`.
169170
171For example, this query reads every member's usage for October, 1,000 members at a time:
172
173```text theme={null}
174?group_by[]=actor&limit=1000&starting_at=2026-10-01T00:00:00Z&ending_at=2026-11-01T00:00:00Z
175```
176
177For the next 1,000, add `&page=` and the value of `next_page`.
178
170179## Rate limits
171180
172181An organization can send about 60 requests per minute, across all its keys, and four at the same time. A request over either limit returns a 429 error.
from line 195
186195| 401 | `invalid or revoked admin API key` | Check the key, or [create a new one](https://claude.com/docs/government/org-admin/admin-api-keys.md#create-a-key). |
187196| 403 | `missing_scope` | Use a key from the organization's **Admin API keys** page that was created with **Usage and cost reports**. |
188197| 403 | `tenant_restriction_violation` | See [Tenant restrictions](https://claude.com/docs/government/tenant-admin/tenant-restrictions.md). |
189| 404 | `no such Analytics API endpoint` | Check the path. |
198| 404 | `no such Analytics API endpoint` | Use a path that ends in `/usage` or `/cost`. |
190199| 414 | `Request URL is over 8 KiB or has more than 256 query parameters` | Send fewer values, in several requests. |
191200| 429 or 503 | `rate_limited`, `too_many_in_flight`, or `reports_unavailable` | Wait the number of seconds in the `Retry-After` header and try again. |
192201| 504 | `query_timeout` | Use a shorter range, or group by fewer fields. |
No line in this hunk matches that.