Dimension Data API

Get cost breakdown by dimension

Returns cost aggregated by a specific custom dimension (e.g., "team", "region"). Call it with a GET request to /dimension-data/cost-breakdown, authenticated with a restricted API key and the "costs:read" scope.

GET https://api.bearlumen.com/v1/dimension-data/cost-breakdown

Returns cost aggregated by a specific custom dimension (e.g., "team", "region"). Groups costs by the dimension values (e.g., "team-ml", "team-api"). Events that do not carry the dimension key in their metadata are grouped under the reserved dimensionValue "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

NameInTypeRequiredDescription
dimension_keyquerystringYesDimension key exactly as returned by GET /dimension-data/definitions (snake_case, case-sensitive).
start_datequerystringYesStart of date range (ISO 8601, inclusive).
end_datequerystringYesEnd of date range (ISO 8601, exclusive).

Response example

Success response (200):

JSON
{
  "items": [
    {
      "dimension_value": "production",
      "event_count": 4,
      "input_tokens": 1712800,
      "output_tokens": 428100,
      "percent_of_total": 80.71462278198004,
      "total_cost": "1761.75"
    },
    {
      "dimension_value": "staging",
      "event_count": 2,
      "input_tokens": 457300,
      "output_tokens": 114300,
      "percent_of_total": 12.35677077367835,
      "total_cost": "269.71"
    },
    {
      "dimension_value": "Unassigned",
      "event_count": 9,
      "input_tokens": 25880200,
      "output_tokens": 5415300,
      "percent_of_total": 4.995670480004032,
      "total_cost": "109.04"
    },
    {
      "dimension_value": "development",
      "event_count": 1,
      "input_tokens": 132700,
      "output_tokens": 33200,
      "percent_of_total": 1.9329359643375834,
      "total_cost": "42.19"
    }
  ],
  "total_cost": "2182.69"
}

Error codes

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

StatusWhen it happens
400Invalid request. Check that start_date and end_date are valid ISO 8601 dates.
401Authentication required. Provide a valid API key in the Authorization header.
403Insufficient permissions. Use an API key with the costs:read scope.
404Dimension not found. Pass a dimension_key exactly as returned by GET /dimension-data/definitions (snake_case, case-sensitive).
429Rate 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.