Dimension Data API
Get cost trend by dimension
Returns time-series cost data with adaptive granularity based on date range. Call it with a GET request to /dimension-data/cost-trend, authenticated with a restricted API key and the "costs:read" scope.
Returns time-series cost data with adaptive granularity based on date range. Can filter by specific dimension value or group by dimension. Adaptive granularity: date ranges of 30 days or less return daily buckets, 31-90 days return weekly, and longer ranges return monthly. Granularity cannot be overridden on this endpoint; only `/dimension-data/numeric-trend` accepts an `interval` parameter. The response `granularity` field reports which bucket size was used. **Modes:** - No dimension params: Returns single "Total" series (all costs) - `dimension_key` only: Returns top 5 dimension values as series + "Other" - `dimension_key` + `dimension_value`: Returns single series filtered by that value When grouping by `dimension_key`, events that do not carry the dimension key in their metadata are grouped under the reserved value "Unassigned". 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
start_date | query | string | Yes | Start of date range (ISO 8601, inclusive). |
end_date | query | string | Yes | End of date range (ISO 8601, exclusive). |
dimension_key | query | string | No | Optional dimension key to filter/group by, exactly as returned by GET /dimension-data/definitions (snake_case, case-sensitive). |
dimension_value | query | string | No | Optional specific dimension value to filter to. |
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.
| Field | Type | Description |
|---|---|---|
series | object[] | Time-series data as multiple series. |
key | string | Series key (dimension value or 'total'). |
label | string | Series label for display. |
data_points | object[] | Data points for this series. |
date | string | Period date (ISO 8601). |
cost | string | Total cost for this period (USD, decimal string). |
event_count | number (double) | Number of events. |
granularity | daily | weekly | monthly | Granularity of the data. |
Error codes
Errors return the standard error envelope with a code, message, and a correlationId you can quote to support.
| Status | When it happens |
|---|---|
400 | Invalid request. Check that start_date and end_date are valid ISO 8601 dates. |
401 | Authentication required. Provide a valid API key in the Authorization header. |
403 | Insufficient permissions. Use an API key with the costs:read scope. |
404 | Dimension not found. Pass a dimension_key exactly as returned by GET /dimension-data/definitions (snake_case, case-sensitive). |
429 | Rate limit or plan quota exceeded. Slow down and retry after the current window resets. |
Rate limits and retries
Rate limit or plan quota exceeded. Slow down and retry after the current window resets.