Query aggregated usage data for a customer's subscription within a time range. Returns the computed metric value (after aggregation) and the underlying event count.
Use this to build usage dashboards, generate real-time consumption alerts, or preview what a customer's next invoice will look like before it's generated.
List usage events
Returns paginated raw usage events for the org, newest first - the read side of POST /usage-events. All filter params AND together; multi-value metric_key is repeatable or comma-separated.
query Parameters
limitPage size. Values above the server-side cap are clamped (standard default 50, cap 200; a few document-heavy lists use larger windows). Invalid values fall back to the default.
cursorOpaque continuation token from the previous response's pagination.cursor. Omit for the first page. Cursors are stateless and do not expire, but are only valid for the list and filters that produced them.
customer_idFilter by customer UUID
Filter by customer UUID
product_idFilter by product UUID
Filter by product UUID
subscription_idFilter by subscription UUID
Filter by subscription UUID
metric_keyFilter by metric key. Repeatable or comma-separated
Filter by metric key. Repeatable or comma-separated
occurred_afterFilter by timestamp >= value (RFC3339)
Filter by timestamp >= value (RFC3339)
occurred_beforeFilter by timestamp < value (RFC3339)
Filter by timestamp < value (RFC3339)
Headers
X-Workspace-IdSelects the workspace this request operates in, by workspace UUID or slug (e.g. a sandbox workspace for test integrations). Omitted: the organization's default live workspace. Unknown workspace: 404; workspace outside your organization: 403. Discover workspaces via GET /workspaces.
Workspace UUID or slug.
List usage events › Responses
OK
Ingest a usage event (fire-and-forget billing)
Accepts a single usage event or a batch ({"events": [...]}). Records the event for billing on the next invoice; does not check wallet balance, credit limits, or reservation availability. Use the reserve/capture flow (POST /reservations) when up-front fund availability matters. Returns 202 {status: queued} when the event settles a reservation. Read ingested events back at GET /usage-events.
Headers
Idempotency-KeyUnique key that makes this POST safe to retry: repeats with the same key replay the first response instead of re-executing. Replays are scoped to the retrying principal (same API key / user) and kept for 24 hours. Required on every POST.
Client-generated idempotency key (e.g. a UUID).
X-Workspace-IdSelects the workspace this request operates in, by workspace UUID or slug (e.g. a sandbox workspace for test integrations). Omitted: the organization's default live workspace. Unknown workspace: 404; workspace outside your organization: 403. Discover workspaces via GET /workspaces.
Workspace UUID or slug.
Ingest a usage event (fire-and-forget billing) › Request Body
Decision Table
| Variant | Matching Criteria |
|---|---|
| type = object | |
| type = object |
customer_idCustomer that consumed the metric.
Named dimension values used to select the price tier.
external_cost_amount^-?\d+(\.\d+)?$Caller-supplied wholesale cost (COGS) fed to cost-plus formulas, MAJOR units; requires external_cost_currency.
external_cost_currencyISO 4217 currency of external_cost_amount; one currency per (subscription, metric) group.
hold_idReserve hold this event captures against; null for direct (non-reserve) ingest.
idempotency_keyCaller key that dedupes replays of the same event; required.
Arbitrary caller-supplied key/value annotations carried on the event.
metric_keyMetric this event records usage for; must match the product's meter binding.
price_keyPrice key selecting a tier for keyed products; required when the product exposes keyed prices.
Named numeric variables bound into the price formula at finalize time.
product_idMetered product the event is billed under.
quantity^-?\d+(\.\d+)?$Number of metric units to record; must be non-negative.
subscription_idSubscription the usage is charged against.
timestampWhen the usage occurred; omitted or zero stamps the server's ingest time. Set explicitly for backfill/historical imports.
wallet_currencyISO 4217 currency pinning the event to a specific wallet; the wallet must exist for (customer_id, wallet_currency). Null uses the customer's preferred-currency cascade.
Ingest a usage event (fire-and-forget billing) › Responses
Created
Outcome-dependent: on 201 the created UsageEvent (single-event body) or the BatchIngestResult (batch body); on 202 the UsageEventQueuedResponse when the event settles a reservation and is processed asynchronously (the hold's state is observable at GET /wallets/{id}/holds).
Time-bucketed usage aggregate
Server-side aggregation over the usage_events hypertable. Caps the window at MaxAggregateBuckets at the requested resolution.
query Parameters
sinceWindow lower bound (RFC3339)
Window lower bound (RFC3339)
bucketBucket size: hour | day (default) | week
Bucket size: hour | day (default) | week
untilWindow upper bound (RFC3339); defaults to now
Window upper bound (RFC3339); defaults to now
metricMetric: count (default) | sum_quantity
Metric: count (default) | sum_quantity
group_byGrouping: none (default) | metric_key | dim:
Grouping: none (default) | metric_key | dim:
customer_idFilter by customer UUID
Filter by customer UUID
product_idFilter by product UUID
Filter by product UUID
subscription_idFilter by subscription UUID
Filter by subscription UUID
metric_keyFilter by metric_key. Repeatable or comma-separated
Filter by metric_key. Repeatable or comma-separated
topTruncate to top-N series, fold the rest into 'Other' (default 8; 0 disables)
Truncate to top-N series, fold the rest into 'Other' (default 8; 0 disables)
Headers
X-Workspace-IdSelects the workspace this request operates in, by workspace UUID or slug (e.g. a sandbox workspace for test integrations). Omitted: the organization's default live workspace. Unknown workspace: 404; workspace outside your organization: 403. Discover workspaces via GET /workspaces.
Workspace UUID or slug.
Time-bucketed usage aggregate › Responses
OK