ReferenceREST API

Usage

Overview

Usage endpoints aggregate metered Agent activity into bounded UTC ranges. Use them to monitor Tenant totals or narrow reporting to an Agent, Session, or attribution value.

Endpoints

GET /v1/usage

Reads the daily usage rollups. The default range is the last 30 days ending today in UTC; custom ranges may span at most 31 days.

Request

Requires bearer authentication. The credential selects the Tenant ownership boundary; reads and mutations are restricted to resources owned by that Tenant.

LocationFieldRequiredDescription
HeaderAuthorizationyesTenant API key or dashboard Supabase JWT.
Query parameterTypeDefaultDescription
from, toYYYY-MM-DDlast 30 daysSupply both or neither
agentIdstringAgent filter
sessionIdstringSession filter; "" means stateless turns
userIdstringAttribution filter; "" means tenant-level
groupBystringdayday, agent, model, session, or user
limitinteger501–200; top-N only for groupBy=session

Response

Returns 200 OK with usage buckets and totals.

Response schema: usageResponseSchema.

{
  "buckets": [
    {
      "day": "2026-07-10",
      "agentId": null,
      "sessionId": null,
      "userId": null,
      "provider": null,
      "model": null,
      "inputTokens": 120,
      "outputTokens": 80,
      "requestCount": 2,
      "durationMs": 1400
    }
  ],
  "totals": {
    "inputTokens": 120,
    "outputTokens": 80,
    "requestCount": 2,
    "durationMs": 1400
  }
}

Errors

400 invalid_request for a partial/reversed/oversized range, invalid filter, group, or limit. See REST errors.

cURL

curl --get "$BLAZING_AGENTS_BASE_URL/v1/usage" \
  --header "Authorization: Bearer $BLAZING_AGENTS_API_KEY" \
  --data-urlencode "from=2026-07-01" \
  --data-urlencode "to=2026-07-10" \
  --data-urlencode "groupBy=day"

SDK: get. See Usage and quotas and Monitor usage and quotas.

GET /v1/agents/:agentId/usage

Returns the same aggregation as tenant usage, scoped to the Agent path parameter. A query-string agentId is ignored because the path wins.

Request

Requires bearer authentication and an ag_… agentId path parameter. It accepts from, to, sessionId, userId, groupBy, and limit exactly as Get tenant usage. The credential selects the Tenant ownership boundary; reads and mutations are restricted to resources owned by that Tenant.

LocationFieldRequiredDescription
HeaderAuthorizationyesTenant API key or dashboard Supabase JWT.
PathagentIdyesAgent ID (ag_…).

Response

Returns 200 OK with { buckets, totals }; see Usage response.

Response schema: usageResponseSchema.

Errors

400 invalid_request for a malformed Agent ID or invalid usage query. This aggregation does not require an Agent existence read; a scope with no rows returns zero totals and empty buckets. See REST errors.

cURL

curl --get \
  "$BLAZING_AGENTS_BASE_URL/v1/agents/ag_1234567890ABCDEF/usage" \
  --header "Authorization: Bearer $BLAZING_AGENTS_API_KEY" \
  --data-urlencode "groupBy=model"

SDK: get-for-agent. See Usage and quotas and Monitor usage and quotas.

On this page