Skip to content

Get Key Spending

GET
/api-keys/{api_key_id}/spending

A key’s caps beside what it has spent today and this month (UTC).

An Admin or Owner reads any key of the organization; any other caller reads only the key it is using, which is how a client throttles itself. Spend is best effort: if the counter store is down the caps are still returned with a spend of 0 rather than failing.

Authorizations

Parameters

Path Parameters

api_key_id
required

Key id from GET /api-keys.

string

Key id from GET /api-keys.

Header Parameters

X-Target-Org-Id
Any of:
string

Responses

200

Successful Response

object
data
required

A key’s caps beside what it has spent in the current UTC day and month.

object
api_key_id
required
string
daily_credit_cap
Any of:
integer
daily_remaining
Any of:
integer
daily_spent
integer
monthly_credit_cap
Any of:
integer
monthly_remaining
Any of:
integer
monthly_spent
integer
spend_alert_threshold_pct
Any of:
integer
pagination
Any of:
object
has_next
required

Whether there are more pages

boolean
limit
required

Items per page

integer
next_cursor
Any of:
string
notes
Any of:
Array<string>
page
required

Current page number (1-indexed)

integer
total
required

Total number of items

integer
total_available
Any of:
integer
total_is_lower_bound
Any of:
boolean

422

Validation Error

object
detail
Array<object>
object
loc
required
Array
msg
required
string
type
required
string