Skip to main content

Handle errors

Every API error has the same shape:

{ "error": { "code": "INSUFFICIENT_LIQUIDITY", "message": "Not enough free liquidity for that amount" } }

Act on code; show message to users. The full list is in Errors.

By kind​

KindCodesWhat to do
Fix the requestINVALID_REQUEST, INVALID_CAP, INVALID_STRIKE, STRIKE_TOO_CLOSE, INVALID_TENOR, DIRECTION_NOT_OFFERED, STRUCTURE_NOT_OFFEREDChange terms and retry
Market conditionsINSUFFICIENT_LIQUIDITY, TENOR_DISABLED, POOL_NOT_ACCEPTINGOffer smaller size, another tenor or later
TimingQUOTE_EXPIRED, QUOTE_USED, SLIPPAGE_EXCEEDEDRequest a new quote
DataORACLE_NOT_READY, ORACLE_PRICE_REJECTEDRetry later
AuthUNAUTHORIZED (401)Sign in again
ServiceCHAIN_NOT_ENABLED (503), CHAIN_DRAINING (409), PAUSED, UNKNOWN (500)Retry with backoff

Retrying safely​

  • Quotes are single-use. Never resend a signed transaction built from a quote that failed with QUOTE_EXPIRED or QUOTE_USED; request a new quote.
  • Relaying the same signed transaction twice cannot buy twice: the quote nonce is consumed on the first success.
  • Read GET /api/v2/transactions/:chain/:hash before retrying a relay that timed out.