Corgi BankDocumentation
OpenAPI

Quote a conversion between two of one customer's deposit accounts on the current approved customer sheet (conversion service)

POST/ledger/fx/quotes

Only the conversion service (a service token with ledger:fx:convert, no API key) quotes; every other identity is 403. The source and target must be two open, unprotected deposit accounts of the same customer in different currencies the ledger holds (ledger.currency_unsupported, 422, otherwise). Exactly one of source_amount or target_amount is fixed, in the account currency's minor units. The price comes from the most recently approved, valid, unwithdrawn customer sheet (ledger.fx_rate_unavailable, 409, when there is none): the customer sells at mid less the sell spread and buys at mid plus the buy spread, arbitrary precision, rounding once in the bank's favour; USD equivalents are at mid and their difference is the spread. A quote over a line's per-conversion limit or the customer's remaining daily limit is ledger.fx_limit_exceeded (422). The quote holds for FX_QUOTE_TTL (60 seconds by default), never past the sheet's validity. The Idempotency-Key is bound to the request body.

Headers

Idempotency-KeystringRequired

Send on every write that creates or changes money or state; a replay with the same key returns the original result with 200.

Body parameters

source_amountintegerOptional
source_ledger_account_idstringRequired

Example lacc_2tVh8nqLxq4GbDe0K1F6S9zRcWm

target_amountintegerOptional
target_ledger_account_idstringRequired

Example lacc_2tVh8nqLxq4GbDe0K1F6S9zRcWm

Returns

200 OK

callerstringRequired
created_atstring · date-timeRequired
daily_limit_usd_minorintegerRequired
daily_used_usd_minorintegerRequired
expires_atstring · date-timeRequired
idstringRequired
ownerstringRequired
priceobjectRequired

ConversionPrice is the exact result of pricing a conversion on a customer sheet.

10 child attributes
customer_ratestringRequired

Target major units per source major unit, ten decimals, for display only

source_amountintegerOptional
source_currency_codestringRequired
source_usd_equivalentintegerRequired
source_usd_per_majorstringRequired
spread_usd_minorintegerRequired
target_amountintegerOptional
target_currency_codestringRequired
target_usd_equivalentintegerRequired
target_usd_per_majorstringRequired
rate_sheet_idstringRequired
source_amountintegerOptional
source_ledger_account_idstringRequired

Example lacc_2tVh8nqLxq4GbDe0K1F6S9zRcWm

target_amountintegerOptional
target_ledger_account_idstringRequired

Example lacc_2tVh8nqLxq4GbDe0K1F6S9zRcWm

Errors

Every error is a problem document with a stable code. See Errors.

400401403404409412413422424429500503

to move to open esc to close