Cost Data API

Get cost summary

Returns the organization-wide total cost for the selected time window along with a comparison to the previous period, showing change amount and percentage to track cost trends. Call it with a GET request to /cost-data/summary, authenticated with a restricted API key and the "costs:read" scope.

Returns the organization-wide total cost for the selected time window along with a comparison to the previous period, showing change amount and percentage to track cost trends. For a single end user's summary, use GET /end-user-costs/{externalId}/summary instead. Requests count toward your per-API-key rate limit; sustained overruns return 429 with the standard error envelope.

Authentication and scopes

Authenticate with a restricted API key in the Authorization: Bearer <key> header. This endpoint requires the costs:read scope.

Parameters

NameInTypeRequiredDescription
time_windowquerycurrent-period | last-period | last-7-days | last-30-days | last-90-days | ytd | last-yearNoTime window preset (default 'current-period' = the current calendar month to date; 'last-period' = the previous calendar month).

Response fields

Fields returned in the 200 response body. Nested objects are listed under their parent. A field marked optional may be absent from the body; one marked nullable is always present but its value may be null.

FieldTypeDescription
current_period_coststringCurrent period total cost (USD, decimal string).
previous_period_coststringPrevious period total cost (USD, decimal string).
change_amountstringChange amount (current - previous, USD, decimal string).
change_percentnumber (double) nullableChange percentage (null if previous is zero).
period_startstringPeriod start date (ISO 8601).
period_endstringPeriod end date (ISO 8601).
event_countnumber (double) optionalNumber of events that contributed to current_period_cost (completed events in the window). Optional for backwards compatibility.
status_countsobject optionalOrg-wide event status breakdown for empty-state and pipeline-lag diagnosis. Optional for backwards compatibility.
completednumber (double)Events with completed cost calculation (contributing to current/previous period totals).
pendingnumber (double)Events still being processed by the cost-calculation worker.
pending_rate_cardnumber (double)Events accepted but waiting for a rate card to be configured for the model.
failednumber (double)Events that failed cost calculation.

Error codes

Errors return the standard error envelope with a code, message, and a correlationId you can quote to support.

StatusWhen it happens
400Invalid time_window. Use one of: current-period, last-period, last-7-days, last-30-days, last-90-days, ytd, last-year.
401Missing or invalid API key. Send your key as Authorization: Bearer YOUR_API_KEY.
403API key lacks the costs:read scope. Create or update a key with the costs:read scope, then retry.
429Rate limit exceeded. The general API tier allows 100 requests per 15 minutes; wait for the window to reset before retrying.

Rate limits and retries

Rate limit exceeded. The general API tier allows 100 requests per 15 minutes; wait for the window to reset before retrying.