Skip to content

Get Agency Client Usage

GET
/agency/clients/{org_id}/usage

Credits one client used between from and to (UTC days, inclusive, at most 92 days), per day and per product.

Read from the credit ledger the app’s usage page reads (the client’s OWN ledger). rows gives each (day, product) with paid_by: client for the client’s own ledger and agency for usage the agency’s balance paid (agency-pays billing), taken from a structured table that only the credit server writes, never from message text. has_credit_account is false when the client has none yet. 400 for a reversed or over-long range; 504 when the read is slow (retry).

Authorizations

Parameters

Path Parameters

org_id
required

Client org id (org_xxx) from GET /agency/clients.

string

Client org id (org_xxx) from GET /agency/clients.

Query Parameters

from
Any of:
string format: date

First UTC day, inclusive. Default: 29 days before to.

to
Any of:
string format: date

Last UTC day, inclusive. Default: today (UTC).

Header Parameters

X-Target-Org-Id
Any of:
string

Responses

200

Successful Response

object
data
required
object
by_day
required
Array<object>
object
credits
required
integer
date
required

UTC day, YYYY-MM-DD.

string
operations
required
integer
by_product
required
Array<object>
object
credits
required
integer
operations
required
integer
product
required

Customer-facing product label (the same labels the app’s usage page shows).

string
credits_used
required
integer
has_credit_account
required

False when the client has no credit account yet (not the same as no usage).

boolean
operations
required
integer
org_id
required
string
range
required
object
from
required

First UTC day, inclusive.

string
to
required

Last UTC day, inclusive.

string
rows

Detail per (day, product, payer). Days and products with no usage are absent.

Array<object>
object
credits
required
integer
date
required

UTC day, YYYY-MM-DD.

string
operations
required
integer
paid_by
required

Whose ledger the charge landed on: the client’s own, or the agency’s (agency-pays), tagged for this client.

string
Allowed values: client agency
product
required
string
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