End User Costs API
Get end user cost summary
Returns cost summary for the specified end-user with comparison to the previous period. Call it with a GET request to /end-user-costs/{externalId}/summary, authenticated with a restricted API key and the "costs:read" scope.
GET https://api.bearlumen.com/v1/end-user-costs/{externalId}/summary
Returns cost summary for the specified end-user with comparison to the previous period. The previous period is automatically calculated as the same-length period immediately before the start_date. 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 |
|---|---|---|---|---|
externalId | path | string | Yes | End-user identifier you assigned when sending usage events (the user_id field on POST /usage-events). An end user exists only after at least one event referencing this identifier has been ingested; unknown identifiers return 404. |
start_date | query | string | Yes | Start of date range (ISO 8601, inclusive). |
end_date | query | string | Yes | End of date range (ISO 8601, exclusive). |
Response example
Success response (200):
{
"change_amount": "381.68",
"change_percent": 25,
"current_period_cost": "1908.4",
"end_user_external_id": "user_fixture_a",
"end_user_id": "eb77aa11-0001-7777-9a1b-2c3d4e5f6a01",
"end_user_name": "Aurora Systems",
"event_count": 6,
"period_end": "2026-06-01T00:00:00.000Z",
"period_start": "2026-05-15T00:00:00.000Z",
"previous_period_cost": "1526.72"
}
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 data. Check that required query parameters are present and that start_date and end_date are valid ISO 8601 dates. |
401 | Missing or invalid API key. Send your key as Authorization: Bearer YOUR_API_KEY. |
403 | API key lacks the costs:read scope. Create or update a key with the costs:read scope, then retry. |
404 | End user not found. The identifier must match the user_id value sent on at least one ingested usage event. |
429 | Rate limit exceeded. Retry after the time indicated by the Retry-After header (rate-limit state is also reported in the standard RateLimit-* headers, e.g. RateLimit-Reset). |
Rate limits and retries
Rate limit exceeded. Retry after the time indicated by the Retry-After header (rate-limit state is also reported in the standard RateLimit-* headers, e.g. RateLimit-Reset).