GET/organization/costs

List organization costs

Retrieves cost data for the organization over a specified time range. Set start_time and optionally use project, API key, line item, or grouping filters to narrow the results; use the returned cursor to fetch additional pages.

9 parameters
start_timeintegerrequired
Inclusive start of the cost query range, as a Unix timestamp in seconds.
end_timeintegeroptional
Exclusive end of the cost query range, as a Unix timestamp in seconds.
bucket_widthstringoptional
Width of each time bucket; `1d` is the only supported value. Defaults to `1d` when omitted.
Allowed:1dDefault:1d
project_idsarray<string>optional
Filter results to the specified project IDs.
api_key_idsarray<string>optional
Filter results to the specified API key IDs.
line_itemsarray<string>optional
Filter results to exact line item names; each value must match the complete `line_item` value.
group_byarray<string>optional
Fields to group costs by: `project_id`, `user_id`, `line_item`, `api_key_id`, or `api_source`. Unsupported combinations return a 400; when grouping by `api_source`, results distinguish `agents_api` from `unlabeled` activity.
limitintegeroptional
Maximum number of time buckets to return, from 1 to 180. Defaults to 7 when omitted.
Default:7
pagestringoptional
Pagination cursor from the previous response's `next_page` field; omit it to start from the first page.

4 status codes
200Returns a page of cost data containing time buckets and their results, along with `has_more` and `next_page` pagination fields.
objectstringrequired
Allowed:page
dataarray<object>required
has_morebooleanrequired
next_pagestringrequired
400Returned when query parameters are invalid or the requested operation cannot be performed, including unsupported grouping and filter combinations.
errorobjectrequired
403Returned when the caller does not have permission to view organization costs.
errorobjectrequired
Details about the permission error.
429Returned when the request exceeds a rate limit.
errorobjectrequired

Error handling

A 400 is returned when query parameters are invalid or the requested operation cannot be performed, including unsupported grouping and filter combinations. A 403 is returned when the authenticated user lacks permission to view organization costs. A 429 is returned when the request exceeds a rate limit. start_time is required, bucket_width must be 1d, and limit must be between 1 and 180.