Cost Report
api/admin/cost_report
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/cost_report Changed · +21 / -20 lines
### Query parameters ### Headers #### Response (200) ## Domain types ### Query Parameters ### Header Parameters #### Response ## Domain Types
---- -title: Cost Report -url: https://platform.claude.com/docs/en/api/admin/cost_report ---- - # Cost Report ## Get Cost Report -**get** `/v1/organizations/cost_report` +**GET** `/v1/organizations/cost_report` Get Cost Report -### Query Parameters +### Query parameters - `starting_at: string`
Time buckets that start on or after this RFC 3339 timestamp will be returned. Each time bucket will be snapped to the start of the minute/hour/day in UTC. + format: date-time + - `bucket_width: optional "1d"` Time granularity of the response data. - - `"1d"` + default: 1d - `ending_at: optional string` Time buckets that end before this RFC 3339 timestamp will be returned. + format: date-time + - `group_by: optional array of "description" or "workspace_id"` Group by any subset of the available options.
Maximum number of time buckets to return in the response. + default: 7, maximum: 31, minimum: 1 + - `page: optional string` Optionally set to the `next_page` token from the previous response. -### Header Parameters +### Headers - `"anthropic-beta": optional array of string`
### Returns -- `CostReport object { data, has_more, next_page }` +- `CostReport object` - - `data: array of object { ending_at, results, starting_at }` + - `data: array of object` List of time buckets for this page, oldest first: one per `bucket_width` interval, including intervals with no costs (their `results` list is empty). A page holds at most `limit` buckets.
End of the time bucket (exclusive) in RFC 3339 format. - - `results: array of object { amount, context_window, cost_type, 7 more }` + - `results: array of object` List of cost items for this time bucket. There may be multiple items if one or more `group_by[]` parameters are specified.
### Example -```http +```bash curl https://api.anthropic.com/v1/organizations/cost_report \ -H 'anthropic-version: 2023-06-01' \ -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN" ``` -#### Response +#### Response (200) ```json {
} ``` -## Domain Types +## Domain types ### Cost Report -- `CostReport object { data, has_more, next_page }` +- `CostReport object` - - `data: array of object { ending_at, results, starting_at }` + - `data: array of object` List of time buckets for this page, oldest first: one per `bucket_width` interval, including intervals with no costs (their `results` list is empty). A page holds at most `limit` buckets.
End of the time bucket (exclusive) in RFC 3339 format. - - `results: array of object { amount, context_window, cost_type, 7 more }` + - `results: array of object` List of cost items for this time bucket. There may be multiple items if one or more `group_by[]` parameters are specified.