Skip to main content
Errors share one envelope:
Field order varies and error is sometimes absent; the unknown-order 500 returns only statusCode and message. Branch on statusCode, read message for detail, and treat error as optional. One route adds detail: a bad query parameter on GET /v1/orders returns 400 with message: "Validation failed" plus an errors array, one entry per field with path, code, expected, received, and its own message.

Status codes

GET /v1/tokens/quote doesn’t validate amount. Omit it or send amount=abc and you still get 200, with depositAmount: null, settleAmount: 0, exchangeRate: 0, and depositTokenUsdValue: null. Validate the amount before calling, and treat exchangeRate: 0 as no quote.

Invalid input returns 500

Business validation (an unknown or inactive token ID, a malformed address, a bad amount) fails with 500 and a message naming the problem, so match on the message text: When the message names a field or value, the fix is the input. Surface a correction prompt, not an outage page. One exception: a POST /v1/orders/create body with a missing or string-typed token ID ({}, or "depositTokenId": "231") returns 500 with a multi-line message that is raw internal database text (it names a Prisma query). That text can change without notice, so don’t match on it; validate the body shape before sending and treat the response as a bad request.

What to retry

Fix and resend, never retry as-is: 400, every 401, and any 500 whose message starts with Invalid or Couldn't find trade path. Retry idempotent GETs with exponential backoff on a generic 500, a network failure, or a timeout; no rate-limit headers are published, so back off conservatively. Retry POST /v1/orders/create with care, because each success creates a new order and deposit address. Record every returned uuid before trying again, and deduplicate in your own storage.