Success envelope
Every successful REST response is wrapped in the same envelope.data holds the endpoint’s payload, which can be an object or an array.
POST endpoints answer with HTTP 200, not 201.
Error envelope
Errors return a non-2xx HTTP status and this body:Machine-readable error code. One of the values in Error codes.
Extra information. Present on validation errors (
[{ field, message }]) and on some 503 responses (a status report). Omitted when there is nothing to add.404 example
code, not on message. Messages can change.
Error codes
Thecode field can hold any of these values:
INVALID_PARAMETERS, INVALID_ADDRESS, TOKEN_NOT_FOUND, POOL_NOT_FOUND, ASSET_NOT_FOUND, BAD_REQUEST, UNAUTHORIZED, FORBIDDEN, NOT_FOUND, RATE_LIMITED, SERVICE_UNAVAILABLE, INTERNAL_ERROR
These are the codes the REST API emits today:
UNAUTHORIZED, FORBIDDEN and RATE_LIMITED exist in the enum but are not emitted today: the REST API currently has no authentication and no rate limiting. Handle them generically so your client keeps working if they are introduced.BAD_REQUEST is used for other 400 responses that are not parameter validation failures. Any HTTP status without its own code (for example 405) is returned with code INTERNAL_ERROR but keeps its real statusCode, so check statusCode as well as code.Validation errors
Query strings and request bodies are validated before anything else runs. A failure returns HTTP400 with:
details: one{ field, message }entry per problem.fieldis the dotted path of the parameter, for examplelimit,chainor0.addressfor the first item of a batch body. It is""for problems with the whole body.message: every detail joined with"; ", each written asfield: message(or justmessagewhenfieldis empty).code:INVALID_ADDRESSonly when every problem is an address problem. Anything else, including a bad address combined with another bad parameter, givesINVALID_PARAMETERS.
Examples
Bad address only,GET /token?address=0x123&chain=1:
GET /token?address=0x123&chain=abc:
GET /token:
GET /trades?...&limit=500&from=10&to=5:
GET /trades?...&cursor=zzz:
POST /market/details with []:
GET /search:
GET /wallet/holdings?chain=137&... (no details):
Messages written by ChainQuery (such as
must be a chain id like 1 or evm:1 or from must be before to) are stable. Generic messages such as Invalid input: expected string, received undefined or Too big: expected number to be <=100 come from the validation library’s defaults, and their wording may change. Match on code and field, not on the message text.Pulse views use string details
OnPOST /pulse/views and POST /pulse/views/pagination, errors found while interpreting the views (unsupported filters, unknown chains, duplicate names) return details as an array of strings instead of { field, message } objects:
path: message. Handle both shapes if you call several endpoints. See Pulse REST views.
WebSocket errors
The WebSocket surfaces do not use HTTP status codes. They senderror messages on the open connection and use WebSocket close codes for connection-level problems:
- Channel WebSocket (
/v1/ws): Limits and errors - Pulse stream (
/v1/ws/pulse): Pulse stream - Multi-events stream (
/streams/v1/ws): Limits and cost