usage-cost-analytics-api changedmanage-claude/usage-cost-analytics-api
Nearest release: v2.1.333, published 6 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+4added
Lines−4removed
From line
259
where the diff opens
First seen
29 Oct 2026
this site's first read of the page
Recorded edits9to this page, all time
The whole hunk
from line 259, old and new numbered
/
from line 259
259259
260260* **Every row has three parts:** `starting_at` and `ending_at` give the period the row covers, `group` holds every dimension, and `usage` (or `cost` on the cost endpoint) holds the metrics.
261261* **Dimensions are null unless grouped:** A dimension in `group` is `null` unless you list it in `group_by[]`. A grouped dimension is also `null` on rows that have no value for it, such as `model` on code execution usage. `group_by[]` takes up to five dimensions.
262* **One row for each combination:** Each row is one combination of the grouped dimensions, and every combination that has usage or cost appears exactly once across the pages of a query. With no `group_by[]` and no `time_bucket_width`, the response is a single row that totals the whole range.
262* **Rows are combinations:** Each row is one combination of the grouped dimensions. With no `group_by[]` and no `time_bucket_width`, the response is a single row that totals the whole range.
263263* **Time buckets are optional:** Set `time_bucket_width` to `1m`, `1h`, or `1d` to split each combination by UTC bucket; each row’s `starting_at` and `ending_at` are then its bucket’s bounds. Buckets with no usage or cost produce no rows.
264* **Ranked by default:** Rows are ordered by the `order_by` metric across the whole range, largest first by default (`order=asc` reverses it). To build a time series, set `time_bucket_width` and `order_by=time`. Rows then come back one time bucket after another, newest bucket first by default (`order=asc` puts the oldest first), with the largest rows first within each bucket. Fill empty buckets with zeros.
264* **Ranked by default:** The `order_by` metric ranks rows across the whole range, largest first by default. `order=asc` reverses the order. To build a time series, set `time_bucket_width` and `order_by=time`. Rows then come back one time bucket after another, newest bucket first by default. `order=asc` puts the oldest first. Within each bucket, the largest rows come first. A recent bucket might also have no rows because its data hasn’t arrived (see [Data freshness](https://platform.claude.com/docs/en/manage-claude/usage-cost-analytics-api#data-freshness)).
265265* **Filters work alongside grouping:** Most dimensions you can group by have a matching list filter in bracket notation, such as `models[]=claude-opus-5-5`. Repeat the parameter to pass several values, up to 100. Multiple values for the same filter are combined with OR, and different filters are combined with AND. Filters and `group_by[]` are independent; you can filter by any dimension with or without grouping by it, or the reverse.
266266
267267Dimensions such as `model` and `actor` apply to every organization. Some, such as `api_key_id`, apply only to Claude Console organizations, and others, such as `slack_channel_id`, apply only to Claude Enterprise organizations. A dimension that doesn’t apply to your organization is `null` on every row and its filter matches nothing; the exception is `rbac_group_id`, which returns an error instead when teams aren’t available to your organization. The [usage](https://platform.claude.com/docs/en/api/beta/organization/analytics/usage/list) and [cost](https://platform.claude.com/docs/en/api/beta/organization/analytics/cost/list) API reference lists every dimension, filter, and value.
from line 787
787787
788788## Data freshness
789789
790Every response includes a `data_refreshed_at` timestamp, and usage after that time is missing or partial. When no data is available yet for any part of the requested range, `data_refreshed_at` is `null` and `data` is empty. Data typically refreshes within 4 hours of the underlying usage and can 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 stable results across repeated calls, set `ending_at` at or before a `data_refreshed_at` you have already seen; for final totals, query only months that ended at least 7 days ago. Every page of a paginated query reads the same data snapshot, so `data_refreshed_at` is identical across pages.
790Every response includes a `data_refreshed_at` timestamp. Usage after that time is missing or partial, and earlier usage might be too. When no data is available for any part of the requested range, `data_refreshed_at` is `null` and `data` is empty. Data typically refreshes within 4 hours of the underlying usage and can take up to 24 hours. Values can change later, and there’s no fixed date after which a month’s values are final.
791791
792792## On a cloud platform
793793
from line 826
826826* **Workspaces and API keys:** The Usage and Cost Analytics API returns `null` for `workspace_id` and `api_key_id` (see [How results are shaped](https://platform.claude.com/docs/en/manage-claude/usage-cost-analytics-api#how-results-are-shaped)), so the table’s row on the default workspace doesn’t apply.
827827* **Usage totals:** `/v1/organizations/usage_report/messages` leaves out usage from some Claude products, such as Cowork, text chats in Claude, and Claude Code in the terminal. The Usage and Cost Analytics API counts that usage, so its totals can be higher.
828828
829To reproduce the legacy daily report, request `time_bucket_width=1d` with the same `group_by[]`, page through with `limit=1000`, then group rows by `starting_at` and fill missing days with zeros. Add `order_by=time&order=asc` to get the days in order. Daily usage by model for 1 week, before:
829To reproduce the legacy daily report, request `time_bucket_width=1d` with the same `group_by[]` and page through with `limit=1000`. Then, group rows by `starting_at` and fill in zeros for missing days, except recent days, whose data might not have arrived (see [Data freshness](https://platform.claude.com/docs/en/manage-claude/usage-cost-analytics-api#data-freshness)). Add `order_by=time&order=asc` to get the days in order. Compare 1 week of daily usage by model before:
830830
831831```bash cURL
832832curl --globoff "https://api.anthropic.com/v1/organizations/usage_report/messages?\
No line in this hunk matches that.