Skip to main content
GET
Retrieve an account balance for a usage source.

Authorizations

x-api-key
string
header
required

LedgerUp API Key.

Path Parameters

account_id
string
required

Resource identifier. LedgerUp account identifier.

Pattern: ^account_[0-9a-f]{32}$
Example:

"account_0194f4e3a2b77c6aa91c4f6b4db2a980"

Query Parameters

metric_id
string

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

Pattern: ^metric_[0-9a-f]{32}$
Example:

"metric_0194f4e3a2b77c6aa91c4f6b4db2a980"

currency
string

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

Pattern: ^[A-Za-z]{3}$
Example:

"usd"

Response

Account balance for the requested metric or currency.

account_id
string
required

LedgerUp account identifier.

Pattern: ^account_[0-9a-f]{32}$
Example:

"account_0194f4e3a2b77c6aa91c4f6b4db2a980"

metric_id
string | null
required

LedgerUp metric identifier. Null for a currency balance.

Pattern: ^metric_[0-9a-f]{32}$
Example:

"metric_0194f4e3a2b77c6aa91c4f6b4db2a980"

currency
string | null
required

Lowercase currency code. Null for a metric balance.

Pattern: ^[a-z]{3}$
Example:

"usd"

grant_total
string
required

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

Pattern: ^-?\d+(\.\d+)?$
Example:

"1000"

usage_total
string
required

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

Pattern: ^-?\d+(\.\d+)?$
Example:

"275.5"

balance
string
required

grant_total minus usage_total, serialized as a string.

Pattern: ^-?\d+(\.\d+)?$
Example:

"724.5"