Analytics API

Pre-aggregated summaries of every query that flowed through the Gateway, served by the Airbrx API at api.airbrx.ai. Use these endpoints to build custom dashboards, monitor cache effectiveness, or track per-user query patterns.

Authentication

All requests require a Personal Access Token in the Authorization header. The token must include the relevant analytics scope; see the API reference for the full scope list.

curl -H "Authorization: Bearer YOUR_PAT" \
  https://api.airbrx.ai/tenants/your-slug/summaries/2026

Endpoints

Method Path Returns
GET /tenants/{tenant}/summaries/{year} Yearly summary with daily activity timeline
GET /tenants/{tenant}/summaries/{year}/{month}/{day} Daily summary with per-query details
GET /tenants/{tenant}/users/summary.json All users summary for the tenant
GET /tenants/{tenant}/users/{userId}/{year} User yearly summary
GET /tenants/{tenant}/users/{userId}/{year}/{month}/{day} User daily summary (same shape as daily summary, scoped to one user)

Yearly summary

GET /tenants/{tenant}/summaries/{year}

{
  "tenantSummaryReportID": "a1b2c3d4-...",
  "tenantId": "acme-corp",
  "reportyears": ["2026"],
  "totalUsers": 45,
  "totalQueries": 12847,
  "totalCacheHits": 9234,
  "totalHits": 52341,
  "cacheSize": 1073741824,
  "cacheElements": 12847,
  "last365daysQueryActivity": [
    {
      "date": "2026/01/15",
      "queries": 234,
      "users": 12,
      "cacheHits": 189,
      "totalHits": 1205,
      "dataTransfer": 52428800,
      "cacheSize": 2097152,
      "cacheElements": 234
    }
  ]
}

Top-level fields

FieldTypeDescription
tenantSummaryReportIDstringUnique report identifier.
tenantIdstringTenant identifier.
totalUsersintegerCumulative unique users for the year.
totalQueriesintegerUnique SQL statements cached.
totalCacheHitsintegerCache hits across all queries.
totalHitsintegerTotal query executions (hits + misses).
cacheSizeinteger (bytes)Total cached data size.
cacheElementsintegerNumber of cached query results.
last365daysQueryActivityarrayDaily activity timeline (see below).

Daily activity entry

FieldTypeDescription
datestringYYYY/MM/DD format.
queriesintegerUnique statements on this day.
usersintegerUnique users on this day.
cacheHitsintegerCache hits on this day.
totalHitsintegerTotal executions on this day.
dataTransferinteger (bytes)Bytes served from cache.
cacheSizeinteger (bytes)New cache data added.
cacheElementsintegerNew cache entries added.

Daily summary

GET /tenants/{tenant}/summaries/{year}/{month}/{day}

{
  "queries": [
    {
      "queryHash": "a1b2c3d4...",
      "statement": "SELECT * FROM customers WHERE region = ?",
      "cacheKey": "abc123...",
      "cacheHits": 47,
      "responseCode": 200,
      "averageResponseTime": 234,
      "minResponseTime": 45,
      "maxResponseTime": 1250,
      "responseSize": 15360,
      "count": 52,
      "users": 8,
      "firstRequestTime": "2026-01-15T08:23:45Z",
      "lastRequestTime": "2026-01-15T17:45:12Z"
    }
  ],
  "uniqueUsers": 23,
  "cacheHits": 892,
  "totalHits": 1205,
  "averageResponseTime": 187,
  "minResponseTime": 12,
  "maxResponseTime": 3450
}

Query record fields

FieldTypeDescription
queryHashstringSHA-256 of the standardized SQL.
statementstringThe standardized SQL.
cacheKeystringCache storage key.
cacheHitsintegerTimes served from cache.
responseCodeintegerHTTP status (200, 404, 500, …).
averageResponseTimeinteger (ms)Mean response time.
minResponseTimeinteger (ms)Fastest response.
maxResponseTimeinteger (ms)Slowest response.
responseSizeinteger (bytes)Average response size.
countintegerTotal execution count.
usersintegerUnique users who ran this query.
firstRequestTimeISO 8601First execution.
lastRequestTimeISO 8601Most recent execution.

All users summary

GET /tenants/{tenant}/users/summary.json

{
  "tenantId": "acme-corp",
  "generatedAt": "2026-01-15T18:30:00Z",
  "totalUsers": 45,
  "users": [
    {
      "userId": "alice@acme.com",
      "uniqueQueries": 234,
      "cacheHits": 189,
      "totalHits": 567,
      "averageResponseTime": 145,
      "minResponseTime": 12,
      "maxResponseTime": 2340
    }
  ]
}

User yearly summary

GET /tenants/{tenant}/users/{userId}/{year}

Returns the same shape as the tenant yearly summary, scoped to a single user. The corresponding daily endpoint (/tenants/{tenant}/users/{userId}/{year}/{month}/{day}) returns the same shape as the daily summary, also scoped to that user.

See also