Skip to main content

Get Balance

GET /v1/accounts/{id}/balance

Returns the current balance of an account.

Response 200

{
"data": {
"account_id": "ba9755d7e835cdeea6bca803721c7eba",
"debits_posted": 10000,
"credits_posted": 50000,
"debits_pending": 1000,
"credits_pending": 0,
"available": 40000
}
}
FieldDescription
debits_postedTotal completed debits (money that left)
credits_postedTotal completed credits (money that arrived)
debits_pendingFunds held by pending transfers
credits_pendingPending incoming credits
availableSpendable balance right now

How available is calculated

For credit accounts (wallets, liabilities):

available = credits_posted - debits_posted

For debit accounts (assets, expenses):

available = debits_posted - credits_posted

Pending amounts reserve funds but are not final. They reduce what is available until the pending transfer is posted or voided.

Examples

Credit account (customer wallet)

A customer received 50,000, spent 10,000, and has a pending hold of 1,000.

{
"credits_posted": 50000,
"debits_posted": 10000,
"debits_pending": 1000,
"credits_pending": 0,
"available": 40000
}

Available balance is 40,000. The pending hold of 1,000 is reserved but the customer cannot spend it until the hold is resolved.

Debit account (business float)

A business float account had 100,000 debited (loaded) and 30,000 credited (paid out).

{
"debits_posted": 100000,
"credits_posted": 30000,
"debits_pending": 0,
"credits_pending": 5000,
"available": 70000
}

Available balance is 70,000. There is a pending incoming credit of 5,000 that has not settled yet.

Amounts are integers

All amounts are integers in the ledger's smallest unit. Divide by 10^asset_scale to get the display value.

LedgerScaleAmount 50000Display
USD250000$500.00
TZS050000TZS 50,000

See asset scale for details.

tip

Never use floating-point arithmetic when working with amounts. Perform all calculations on the raw integers. Only divide for display at the presentation layer.