OuiPay
API ReferenceExchange

Execute an exchange

POST /v1/exchange : convert currency using a quoted rate.

POST /v1/exchange

Headers

HeaderRequiredValue
AuthorizationyesBearer sk_...
Idempotency-Keyyesunique per operation
Content-Typeyesapplication/json

Body

FieldTypeRequiredNotes
quote_idstringyesQuote ULID from /quotes

Request

curl https://api.ouipay.com/v1/exchange \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: fx-001" \
  -H "Content-Type: application/json" \
  -d '{ "quote_id": "01M2S18..." }'

What happens

  • Debits the from wallet at the quoted rate
  • Credits the to wallet
  • Posts both legs to the ledger atomically: either both post or neither does

Response 201

The exchange transaction with both amounts recorded.

Errors

HTTPerror.codeCause
400VALIDATIONInvalid or missing quote_id
409CONFLICTQuote expired: re-quote
422INSUFFICIENT_FUNDSSource wallet short

On this page