ScalixScalix Docs
Sign up

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)

plaintext
GET /api/v1/usage

Cross-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

StatusDescription
200Usage summary (operator key only)
401Missing or invalid API key
403Caller is not a platform operator
500Internal error

operationId: getUsageSummary

List the org's API keys with their IAM-tracked metadata

plaintext
GET /v1/usage/keys

XW-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

StatusDescription
200The 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.
401Missing or invalid API key
403Token lacks the metering:read scope
500Internal error

operationId: getKeysUsage

Get one API key's IAM-tracked metadata

plaintext
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

NameInTypeRequiredDescription
key_idpathstringYesAPI key id (UUID)

Responses

StatusDescription
200IAM-tracked metadata for one API key (id, name, prefix, last_used_at). No per-key request counts — metering is keyed by org/project.
401Missing or invalid API key
403Token lacks the metering:read scope
404Key not found in this organization
500Internal error
501Billing not configured

operationId: getKeyUsage

Get the caller's budget

plaintext
GET /v1/user/budget

Returns current usage (AI tokens, storage, compute hours), the plan's allowances, and the remaining headroom for each.

Auth: Bearer API key

Responses

StatusDescription
200Usage, plan limits, and remaining allowance
401Missing or invalid credentials
500Database error

operationId: getUserBudget

Get the caller's usage stats

plaintext
GET /v1/user/stats

Returns a per-service usage breakdown (AI, storage, compute, bandwidth, functions) for the current month.

Auth: Bearer API key

Responses

StatusDescription
200Per-service usage for the current month
401Missing or invalid credentials
500Database error

operationId: getUserStats