Skip to navigation

Retrieve a customer's usage summary

What a usage meter shows: for each allowance window, how much was granted, used and held, the share used and when it resets, then the balance pools, the next credits to expire, and the money value of this period’s spend. It is read from the ledger, so it works for every customer, with or without allowances: a customer on a plan with no allowances has one window for the plan period and one pool. Use it to draw a meter. Don’t use it to decide whether work may start, because lists and summaries can lag by a few seconds and check() is the authority. percent_used is a decimal from 0 to 1.

Authentication

AuthorizationBearer

A secret key (rl_sk_test_..., rl_sk_live_...) or a restricted key with limited scopes (rl_rk_test_..., rl_rk_live_...). A restricted key can carry agent: true and an expires_at, and is what a coding agent should hold. Keys end in a checksum so secret scanners can recognize them. People create, roll and revoke keys in the dashboard; GET /v1/api_keys lists them, masked.

Path parameters

customer_idstringRequired

The customer ID (cus_...).

Query parameters

subscriptionstringOptional

The subscription (sub_...). Defaults to the customer’s active one.

credit_typestringOptional

The credit type (ID or key). Defaults to the plan’s.

member_idstringOptional<=128 characters

Read the windows a per_member allowance keeps for this member. Without it, those windows are left out.

as_ofdatetimeOptional
Read the summary as it stood at this time. Defaults to now.

Response

The summary.
object"usage_summary"
customerstring
as_ofdatetime
windowslist of objects
poolslist of objects
livemodeboolean
subscriptionstringOptional
credit_typestringOptional
member_idstringOptional
spendobjectOptional
The money value of this period's consumption.
spend_limitslist of objectsOptional
The spend limits that apply, each with what has been spent against it.
binding_windowstringOptional
The key of the window with the least room left, so a meter can show the one that will stop the customer first.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error