RAZIEL.docs
API Explorer

Analytics

Usage statistics and cost breakdown

Get usage analytics

Returns aggregated usage statistics for the last 30 days: totals, per-agent breakdown, daily session and cost charts, status breakdown, and top sessions by cost.

GET
/api/analytics
AuthorizationBearer <token>

Clerk session token. Automatically set as a cookie in the browser; pass as Authorization: Bearer for server-side calls.

In: header

Response Body

curl -X GET "https://app.raziel.fun/api/analytics"
{
  "totalSessions": 42,
  "totalCost": 3.14,
  "totalTokens": 1500000,
  "avgDurationMs": 240000,
  "byAgent": [
    {
      "agent": "claude-code",
      "count": 30,
      "cost": 2.5
    }
  ],
  "byDay": [
    {
      "date": "2025-01-01",
      "count": 5
    }
  ],
  "costByDay": [
    {
      "date": "2025-01-01",
      "cost": 0.42
    }
  ],
  "statusBreakdown": {
    "completed": 35,
    "errored": 2,
    "running": 3,
    "stopped": 2
  },
  "topByCost": []
}
{
  "error": "Unauthorized"
}