Accounts

Get account usage for a time range.

get/v2/accounts/{account_id}/usage

Path parameters

account_idstring required

LedgerUp account identifier.

Example:account_0194f4e3a2b77c6aa91c4f6b4db2a980

Resource identifier.

Query parameters

start_atinteger required

Unix timestamp in seconds.

Example:1767225600

Inclusive lower bound for event occurrence time.

end_atinteger required

Unix timestamp in seconds.

Example:1767225600

Exclusive upper bound for event occurrence time.

aggregation'sum' | 'min' | 'max' | 'avg' | 'latest' | 'count'

Aggregation applied to corrected usage events. latest returns the quantity from the event with the latest occurred_at; ties use accepted_at then event ID. count returns the number of events.

Example:sum

Aggregation applied to corrected usage events. Defaults to sum.

currencystring
Example:usd

Aggregate only events for this currency. Normalized to lowercase.

Response

Account and usage aggregated by metric or currency.

Example response

{
  "account": {
    "id": "account_0194f4e3a2b77c6aa91c4f6b4db2a980",
    "external_id": "crm_acme_001",
    "ledgerup_customer_id": "0194f4e3-a2b7-7c6a-a91c-4f6b4db2a980",
    "name": "Acme",
    "description": "Usage tracked for Acme.",
    "created_at": 1767225600,
    "updated_at": 1767225600,
    "archived_at": 1767225600
  },
  "events_consumed": [
    {
      "metric_id": "metric_0194f4e3a2b77c6aa91c4f6b4db2a980",
      "currency": "usd",
      "metric_name": "Tokens",
      "measurement_units": "m",
      "quantity": "1250.5"
    }
  ]
}

Changes

No recorded changes to this endpoint across all 1 revision of this API.