Connection-Level Errors
Before receiving HTTP status codes, you may encounter connection-level errors: Common connection errors:ECONNRESET- Connection reset by peerEPIPE- Broken pipeECONNREFUSED- Connection refusedETIMEDOUT- Connection timeoutSocketError: other side closed- ALB timeout (10 minutes)14 UNAVAILABLE(gRPC) - Stream dropped
Connection Issues Guide
See the full Connection Issues guide for detailed troubleshooting of network errors, ALB timeouts, gRPC streams, keepalive settings, and reconnection strategies
HTTP Status Codes
4xx errors are client-side errors. These indicate problems with your request that you need to fix (invalid data, missing authentication, wrong permissions, etc.). Debug these by examining your request.5xx errors are server-side errors. These indicate problems on the API server. Retry these with exponential backoff.
400 Bad Request
Your request format is invalid. Common causes:- Invalid JSON format
- Missing required fields
- Invalid field values (wrong type, out of range, etc.)
- Invalid parameter combinations
401 Unauthorized
Your JWT token is missing, invalid, or expired. Solution: Request a new token from Auth0 and retry your request. See Authentication for detailed troubleshooting.403 Forbidden
Your token is valid but doesn’t have the required scope for the endpoint. Solution: Contact support to request additional scopes added to your credentials. See Authentication for scope details.404 Not Found
The endpoint or resource doesn’t exist. Common causes:- Incorrect API path
- Resource ID doesn’t exist
- Typo in the URL
405 Method Not Allowed
The HTTP method (GET, POST, etc.) is not supported for this endpoint. Common causes:- Using GET on a POST-only endpoint
- Using POST on a GET-only endpoint
409 Conflict
The request conflicts with the current state of the resource. Common causes:- Duplicate order with same ClOrdID
- Attempting to cancel an already-filled order
- Resource already exists
413 Payload Too Large
Your request body exceeds the maximum allowed size. Common causes:- Sending too many items in a bulk request
- Large text fields or descriptions
- Batch operations with too many records
422 Unprocessable Entity
Your request is well-formed but contains semantic errors. Common causes:- Invalid business logic (e.g., order quantity exceeds position limits)
- Instrument not tradable in current state
- Violates trading rules or risk limits
429 Too Many Requests
You’ve exceeded the rate limit. Solution: Check theRetry-After header in the response and wait that long before retrying.
See Rate Limits for details and troubleshooting.
500 Internal Server Error
An unexpected error occurred on the server. Solution: These are usually temporary. Retry your request after a short delay (1-2 seconds). If errors persist for more than a few minutes, contact support.502 Bad Gateway
The API gateway cannot reach the backend service. Solution: This usually resolves within 60 seconds. Retry your request with exponential backoff. If issues persist, contact support.503 Service Unavailable
The API is temporarily unavailable. Solution: This usually resolves within 60 seconds. Retry your request with exponential backoff. If issues persist, check the status page or contact support.504 Gateway Timeout
Your request took too long to process (over 30 seconds). Common causes:- Large data queries without pagination
- Complex report generation
- Slow network connections
- Use pagination for large result sets (limit/offset parameters)
- Break large operations into smaller requests
- Download reports as files rather than querying all data
- Consider polling for status updates instead of waiting synchronously
Retry Strategy
Retry these errors with exponential backoff:- 429 (rate limit) - Always retry with backoff
- 500, 502, 503, 504 (server errors) - Retry up to 3-5 times
- 400 (bad request) - Fix your request instead
- 401 (unauthorized) - Get a new token first
- 403 (forbidden) - Request won’t succeed without additional scopes
- 404 (not found) - Resource doesn’t exist
- 405 (method not allowed) - Use the correct HTTP method
- 409 (conflict) - Resolve the conflict first
- 413 (payload too large) - Reduce request size
- 422 (unprocessable entity) - Fix validation errors
Exponential Backoff
Implement this retry pattern:Retry-After header value instead of the exponential backoff schedule.
Intermittent Failures
My request works sometimes but fails other times This could indicate:- Intermittent rate limiting - You’re close to the rate limit threshold
- Token expiration - Your token expires mid-session
- Network issues - Temporary connectivity problems
Debugging Failed Requests
How to debug:- Check response body: Error messages include details about what went wrong
- Log request/response: Keep records of your API calls for debugging
- Test with curl: Isolate whether the issue is with your code or the API
- Verify token: Decode your JWT at jwt.io to check claims and expiration
- Check environment: Ensure you’re using the correct API endpoint for your environment
Logging Best Practices
Which identifiers should be logged? At minimum, log these identifiers for troubleshooting:accountId- Trading accountorderId- Order identifierexecId- Execution identifiertradeId- Trade identifiertraceId- Request trace ID (when present in responses)
- Structured error codes
- HTTP status codes
- Specific error fields in response
Reporting Issues
Contact support with:- Environment (dev, preprod, prod)
- Timestamp of the issue
- Request details (endpoint, method, sanitized request body)
- Response (status code, error message)
- Your Client ID (never share your Client Secret)
- Relevant identifiers (accountId, orderId, tradeId, traceId)

