code and a message. Use code to decide what to do next. Show message to your user: it’s written for them.
Error shape
Every response includes
requestId, except a 401 for a missing or malformed API key and a 429 rate_limited. Those carry only success and error.
Codes you don’t recognize
New codes may be added. When you get a code you don’t handle yet:- On a
409, get a new quote. - On a
5xxfromPOST /v1/execute, send the same request again. Never sign a new quote: the order may already have been sent.
When a route gives no quote
A missing quote isn’t an error.POST /v1/quotes answers 200 with the quotes it found, and lists each route that gave none in unavailableRoutes, with why:
routeName is absent when no route was asked, for example for a token Sunrise doesn’t trade. The most common codes:
A route can also report any other code from this page. Its
message is always safe to show your user.
Request errors
Don’t retry a
4xx other than 429 unchanged: the same request gets the same answer.
Order errors
These come fromPOST /v1/execute.
A
409 means the order was refused before it was sent. A 422 means the order can’t go through as signed.
Server errors
See Swap with the API for an execute loop that follows these rules.

