Metering API
Usage metering API to retrieve aggregate and per-API-key usage, budgets, and billing stats for the current period in Scalix Cloud.
REST API endpoints for Metering. 5 operations.
Get usage summary (PLATFORM OPERATORS ONLY)
GET /api/v1/usageCross-tenant aggregate usage for platform operators — customer keys get 403 "platform-operator privilege required" (the old description promised callers their own summary; audit 2026-10-21). Caller-facing usage lives at GET /v1/usage/keys, GET /v1/user/budget, GET /v1/user/stats, and GET /api/v1/usage/{tenant_id} (own tenant).
Auth: Bearer API key
Responses
| Status | Description |
|---|---|
200 | Usage summary (operator key only) |
401 | Missing or invalid API key |
403 | Caller is not a platform operator |
500 | Internal error |
operationId: getUsageSummary
List the org's API keys with their IAM-tracked metadata
GET /v1/usage/keysXW-63: this is METADATA-ONLY — it returns each of the organization's API keys with the authoritative metadata IAM holds (id, name, non-secret prefix, last_used_at). Per-key request counts are NOT tracked: metering is keyed by org/project (see docs/IDENTITY.md), not by individual key, so there is no honest per-key total to return. The previous OpenAPI summary claimed "per-API-key request counts for the current month" while the body carried no counts — the description is corrected to match what is actually served. Response fields are unchanged (published surface). Org/project usage totals live at /v1/usage/{id}. Requires the metering:read scope.
Auth: Bearer API key
Responses
| Status | Description |
|---|---|
200 | The organization's API keys with IAM-tracked metadata (id, name, prefix, last_used_at). Per-key request counts are NOT tracked — metering is keyed by org/project; see /v1/usage/{id} for usage totals. |
401 | Missing or invalid API key |
403 | Token lacks the metering:read scope |
500 | Internal error |
operationId: getKeysUsage
Get one API key's IAM-tracked metadata
GET /v1/usage/keys/{key_id}XW-63: metadata-only, like the list endpoint — per-key request counts are not tracked (metering is keyed by org/project). Requires the metering:read scope; the key must belong to the caller's org.
Auth: Bearer API key
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
key_id | path | string | Yes | API key id (UUID) |
Responses
| Status | Description |
|---|---|
200 | IAM-tracked metadata for one API key (id, name, prefix, last_used_at). No per-key request counts — metering is keyed by org/project. |
401 | Missing or invalid API key |
403 | Token lacks the metering:read scope |
404 | Key not found in this organization |
500 | Internal error |
501 | Billing not configured |
operationId: getKeyUsage
Get the caller's budget
GET /v1/user/budgetReturns current usage (AI tokens, storage, compute hours), the plan's allowances, and the remaining headroom for each.
Auth: Bearer API key
Responses
| Status | Description |
|---|---|
200 | Usage, plan limits, and remaining allowance |
401 | Missing or invalid credentials |
500 | Database error |
operationId: getUserBudget
Get the caller's usage stats
GET /v1/user/statsReturns a per-service usage breakdown (AI, storage, compute, bandwidth, functions) for the current month.
Auth: Bearer API key
Responses
| Status | Description |
|---|---|
200 | Per-service usage for the current month |
401 | Missing or invalid credentials |
500 | Database error |
operationId: getUserStats