Skip to main content

Error Response Format

All errors follow a consistent format:

HTTP Status Codes

  • 200 OK: Successful request;
  • 400 Bad Request: Invalid request parameters;
  • 401 Unauthorized: API key missing or invalid;
  • 403 Forbidden: API key does not have necessary permissions or IP not allowed;
  • 406 Not Acceptable: Request cannot be processed (e.g., market closed);
  • 429 Too Many Requests: Rate limit exceeded;
  • 500 Internal Server Error: Server error.

Error Codes

Order Placement Errors

PO1
Description: Price is invalid (must be between 0-100 ticks for limit orders, or value_cents must be positive for market orders)
PO2
Description: Quantity is invalid (must be positive)
PO3
Description: Account does not have sufficient balance to place the order
PO4
Description: Account does not have sufficient contracts to sell
PO5
Description: Market does not have sufficient liquidity to execute the order
PO6
Description: Order not found (when trying to cancel)
PO7
Description: User is not authorized to perform this action
PO8
Description: Market is closed and no longer accepting orders
-1
Description: An unexpected error occurred

Authentication Errors

401 Unauthorized

Causes:
  • Missing X-Api-Key header
  • Invalid API key
  • API key expired
  • API key is disabled
Solution: Verify that your API key is correct and active in Profile → Security

403 Forbidden

Causes:
  • Your IP address is not on the API key whitelist
Solution: Add your IP address to the API key’s allowed IPs list

Rate Limiting

429 Too Many Requests

Description: You have exceeded the rate limit for this endpoint Response Headers:
  • Retry-After: Number of seconds to wait before trying again
Solution: Wait for the specified time before making another request

Error Handling Best Practices

  1. Check Status Codes: Always check HTTP status codes before processing responses
  2. Handle Rate Limits: Implement exponential backoff for rate limit errors
  3. Validate Input: Validate all parameters before sending requests
  4. Check Market Status: Verify that the market is open before placing orders
  5. Monitor Balance: Check available balance before placing orders
  6. Log Errors: Log error codes and messages for debugging

Error Handling Example