Corgi BankDocumentation
OpenAPI

Getting started

Run a bank on your own machine, put demo money in it, and make the first calls. Everything here is an ordinary API call against a local sandbox, so what works here works the same way against a deployed environment.

1. Start a sandbox

The sandbox is every service of the bank running in one process against a temporary database. It never connects to a live rail, and its database is removed when it stops.

  • make up starts PostgreSQL and Kafka locally.
  • make sandbox starts the bank and prints the gateway address and the path of a private credentials file holding a client_id, a client_secret and the scopes they may ask for.

To run every step on this page in one go, pass that file to cmd/sandbox/walkthrough.sh.

2. Get a token

Exchange the client id and secret for a bearer token at POST /tokens. The token lasts 15 minutes. See Authentication.

3. Create a customer and verify it

POST /customers takes a type of business or person, a legal name, an email, a tax id, an address, and a formation date or a date of birth. The customer starts with kyc_status pending.

Nothing opens for a customer whose KYC is pending: POST /accounts answers 422 with the code accounts.customer_not_eligible. Run the check with POST /kyc-checks. The identity provider is a simulator, and it verifies an ordinary customer at once.

4. Open an account

POST /accounts takes the owners and a product_code, such as business_checking. The answer carries the account id, the routing number and a default account number. A consumer product such as consumer_checking also needs the customer's acknowledgement of the opening documents; read them from GET /products/consumer_checking/opening-documents and send their versions and hashes back in acknowledgement.

5. Put demo money in

A deposit at the branch is POST /accounts/{id}/credits with an amount in cents. It posts one journal in the ledger and the money is available at once. To have money arrive from outside instead, use the simulation calls in Sandbox and testing.

6. Move it

  • POST /transfers/ach sends an ACH credit to a counterparty. The transfer is pending and a hold for its amount goes on the account until the entry settles.
  • POST /transfers/book moves money to another account of the bank, addressed by account id or account number. It completes at once.

Every write carries an Idempotency-Key. See Idempotency.

7. Read the balances

GET /accounts/{id} returns the account with its balances: ledger_amount is everything posted, holding_amount is what holds have set aside, and available_amount is what can be spent now. After a 25,000.00 deposit, a 1,250.00 ACH credit still pending and a 100.00 book transfer, the ledger balance is 24,900.00 and the available balance is 23,650.00.

to move to open esc to close