Error responses
#HTTP status codes
| Code | Meaning |
|---|---|
200 | Success |
201 | Resource created |
400 | Request body / query validation failed |
404 | Resource does not exist |
429 | Rate limit exceeded |
500 | Server error |
#Response envelope
{
"statusCode": 400,
"error": "Bad Request",
"message": [
"outcomeId must be a string",
"side must be one of: BUY, SELL"
]
}| Field | Description |
|---|---|
statusCode | The same number as the HTTP status |
error | A short human-readable label ("Bad Request", "Not Found") |
message | string or string[]. Validation failures are always an array. |
message can be an array
Validation failures from the NestJS ValidationPipe always come as message: string[]. Don't just show error.message as a single line — render each element of the array separately.
#A pattern for handling it on the client
type ApiError = {
statusCode: number;
error: string;
message: string | string[];
};
async function call() {
const res = await fetch(url, init);
if (!res.ok) {
const err = (await res.json()) as ApiError;
const messages = Array.isArray(err.message) ? err.message : [err.message];
throw new Error(messages.join('\n'));
}
return res.json();
}#Common scenarios
| Situation | Response |
|---|---|
outcomeId missing | 400 + ["outcomeId should not be empty"] |
| Invalid enum | 400 + ["status must be one of: ACTIVE, ..."] |
| Market not found | 404 + "Market not found" |
| Rate limit | 429 + "ThrottlerException: Too Many Requests" |
#Rate limit
Public endpoints are rate-limited per IP at the application level — see Rate limits for the current numbers.
If you get a 429, retry after a short backoff (a few seconds). If you're persistently blocked, consult the Retry-After header.
#Next
- Pagination — the list envelope on successful responses
- REST → Markets — the actual endpoints
Was this page helpful?