Usage

Billed usage over a window, broken down by one dimension

Reads the durable billing rollup (usage_daily) for the key's organization. totals is the billed quantity; groups plus unattributed equals totals per metric. If they do not, a warnings entry says so; trust totals.

Pitfalls:

  • to is EXCLUSIVE. One day 2026-08-01 is from=2026-08-01&to=2026-08-02. Days are UTC.
  • Default window: the last 30 UTC days including today. Maximum 400 days per call.
  • A key filed under a project is pinned to it: project_id naming another project is 404, and omitting it reads only the key's project. A key with no project may name any project in the org.
  • group_by=key returns a different body, UsageByKey: per API key (key_id, name, prefix, project_id, revoked), counters per metric per UTC day, from the per-key rollup. Requests made without a key (the dashboard) are not in it. No caller IPs or countries are returned.
  • group_by=engine: the per-engine table is often empty today, so the whole quantity may appear in unattributed with a warning. That is missing attribution, not missing usage.
  • group_by=feature cannot attribute requests, engine_ms, byte counters or the non-batch part of credits; they land in unattributed. Batch spend is attributed to the batch group.
  • credits is total credit spend, batch items included, in every grouping.
  • Check stale_seconds: a large value means the rollup is behind.
get/v1/usage

Request

  • Base URL: https://api.spicrawl.com
  • URL: https://api.spicrawl.com/v1/usage
  • Auth: HTTP bearer

Query parameters

fromstring date
Example:2026-08-01

First UTC day, inclusive, YYYY-MM-DD. Defaults to 29 days before today.

tostring date
Example:2026-09-01

End UTC day, EXCLUSIVE, YYYY-MM-DD. Defaults to tomorrow. Must be after from, and the span must be at most 400 days.

group_by'day' | 'project' | 'engine' | 'feature' | 'key'

Breakdown dimension.

project_idstring

Restrict to one project in the organization (ULID or UUID). Omitted means every project.

metricsUsageMetric[]

Comma-separated metric names to include. Omitted means all. An unknown name is refused with 400.

Response

The breakdown.

OR

Changes

No recorded changes to this operation across all 1 revision of this API.