Skip to main content

Samples

First calls against a running bank8 deployment - through the BFF proxy, from cURL and Dart.

1. Open an account (customer app flow)​

curl -c jar.txt https://bff.{env}.{org}.example.com/v1/sign-in \
-H 'content-type: application/json' \
-d '{"email": "you@example.com", "password": "…"}'

curl -b jar.txt \
https://bff.{env}.{org}.example.com/proxy/ledger/v1/accounts \
-H 'content-type: application/json' \
-d '{
"product_id": "<product>",
"customer_id": "<customer>",
"denomination": "USD",
"idempotency_key": "open-acct-001"
}'

2. Post a transfer​

curl -b jar.txt \
https://bff.{env}.{org}.example.com/proxy/ledger/v1/postings \
-H 'content-type: application/json' \
-d '{
"batch_id": "b-001",
"idempotency_key": "b-001",
"instructions": [{
"type": "transfer",
"from_account_id": "<acct-a>",
"to_account_id": "<acct-b>",
"amount": "10.00",
"denomination": "USD",
"value_date": "2026-10-15"
}]
}'

The batch is balance-validated before any write - an unbalanced batch is 422, never a compensating entry. Retries with the same idempotency_key are safe.

curl -b jar.txt \
https://bff.{env}.{org}.example.com/proxy/openfin8-ca/v1/consents \
-H 'content-type: application/json' \
-d '{
"provider_id": "<provider>",
"scopes": ["accounts.basic", "accounts.transactions"],
"selected_account_ids": ["<acct-a>"]
}'

Every subsequent provider data call passes the consent middleware and CSDF minimization - the customer can revoke at any time in eBank.

4. From Dart (the eBank pattern)​

final ctx = await fetchRuntimeContext();
final bff = Bff8ApiClient(origin: ctx.origin);

// transfer command shape: one call, safe retries
await bff.post('ledger', '/v1/postings', body: {
'batch_id': 'b-001',
'idempotency_key': 'b-001',
'instructions': [transferInstruction],
});

5. From Rust (vertical consumer)​

use bank8::ledger::LedgerClient;

let balances = ledger_client
.account_balances(&account_id)
.await?;

The client rides the platform's certificate-presenting transport - no token configuration, no static secret to leak.

6. Lend money (lending)​

A loan opens from an approved application, is disbursed with one ledger posting, and is repaid in the product's declared allocation order (fees, interest, principal):

curl -b jar.txt \
https://bff.{env}.{org}.example.com/proxy/lending/v1/loans \
-H 'content-type: application/json' \
-d '{ "application_id": "<application>" }'

curl -b jar.txt \
https://bff.{env}.{org}.example.com/proxy/lending/v1/loans/<loan>/disburse \
-H 'content-type: application/json' \
-d '{ "amount": "25000.00", "destination_account_id": "<acct-a>" }'

curl -b jar.txt \
https://bff.{env}.{org}.example.com/proxy/lending/v1/loans/<loan>/repay \
-H 'content-type: application/json' \
-d '{ "amount": "450.00", "source_account_id": "<acct-a>" }'

Disbursement posts WITHDRAWAL from the borrower's account to the loan account; a syndicated loan funds each participant its share in one atomic batch. GET /v1/loans/<loan>/schedule shows the amortization that results.

7. Read the books (accounting)​

The journal is projected from the ledger's committed postings, so the trial balance is a statement about the same money the ledger holds - a book that does not balance answers 409 rather than publishing:

curl -b jar.txt \
'https://bff.{env}.{org}.example.com/proxy/accounting/v1/trial-balance?period=2026-11'

curl -b jar.txt \
'https://bff.{env}.{org}.example.com/proxy/accounting/v1/statements/balance-sheet?period=2026-11'

8. Move cash at a branch (branch)​

A teller works inside a cashier session; every movement posts to the ledger and updates the drawer position, and the shift summary is derived from those movements rather than counted twice:

curl -b jar.txt \
https://bff.{env}.{org}.example.com/proxy/branch/v1/cash-transactions \
-H 'content-type: application/json' \
-d '{ "session_id": "<session>", "kind": "cash_deposit",
"amount": "250.00", "counterparty_account_id": "<acct-b>" }'

curl -b jar.txt \
https://bff.{env}.{org}.example.com/proxy/branch/v1/cashiers/<session>/shift-summary