Core concepts

Balances & ledger

Balances are current state. Ledger credits are append-only history. Use both: balances for availability, ledger for auditability.

Balances

Balances are current state, per-asset settlement balances. Use them to gate UX (e.g. disable a payout button when funds are insufficient).

curl $XPEND_BASE/v1/balances \
  -H "Authorization: Bearer $XPEND_SECRET_KEY"
  • Get balance by asset (token + chain combo).
  • Get a single asset balance for tight UI rendering.
  • Cache short-lived, refresh on webhook events.

Ledger credits

Ledger credits are append-only history feeding balances. Use both: balances for availability, ledger for auditability.

curl $XPEND_BASE/v1/ledger/credits?cursor=...&limit=100 \
  -H "Authorization: Bearer $XPEND_SECRET_KEY"

Simple reconciliation pattern

  • Persist ledger credits keyed by id in your warehouse.
  • Sum credits per asset and compare against /v1/balances.
  • Surface diffs > threshold to ops. Tie back to request_id in error logs for support.