VaultsBalances: Vault / user / address

Balances: Vault / user / address

A single balances endpoint. A balance is an aggregation of ledger accounts (available: can be spent; reserved: locked by pending transfers but still belongs to the owner). Balances are a denormalization of the double-entry journal and are updated atomically with the entries.

ISOLATION: a user sees balances ONLY for their own addresses; an admin sees the entire Vault. Filters: ?addressId= (your own address), ?token=, ?summary=true (totals only, for the dashboard), ?purpose= (filters the account list; totals always include the available/reserved breakdown). Vault-level accounts (external/adjustment) aren't included in totals.

curl -X GET "https://policy-engine-rest.ezig.workers.dev/api/v1/vaults/test_vault/balances?summary=true&addressId=123%20Main%20St&token=usdt&purpose=available&includeShared=true&limit=42&cursor=example_string" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "vaultId": "example_string",
  "totals": [
    {
      "token": {
        "code": "example_string",
        "symbol": "example_string",
        "decimals": 42
      },
      "available": "example_string",
      "availableDecimal": "example_string",
      "reserved": "example_string",
      "reservedDecimal": "example_string"
    }
  ],
  "accounts": [
    {
      "id": "example_string",
      "purpose": "available",
      "balance": "example_string",
      "balanceDecimal": "example_string",
      "token": {
        "id": "example_string",
        "code": "example_string",
        "symbol": "example_string",
        "decimals": 42
      },
      "address": {
        "id": "example_string",
        "address": "123 Main St",
        "label": "example_string"
      }
    }
  ],
  "nextCursor": "example_string"
}
GET
/api/v1/vaults/{code}/balances
GET
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

Session token. Mobile/services. The web uses a cookie.

Session token. Mobile/services. The web uses a cookie.
API Key (cookie: session_token)
session_tokenstring
Required

API key (sent in cookie)

path
codestring
Required

Unique Vault code (slug)

query
summarystring

true means totals only, without the account list

Options: true, false
query
addressIdstring

Balance of a specific address (all its tokens; it must be mine)

query
tokenstring

Filter by token code

query
purposestring

Account list filter (doesn't affect totals)

Options: available, reserved, external, adjustment
query
includeSharedstring

true → include balances of addresses shared with me (view). Default: own addresses

Options: true, false
query
limitinteger
Min: 1 • Max: 100
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Session token. Mobile/services. The web uses a cookie.

path
parameterstring
Required

API Key for authentication. Provide your API key in the cookie.

Path Parameters

codestring
Required

Unique Vault code (slug)

Example:
test_vault

Query Parameters

summarystring

true means totals only, without the account list

Allowed values:truefalse
addressIdstring

Balance of a specific address (all its tokens; it must be mine)

tokenstring

Filter by token code

Example:
usdt
purposestring

Account list filter (doesn't affect totals)

Allowed values:availablereservedexternaladjustment
includeSharedstring

true → include balances of addresses shared with me (view). Default: own addresses

Allowed values:truefalse

Responses

vaultIdstring
Required
totalsarray
Required

Per-token aggregates (available/reserved)

accountsarray

Absent with ?summary=true

nextCursorstring

Account pagination; absent with ?summary=true