Skip to content

Usage and quotas

Included free on every install. Setting a tenant's quota limits, or turning a hard limit or blocking on, needs a license with the usage-pro feature. See pricing.

Usage and quotas counts what each tenant and each API key uses and keeps monthly records you can bill from. It is also what enforces the limits you put on a tenant or a key. Metering, every read, snapshots and exports are free.

PartWhat it does
MeteringCounts requests and bytes for each API key per calendar month (UTC), and reports each tenant's API calls, bandwidth, storage, content entries and media files.
SnapshotsRecords each tenant's usage for a month, for billing.
Tenant quotasHold a tenant to monthly request, storage and bandwidth limits. Setting a limit needs usage-pro. See Tenant quotas.
Per-key limitsHold one API key to a monthly request count. Setting one needs apikey-pro. See API key request limits.

Every quota and key limit already stored is enforced on every install, even after a license lapses. Clearing a limit, lifting a block and handling increase requests are free too.

You need a super admin token in TOKEN. The quickstart shows how to get one.

  1. Read every tenant's usage this month:

    Terminal window
    curl "http://localhost:3001/api/admin/usage/tenants?period=2026-10" \
    -H "Authorization: Bearer $TOKEN"
    [{ "tenant_id": "default", "billing_period": "2026-10", "api_calls": 0, "storage_bytes": 0, "bandwidth_bytes": 0, "content_count": 1, "media_count": 0 }]

    api_calls and bandwidth_bytes count requests made with API keys.

  2. Write this month's snapshot for every active tenant:

    Terminal window
    curl -X POST "http://localhost:3001/api/admin/usage/snapshot?period=2026-10" \
    -H "Authorization: Bearer $TOKEN"
    { "snapshots_created": 1 }

    Running it again for the same month replaces that month's snapshot.

  3. Export every tenant's usage as CSV:

    Terminal window
    curl "http://localhost:3001/api/admin/usage/export?from=2026-10&to=2026-10&format=csv" \
    -H "Authorization: Bearer $TOKEN"
    tenant_id,billing_period,api_calls,storage_bytes,bandwidth_bytes,content_count,media_count
    default,2026-10,0,0,0,1,0
  4. In the admin console, a super admin opens Operations > Quotas and usage.

GET /api/admin/usage/tenant/{id}?period=YYYY-MM reads one tenant, and an admin may read only their own tenant. GET /api/admin/usage/api-key/{id} reads one key's requests, bytes_in and bytes_out for a month.

A tenant quota caps a tenant's requests, storage and bandwidth, warns at 80% and 90%, and can block the tenant with 429. Setting one needs usage-pro. Reading quotas, the /api/v1/quotas/status route, increase requests and the usage.quota_check flow node are free. All of it is on Tenant quotas.

A key's monthly request limit answers 429 once the key reaches it. Setting a first limit or raising one needs apikey-pro. See API key request limits.

There are no environment variables. Quotas are stored in the database. Usage and quotas runs on every install. If you set LYEVE_PLUGINS to choose which features start, include usage in it. Without it, nothing is metered and no quota or key limit is enforced. See licensing and tiers.

Deleting a tenant deletes its snapshots, quota and increase requests.

An admin who names another tenant gets 403 with cross-tenant access not allowed. A super admin may name any tenant.

Usage routes
MethodPathWhoPurpose
GET/api/admin/usage/tenant/{id}AdminOne tenant's usage for ?period=YYYY-MM, default the current month. An admin may read only their own tenant.
GET/api/admin/usage/api-key/{id}AdminOne API key's usage for ?period=YYYY-MM.
GET/api/admin/usage/tenantsSuper adminEvery active tenant's usage for ?period=YYYY-MM.
GET/api/admin/usage/snapshots/{id}AdminA tenant's monthly snapshots, optionally ?from=YYYY-MM&to=YYYY-MM.
POST/api/admin/usage/snapshotSuper adminWrite the snapshot of ?period=YYYY-MM for every active tenant.
GET/api/admin/usage/exportSuper adminEvery tenant's usage over ?from= and ?to=, as ?format=json (default) or csv.

The quota and increase request routes are listed on Tenant quotas.

StatusMessageCause
400period must be YYYY-MMBad period.
400from/to must be YYYY-MM or from must not be after toBad export range.
403cross-tenant access not allowedAn admin named another tenant.
404tenant not found or api key not foundUnknown id, or a tenant that holds no API key yet.
429quota exceeded - tenant is blockedThe tenant is past a hard quota. See Tenant quotas.
429monthly request limit (<n>) exceededAn API key passed its monthly limit. See API key request limits.