Skip to content
中文

Read end-user usage

Code Mode: praxis.customer.usage.retrieve

HTTP: GET /customer/v1/customers/{customer_id}/usage

Read what one end user has cost the organization, per product and per day. The directory stores no cost itself: this reads billing by the customerId dimension shared by every product, so it is the money figure the platform charged for that person. Send from and/or to as RFC 3339 times to narrow the window; omit both for everything recorded. Returns the total, the per-product breakdown and the per-day breakdown. An unknown id answers 404 CUSTOMER_NOT_FOUND.

Signature

praxis.customer.usage.retrieve(args:{path:{customer_id:string};query?:{from?:string;to?:string}}):Promise<{/** Object type, always customer.usage. */ type?:"customer.usage";/** The end user this usage belongs to. */ customer_id?:string;/** Total recorded cost over the window (or over everything when no window was sent). */ total?:{/** Amount as a decimal string in the currency's smallest written form, for example 12.340000; never a float and never arithmetic on the client. */ amount?:string;/** Currency of the amount; platform usage is charged in USD. */ currency?:string};/** The recorded cost split by the product that incurred it. */ by_product?:Array<{/** The product the cost belongs to. */ product?:{/** Product type: agent, content or application. */ type:string;/** Product id, for example agent_123 or cnt_0123456789abcdef. */ id:string};/** Cost recorded for that product. */ cost?:{/** Amount as a decimal string in the currency's smallest written form, for example 12.340000; never a float and never arithmetic on the client. */ amount?:string;/** Currency of the amount; platform usage is charged in USD. */ currency?:string}}>;/** The recorded cost split by day. */ by_day?:Array<{/** Day the cost was recorded, as an ISO date such as 2026-11-17. */ date?:string;/** Cost recorded on that day. */ cost?:{/** Amount as a decimal string in the currency's smallest written form, for example 12.340000; never a float and never arithmetic on the client. */ amount?:string;/** Currency of the amount; platform usage is charged in USD. */ currency?:string}}>}>;

Parameters

NameInTypeRequiredDescription
customer_idpathstringyesEnd-user id from customers.list or customers.get; an id of another organization answers CUSTOMER_NOT_FOUND.
fromquerystringnoStart of the window as an RFC 3339 time, inclusive; omit for the beginning of the record.
toquerystringnoEnd of the window as an RFC 3339 time, exclusive; omit for now.

Responses

StatusContent typesDescription
200application/jsonThe end user’s recorded cost with its per-product and per-day breakdowns.
400application/jsonINVALID_PARAMS: the request is not shaped the way this face accepts — an unknown or misspelled field, a repeated query parameter, a resource scope not in the form <type>:<id>:<action>, an expand value that is not products, sign_ins or usage, or a confirm that does not repeat the path customer id. The error names the field at fault and what it accepts; correct that field and send the request again.
401application/jsonThe credential is missing, malformed or expired. Merchant routes answer UNAUTHENTICATED when the API key or session names no organization; the pre-auth doors answer GRANT_CODE_INVALID when a grant code is unknown, already used, expired or foreign, and ACCESS_TOKEN_EXPIRED when the end-user token cannot be verified (a sign-in that is over answers SIGN_IN_EXPIRED or SIGN_IN_REVOKED). Send a valid API key, request a fresh grant code, or sign the end user in again.
404application/jsonCUSTOMER_NOT_FOUND: no end user of this organization has that id, or the id belongs to another organization; a deleted key answers the same way. Read the current id from customers.list (or publishable_keys.list for a key) and retry with that; never construct an id.
502application/jsonUPSTREAM_UNAVAILABLE: the token issuer or another dependency refused the call, so nothing was issued or changed. Retry later, and if it persists report the time and the request path.
503application/jsonUPSTREAM_UNAVAILABLE: this face is not usable in this environment — the CUSTOMER service binding is unwired, or the anonymous rate limiter is unavailable or misconfigured so the door fails closed. Use an environment where the face is wired, or retry when the dependency is back.