Billed usage over a window, broken down by one dimension
Reads the durable billing rollup (`usage_daily`) for the key's organization.
Requires scope: read
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:
tois EXCLUSIVE. One day 2026-08-01 isfrom=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_idnaming 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=keyreturns 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 inunattributedwith a warning. That is missing attribution, not missing usage.group_by=featurecannot attributerequests,engine_ms, byte counters or the non-batch part ofcredits; they land inunattributed. Batch spend is attributed to thebatchgroup.creditsis total credit spend, batch items included, in every grouping.- Check
stale_seconds: a large value means the rollup is behind.
Authorization
bearerAuth Authorization: Bearer <key>. Read the key from the SPICRAWL_API_KEY environment
variable; never hard-code or log it. spicrawl_test_… keys can never spend live
credits. Scopes: scrape, batch, sessions (granted by default), browser
and read (granted deliberately). A missing scope is 403 ERR::AUTH::INSUFFICIENT_SCOPE naming the scope.
In: header
Query Parameters
First UTC day, inclusive, YYYY-MM-DD. Defaults to 29 days before today.
dateEnd UTC day, EXCLUSIVE, YYYY-MM-DD. Defaults to tomorrow. Must be after from, and the span must be at most 400 days.
dateBreakdown dimension.
"day"Value in
- "day"
- "project"
- "engine"
- "feature"
- "key"
Restrict to one project in the organization (ULID or UUID). Omitted means every project.
Comma-separated metric names to include. Omitted means all. An unknown name is refused with 400.
Response Body
application/json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
curl -X GET "https://example.com/v1/usage"{ "period": { "start": "2026-09-01", "end": "2026-09-03", "days": 2, "bounds": "[start, end)" }, "group_by": "key", "keys": [ { "key_id": "01J9Z3K6V1Q2W3E4R5T6Y7U8I9", "name": "ci-pipeline", "prefix": "spicrawl_live_a1b2", "project_id": "01J9Z3K6V1Q2W3E4R5T6Y7U8P0", "revoked": false, "days": [ { "day": "2026-09-01", "metrics": { "requests": 120, "client_cli": 120, "feature_screenshot": 4 } } ], "totals": { "requests": 120, "client_cli": 120, "feature_screenshot": 4 } } ]}Get one request record GET
Returns one record by request id (the `X-Request-Id` / `request_id` you received).
Current-period usage against the plan allowance GET
Usage for the current period, with credit allowance arithmetic in micro-credits (1 credit = 1000000), plus the monthly allowance the API enforces.