Command Palette

Search for a command to run...

Core API

Analytics

Daily usage for your tenant: active students, conversations, messages, tokens and estimated cost.

GET /analytics

Returns one row per day for your tenant, plus totals for the range. Figures cover conversations created through this API — nothing else is included.

Your tenant is taken from the API key. There is deliberately no tenant_id parameter: an endpoint that accepted one would be a typo away from showing you someone else's numbers.

  • Requires an API key with the analytics permission

  • from and to are calendar dates, YYYY-MM-DD; both optional

  • Defaults to the last 30 days

  • Maximum range is 366 days

  • Days with no activity are omitted rather than returned as zeroes

  • Figures are recomputed hourly; meta.last_refreshed_at tells you how current they are

Requestbash
curl -s 'https://ai.zabai.org/api/external/v1/analytics?from=2026-09-01&to=2026-09-30'   -H 'Authorization: Bearer $MATH_AI_API_KEY'
Responsejson
{
  "success": true,
  "request_id": "...",
  "data": {
    "from": "2026-09-01",
    "to": "2026-09-30",
    "days": [
      {
        "day": "2026-09-14",
        "active_students": 2,
        "chats_created": 2,
        "messages": 62,
        "total_tokens": 414886,
        "estimated_cost_usd": 0.070889
      }
    ],
    "totals": {
      "active_students": 4,
      "chats_created": 3,
      "messages": 92,
      "total_tokens": 600500,
      "estimated_cost_usd": 0.106767
    }
  },
  "meta": {
    "granularity": "day",
    "last_refreshed_at": "2026-10-20T05:07:11.482Z"
  }
}

What the numbers mean

  • active_students — distinct external_user_id values seen that day. In totals it is counted across the whole range, not summed from the days, so a student active on ten days counts once

  • chats_created — conversations started that day. A day can show messages with zero chats created, which simply means your users continued earlier conversations

  • messages — every turn, yours and the tutor's

  • estimated_cost_usd — our model cost for serving you, not a price. It is useful for spotting changes in usage; it is not an invoice

  • meta.last_refreshed_at — when we last recomputed these figures. Today's row can lag by up to an hour, so treat the current day as provisional

  • Days are UTC calendar days, not your local ones

Analytics | Math AI Docs