Errors and Security

Public error shape, retry behavior, and public/private API boundary.

Error shape

Errors are flat JSON objects:

{
  "error": "amount must be greater than 0"
}

Log error strings on your backend. Show user-friendly copy in your UI.

Status handling

StatusMeaningClient action
400Invalid request body or unsupported token pairFix validation; do not retry unchanged
401Missing or invalid API keyCheck backend credential configuration
404Quote, asset, or endpoint not foundRefresh state or request a new quote
422Amount outside accepted limits, when returnedUpdate UI bounds and ask the user to revise
429Rate limited, when returnedBack off with jitter server-side
500Unexpected service errorRetry later with a fresh quote
503Quoting temporarily unavailableDisable execution UI and retry later

Retry rules

  • Retry 429, 500, and 503 with exponential backoff.
  • Do not retry unchanged 400, 401, 404, or 422 requests.
  • Never submit a transaction from an expired firm quote.
  • Request a new firm quote after any wallet preparation or signing error.

Public/private boundary

Partner-facing responses intentionally expose only the fields required to price, display, and submit a quote. Internal economics, provider diagnostics, operator controls, and route selection details stay outside the public API.

The public transaction packet is enough for wallet submission: to, data, value, and chain_id.