Skip to main content
GET
Read the organization's API usage, grouped by action or day
Aggrega le transazioni di credits attribuite all’API della tua organizzazione in bucket di utilizzo. Restituisce total_credits, total_requests e un elenco di buckets (key, credits, requests). Restringi la finestra con from/to, scegli il raggruppamento con group_by (per azione o per giorno) e limita l’ambito a una singola chiave con api_key_id. Richiede lo scope usage.read.

Autorizzazioni

Authorization
string
header
obbligatorio

Organization API key as a bearer token: Authorization: Bearer samsa_sk_....

Parametri della query

from
string | null

ISO-8601 date or datetime lower bound (inclusive). Defaults to the current billing period's start when both bounds are omitted.

Esempio:

"2026-07-01"

to
string | null

ISO-8601 date or datetime upper bound (inclusive; a bare date covers the whole day). Defaults to the current billing period's end when both bounds are omitted.

Esempio:

"2026-07-31"

group_by
enum<string>
predefinito:day

Bucket dimension: action (action type) or day (calendar date).

Opzioni disponibili:
action,
day
api_key_id
string<uuid> | null

Restrict to one of the organization's API keys (404 if not yours).

Risposta

Successful Response

GET /usage body — org usage over API-attributed transactions.

total_credits
integer
obbligatorio

Net credits across all buckets.

Esempio:

45

total_requests
integer
obbligatorio

Billed requests across all buckets.

Esempio:

9

buckets
PublicUsageBucket · object[]
obbligatorio