Liquidity Docs
API Reference

API: `subledger-api` (FBO cash rail)

The for-benefit-of cash sub-ledger, Plaid money rail, and fiat dividend payouts.

The for-benefit-of cash sub-ledger, Plaid money rail, and fiat dividend payouts. Base URL is the subledger-api service.

Conventions

  • Money is integer minor units (USD cents) everywhere (amount_minor).
  • Auth: Bearer JWT when OIDC is enabled; the actor (maker/checker) is the verified identity.
  • Idempotency: write flows accept an idempotency_key; replays are safe.
  • Double-entry: every posting is balanced; the ledger enforces fbo_control = suspense + Σ investor wallets + fee_revenue.
  • Health (public): GET /healthz, GET /readyz.

Account model

Ledger account types: fbo_control (the omnibus bank balance at First Bank of Montana), investor_subaccount (an investor's wallet), suspense (undistributed / unattributed pool), fee_revenue, settlement_clearing.


Reads

MethodPathReturns
GET/accounts{accounts: [{account_id, type, owner_ref, status, balance_minor, held_minor, available_minor, created_at}]}
GET/journal{entries: [{transaction_id, type, reference, narrative, created_by, direction, amount_minor, account_type, account_owner, posted_at}]} (?limit)
GET/payouts{payouts: [{id, investor_id, amount_minor, destination_masked, state, maker, checker, created_at}]}
GET/holds{holds: [{id, investor_id, account_type, amount_minor, reason, reference, status, created_at}]}
GET/bank/transactions{transactions: [{id, external_id, direction, amount_minor, value_date, status}]}
GET/wire-intents{intents: [{id, investor_id, amount_minor, reference, expected_date, status, matched_bank_txn, created_by, created_at, matched_at}]}
GET/recon/status{identity: {fbo_control_minor, investors_minor, suspense_minor, fee_revenue_minor, settlement_clearing_minor, sum_claims_minor, balanced, diff_minor}, last_run}
GET/subaccounts/{investorId}{investor_id, account_id, ledger_balance_minor, available_minor, holds:[...]}
GET/subaccounts/{investorId}/statement{entries: [{transaction_id, type, direction, amount_minor, narrative, posted_at}]}

Cash flows (writes)

Each returns {transaction_id, applied} unless noted. Ledger effect shown as DEBIT / CREDIT.

MethodPathBodyLedger effect
POST/subaccounts{investor_id}opens an investor wallet
POST/deposits{investor_id, amount_minor, idempotency_key}D fbo_control, C investor wallet
POST/deposits/unattributed{amount_minor, idempotency_key}D fbo_control, C suspense
POST/deposits/attribute{investor_id, amount_minor, idempotency_key}D suspense, C investor wallet
POST/transfers{from_investor, to_investor, amount_minor, trade_ref}D from-wallet, C to-wallet
POST/fees{investor_id, amount_minor, idempotency_key}D investor wallet, C fee_revenue
POST/interest{amount_minor, idempotency_key}D fbo_control, C fee_revenue

Holds

MethodPathBodyReturns
POST/holds{investor_id, amount_minor, reason, reference} (reason: pending_trade|pending_withdrawal|other){hold_id}
POST/holds/{id}/release-{released: true}

Withdrawals / payouts (maker-checker)

MethodPathBodyNotes
POST/withdrawals{investor_id, amount_minor, destination_masked, idempotency_key}places a hold, creates a payout in requested
POST/payouts/{id}/approve-checker (must differ from maker) settles: D investor wallet, C fbo_control
POST/payouts/{id}/reject-releases the hold

Wire intents

MethodPathBodyNotes
POST/wire-intents{investor_id, amount_minor, reference, expected_date}declare an expected incoming wire (open)
POST/wire-intents/{id}/cancel-cancel an open intent

Bank import & reconciliation

MethodPathBodyReturns
POST/bank/import{transactions: [{external_id, direction, amount_minor, value_date}]}{imported, matched} (auto-matches to ledger)
POST/recon/run-a recon run: {id, as_of, bank_balance_minor, fbo_balance_minor, sum_claims_minor, status, diffs}

Plaid money rail

The operator links Liquidity's corporate operating account via Plaid and funds the FBO omnibus from it. (First Bank of Montana, the investor-deposit omnibus, is connected separately.)

MethodPathBodyReturns
POST/plaid/link-token{}{link_token, expiration} (initialize Plaid Link)
POST/plaid/exchange{public_token}{accounts: [LinkedBankAccount]} - stores all linked accounts
GET/bank-accounts(?owner_type=operator){accounts: [LinkedBankAccount]}
POST/bank-accounts/{id}/select-set the active funding account; {accounts: [...]}
POST/funding{bank_account_id, amount_minor, idempotency_key}{funding_id, ledger_tx, amount_minor, plaid_status, applied}

LinkedBankAccount: {id, owner_type, owner_ref, institution_name, account_name, mask, subtype, status, selected, created_at}. The Plaid access token is stored server-side and never returned.

Add funds performs a live Plaid balance check on the selected account and credits the FBO omnibus only if the funds are available (plaid_status: "ach_verified"); it becomes a real ACH debit once the Plaid Transfer product is enabled (PLAID_TRANSFER=1). Ledger: D fbo_control, C suspense.

Dividend payout to wallets (maker-checker)

Pays a computed distribution's entitlements into each holder's wallet (their FBO sub-account). Cash stays in the omnibus, re-attributed per investor; holders withdraw to their own bank later.

POST /distributions/{id}/payout-wallet
Body: { "checker": "<operator id, != maker>", "funding_mode": "prefunded" | "auto" }
funding_modeSource (verified before crediting)Ledger per investor
prefundedthe pre-funded pool must hold >= totalD suspense, C investor wallet
autoLiquidity corporate account, checked live via PlaidD fbo_control, C investor wallet

Response:

{
  "distribution_id": "...",
  "funding_mode": "prefunded",
  "paid": [{ "wallet": "0x..", "amount_minor": 3000, "payout_id": "..", "ledger_tx": ".." }],
  "paid_count": 2,
  "total_paid_minor": 5000
}

Every investor gets a payouts row (with funding_mode, distribution_id, and a ledger_tx linking to the exact ledger transaction) plus its own balanced posting - so each dividend is traceable per investor and per payout id even though the cash moves as one blob. Errors: 422 if the funding source can't cover the total, or if checker == maker.