Skip to main content
GET
/
api
/
ledger
/
v2
/
{ledger}
/
aggregate
/
balances
Get the aggregated balances from selected accounts
curl --request GET \
  --url http://localhost/api/ledger/v2/{ledger}/aggregate/balances \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{}'
{
  "data": {
    "USD": 100,
    "EUR": 12
  }
}
Calculate the sum of balances across a filtered set of accounts. Useful for computing totals like total customer funds, revenue by category, or liability tracking.

Parameters

ledger: The name of the ledger to aggregate balances from. (e.g., ledger001) pit: Point-in-time query. Returns balances as they existed at this timestamp. (e.g., 2024-01-15T10:30:00Z) useInsertionDate: When true, uses the insertion timestamp instead of the effective date for calculations.

Request Body

Filter criteria to select which accounts to aggregate. Use $match with address patterns to sum balances. See Filtering Queries for full syntax. Example:
{
  "$match": {
    "address": "users::wallet"
  }
}

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

ledger
string
required

Name of the ledger.

Example:

"ledger001"

Query Parameters

pit
string<date-time>
useInsertionDate
boolean

Use insertion date instead of effective date

Body

application/json

The body is of type object.

Response

OK

data
object
required
Example:
{ "USD": 100, "EUR": 12 }