Accounts

Retrieve an account balance for a usage source.

Returns active, effective, non-expired grants for the requested metric or currency minus corrected all-time usage for that source.

get/v2/accounts/{account_id}/balance

Path parameters

account_idstring required

LedgerUp account identifier.

Example:account_0194f4e3a2b77c6aa91c4f6b4db2a980

Resource identifier.

Query parameters

metric_idstring

LedgerUp metric identifier.

Example:metric_0194f4e3a2b77c6aa91c4f6b4db2a980

Metric whose usage is subtracted from the account grants. Exactly one of metric_id or currency is required.

currencystring
Example:usd

Currency whose usage is subtracted from currency grants. Exactly one of metric_id or currency is required.

Response

Account balance for the requested metric or currency.

account_idstring required

LedgerUp account identifier.

metric_idstring nullable required

LedgerUp metric identifier. Null for a currency balance.

currencystring nullable required

Lowercase currency code. Null for a metric balance.

grant_totalstring required

Sum of all grants for the account, serialized as a string.

usage_totalstring required

Sum of corrected usage events for the metric, serialized as a string.

balancestring required

grant_total minus usage_total, serialized as a string.

Example response

{
  "account_id": "account_0194f4e3a2b77c6aa91c4f6b4db2a980",
  "metric_id": "metric_0194f4e3a2b77c6aa91c4f6b4db2a980",
  "currency": "usd",
  "grant_total": "1000",
  "usage_total": "275.5",
  "balance": "724.5"
}

Changes

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