Attribution Data API
Get session cost breakdown
Returns per-session cost totals, ordered by total cost descending. Call it with a GET request to /attribution-data/sessions, authenticated with a restricted API key and the "costs:read" scope.
GET https://api.bearlumen.com/v1/attribution-data/sessions
Returns per-session cost totals, ordered by total cost descending. Include `session_id` on your usage events to group them into sessions; optionally include `session_type` (any string label, e.g., "support-agent", "batch-summarizer"). Events without `session_id` are excluded. Events without `session_type` appear here with `session_type` "unknown". The `summary` object reflects only the sessions returned in this response (after limit/offset), not the full date range. There is no range-wide total; page until fewer than `limit` sessions are returned. 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). If start_date is not before end_date the response is empty rather than an error. |
end_date | query | string | Yes | End of date range (ISO 8601, exclusive). |
session_type | query | string | No | Exact-match filter on the session_type value (e.g., "support-agent"). |
limit | query | number (double) | No | Maximum sessions to return, ordered by total cost descending (default 100). |
offset | query | number (double) | No | Number of sessions to skip for pagination (default 0). |
Response example
Success response (200):
{
"sessions": [
{
"event_count": 4,
"session_id": "sess_mQ4vX8kN",
"session_type": "multiplayer",
"total_cost": "10.4"
},
{
"event_count": 3,
"session_id": "sess_tR7pW2jD",
"session_type": "multiplayer",
"total_cost": "6.6"
}
],
"summary": {
"avg_cost_per_session": "8.5",
"total_sessions": 2
}
}
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 start_date and end_date are valid ISO 8601 dates and fix the field named in error.message. |
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 an API key with the costs:read scope, then retry. |
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.