Skip to content

Usage

Read your request counts and usage amount for any time window.

curl 'https://api.example.struq/v1/usage?from=2026-09-01T00:00:00Z&to=2026-10-01T00:00:00Z' \
--header 'Authorization: Bearer YOUR_API_KEY'

The response contains completed requests, successes, failures, and usage_amount: usage valued at your price rules, before minimums. Minimum charges settle at the month close and appear in /v1/usage/periods, so while a minimum is in force a month’s usage_amount here can be below what the month is charged. Internal provider identity, provider cost, and margin are never returned by customer endpoints.

{
"customer_id": "cus_...",
"from": "2026-09-01T00:00:00.000Z",
"to": "2026-10-01T00:00:00.000Z",
"data_through": "2026-09-27T11:58:00.000Z",
"requests": 12345,
"successes": 12000,
"failures": 345,
"usage_amount": { "currency": "USD", "micros": "5400000", "amount": "5.4" }
}

Usage is counted in whole UTC hours, so from and to in the response are the hour boundaries that cover the window you asked for. data_through is how far the figures reach: a request that completed after it is not counted yet. It is normally a few minutes behind the current time.