Staan
Account Management

Usage API

Track the billed requests of your account over a period, in total and per API key — without going through the Staan console. Combined with the API Keys API, it lets you bill your own customers for the searches they make with the keys you created for them.

Code
GET https://api.staan.ai/v1/usage

Data is available up to the previous day: the current day is not included.

Authentication

Call this endpoint with an API key created in the Staan console:

TerminalCode
Authorization: Bearer YOUR_CONSOLE_API_KEY

Keys created through POST /v1/keys can only be used for search: on /v1/usage they get 403 SCOPE_NOT_GRANTED.

Quick start

TerminalDaily usage for October
curl "https://api.staan.ai/v1/usage?from=2026-10-01&to=2026-10-31&granularity=daily" \ -H "Authorization: Bearer YOUR_CONSOLE_API_KEY"
TerminalMonthly usage of one key
curl "https://api.staan.ai/v1/usage?from=2026-01-01&to=2026-12-31&granularity=monthly&key_id=6f1c2a9e-3b4d-4e5f-8a7b-1c2d3e4f5a6b" \ -H "Authorization: Bearer YOUR_CONSOLE_API_KEY"

Parameters

ParameterRequiredDescription
fromyesStart of the period, inclusive, YYYY-MM-DD
toyesEnd of the period, inclusive, YYYY-MM-DD
granularitynodaily (default) or monthly
key_idnoRestrict the result to one key of your account

The period cannot exceed 366 days, and from must be before or equal to to.

Response

JSONCode
{ "from": "2026-10-01", "to": "2026-10-31", "granularity": "daily", "total": { "web_search": 410, "web_search_for_ai": 0, "total": 410 }, "keys": [ { "key_id": "6f1c2a9e-3b4d-4e5f-8a7b-1c2d3e4f5a6b", "name": "Customer A", "total": { "web_search": 410, "web_search_for_ai": 0, "total": 410 }, "usage": [ { "date": "2026-10-01", "web_search": 12, "web_search_for_ai": 0, "total": 12 } ] } ] }
FieldDescription
totalUsage of the whole account over the period (or of key_id only)
keys[].key_id / keys[].nameIdentifier and name of the key
keys[].totalUsage of this key over the period
keys[].usage[]Usage of this key per day or per month
dateYYYY-MM-DD in daily mode, YYYY-MM in monthly mode
web_searchBilled Web Search requests
web_search_for_aiBilled Web Search for AI requests
totalSum of web_search and web_search_for_ai
  • Days or months without usage are omitted from usage.
  • Deleted keys still count in total, and are listed in keys only if they had usage in the period.

Rate limits and errors

This endpoint accepts 1 request per second, per key. Above that it returns 429: wait a second and retry.

HTTPcode / messageCause
400from must be before or equal to to, The period cannot exceed 366 days, invalid parameterInvalid parameters
401INVALID_KEY_FORMATMissing or malformed Authorization header
401INVALID_CREDENTIALSUnknown key or wrong secret
403KEY_DISABLEDThe key is disabled
403SCOPE_NOT_GRANTEDKey created through the API: use a console key
404not foundkey_id does not belong to your account
410KEY_EXPIREDThe key has expired
429too many requestsRate limit exceeded
Last modified on