Error Codes
All API errors follow a consistent format. REST responses use HTTP status codes along with structured error bodies. gRPC responses include error_code and error_message fields.
Error Response Format
{
"success": false,
"error": {
"code": "MARKET_NOT_FOUND",
"message": "Market with id abc-123 not found",
"details": {}
}
}
Market Errors
| Code | HTTP Status | Description |
|---|---|---|
MARKET_NOT_FOUND | 404 | Market with the given ID does not exist |
MARKET_NOT_OPEN | 400 | Market is not in OPEN status — trading is not allowed |
MARKET_ALREADY_RESOLVED | 409 | Market has already been resolved |
MARKET_INVALID_STATUS_TRANSITION | 400 | Invalid status change (e.g., trying to open an already closed market) |
VALIDATION_ERROR | 400 | Currency is not in the operator's supportedCurrencies list |
Order Errors
| Code | HTTP Status | Description |
|---|---|---|
ORDER_NOT_FOUND | 404 | Order with the given ID does not exist |
ORDER_INVALID_PRICE | 400 | Price is outside the allowed range (0.01–0.99) |
ORDER_INVALID_SHARES | 400 | Shares count is outside the allowed range (1–100,000) |
ORDER_INSUFFICIENT_FUNDS | 400 | Insufficient funds to place the order |
ORDER_CANNOT_CANCEL | 400 | Order is not in a cancellable status (must be PENDING or PARTIAL) |
ORDER_NO_LIQUIDITY | 400 | No matching orders available for a market order |
Position Errors
| Code | HTTP Status | Description |
|---|---|---|
POSITION_NOT_FOUND | 404 | Position does not exist |
POSITION_INSUFFICIENT_SHARES | 400 | Operator does not hold enough shares to sell |
Category Errors
| Code | HTTP Status | Description |
|---|---|---|
CATEGORY_NOT_FOUND | 404 | Category with the given ID does not exist |
CATEGORY_DUPLICATE_SLUG | 409 | A category with this slug already exists for the operator |
Settlement Errors
| Code | HTTP Status | Description |
|---|---|---|
SETTLEMENT_FAILED | 500 | Settlement processing encountered an error |
SETTLEMENT_ALREADY_COMPLETED | 409 | Settlement has already been completed |
Authentication Errors
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Missing or invalid authentication credentials |
General Errors
| Code | HTTP Status | Description |
|---|---|---|
VALIDATION_ERROR | 400 | Request body validation failed — check the error message for details |
INTERNAL_ERROR | 500 | An unexpected internal error occurred |
NOT_FOUND | 404 | The requested resource was not found |
FORBIDDEN | 403 | You do not have permission to perform this action |
CONFLICT | 409 | The request conflicts with the current state of the resource |
Order Validation Errors
These errors are returned when placing an order fails validation:
| Error Message | Description |
|---|---|
Market not found | The specified marketId does not exist |
Market is not open for trading | Market status is not OPEN |
Trading has not started yet | Current time is before tradingStartsAt |
Trading has ended | Current time is after tradingEndsAt |
Invalid outcome for this market | The outcomeId does not belong to the market |
Shares must be greater than 0 | Shares value is zero or negative |
Shares must be at least {min} | Below minimum share count |
Shares must be at most {max} | Above maximum share count |
Price is required for LIMIT orders | LIMIT order missing price field |
Price must be between {min} and {max} | Price outside allowed range |
Insufficient shares to sell | SELL order exceeds operator's position |
HTTP Status Code Summary
| Status | Usage |
|---|---|
200 | Successful retrieval or update |
201 | Successful creation (markets, orders, categories) |
400 | Validation error or bad request |
401 | Authentication required |
403 | Insufficient permissions |
404 | Resource not found |
409 | State conflict |
500 | Internal server error |