Skip to main content
GET
/
api
/
consumption-events
/
summary
curl --location --request GET 'https://dashboard.laburen.com/api/consumption-events/summary?startDate=2025-01-01T00:00:00.000Z&endDate=2025-01-31T23:59:59.000Z&groupBy=agent' \
--header 'Authorization: Bearer <API_KEY>'
{
  "groupBy": "agent",
  "startDate": "2025-01-01T00:00:00.000Z",
  "endDate": "2025-01-31T23:59:59.000Z",
  "data": [
    {
      "groupKey": "clxxxxxxxxxxxxxxxxx",
      "agentName": "Support Bot",
      "totalCreditsCharged": 12.450000,
      "totalInputTokens": 284500,
      "totalOutputTokens": 95200,
      "eventCount": 1523
    },
    {
      "groupKey": "clxxxxxxxxxxxxxxxxx",
      "agentName": "Sales Assistant",
      "totalCreditsCharged": 8.230000,
      "totalInputTokens": 195000,
      "totalOutputTokens": 67800,
      "eventCount": 987
    }
  ]
}
Este endpoint requiere autenticacion. Inclui tu API key en el header Authorization: Bearer <API_KEY>. Ver Autenticacion para mas detalles.
Returns aggregated consumption metrics for the authenticated organization. Use this endpoint to:
  • Get total credits, tokens, and event counts grouped by agent, feature, provider, or model
  • Analyze consumption trends over time by grouping by day, week, or month
  • Filter aggregations by agent, feature, or provider

Query Parameters

Required

startDate
string (ISO 8601)
required
Start of the date range. Must be a valid ISO 8601 datetime string (e.g. 2025-01-01T00:00:00.000Z). Must be before endDate.
endDate
string (ISO 8601)
required
End of the date range. Must be a valid ISO 8601 datetime string.
groupBy
string
required
How to group the results. Valid values: agent, feature, provider, model, day, week, month.
  • Entity grouping (agent, feature, provider, model): groups by the corresponding field, sorted by total credits descending.
  • Temporal grouping (day, week, month): groups by time period using PostgreSQL date_trunc, sorted chronologically.

Optional

agentId
string
Filter events by a specific agent ID before aggregating.
feature
string
Filter events by feature name before aggregating.
provider
string
Filter events by AI provider before aggregating.

Response

groupBy
string
The grouping criterion used (mirrors the request parameter).
startDate
string (ISO 8601)
Start of the queried date range.
endDate
string (ISO 8601)
End of the queried date range.
data
array
Aggregated results per group.

Error Responses

Status CodeTypeDescription
400INVALID_REQUESTstartDate is after endDate, or invalid groupBy value
401UNAUTHORIZEDMissing or invalid authentication
curl --location --request GET 'https://dashboard.laburen.com/api/consumption-events/summary?startDate=2025-01-01T00:00:00.000Z&endDate=2025-01-31T23:59:59.000Z&groupBy=agent' \
--header 'Authorization: Bearer <API_KEY>'
{
  "groupBy": "agent",
  "startDate": "2025-01-01T00:00:00.000Z",
  "endDate": "2025-01-31T23:59:59.000Z",
  "data": [
    {
      "groupKey": "clxxxxxxxxxxxxxxxxx",
      "agentName": "Support Bot",
      "totalCreditsCharged": 12.450000,
      "totalInputTokens": 284500,
      "totalOutputTokens": 95200,
      "eventCount": 1523
    },
    {
      "groupKey": "clxxxxxxxxxxxxxxxxx",
      "agentName": "Sales Assistant",
      "totalCreditsCharged": 8.230000,
      "totalInputTokens": 195000,
      "totalOutputTokens": 67800,
      "eventCount": 987
    }
  ]
}