Error Codes
When a request fails, the API returns an appropriate HTTP status code along with a JSON error body.
Error Response Format
Section titled “Error Response Format”{ "error": "invalid_volume", "message": "Volume 0.003 is below minimum 0.01 for EURUSD"}All error responses include an error code string and a human-readable message.
Error Code Reference
Section titled “Error Code Reference”| HTTP Status | Error Code | Description |
|---|---|---|
| 400 | invalid_request | Malformed request body or missing required parameters |
| 400 | invalid_symbol | The specified symbol does not exist or is not tradeable |
| 400 | invalid_volume | Volume does not respect the symbol’s min, max, or step constraints |
| 400 | rejected | The trade was rejected by the MT5 server (e.g., insufficient margin) |
| 401 | unauthorized | Missing or invalid API key |
| 403 | forbidden | API key does not have permission for this operation |
| 404 | position_not_found | The specified position ticket does not exist or is already closed |
| 429 | rate_limit_exceeded | Rate limit budget exhausted. See Rate Limits |
| 503 | bridge_unavailable | The MT5 bridge is temporarily unavailable. Retry after a brief delay |
| 504 | mt5_timeout | The MT5 server did not respond within the timeout period |
Limits and Constraints
Section titled “Limits and Constraints”Keep these limits in mind when building your integration:
| Constraint | Value |
|---|---|
| Maximum open positions | 200 |
| Maximum history range | 90 days (custom date range) |
| Maximum comment length | 27 characters (ASCII only) |
| Bridge timeout | 7 seconds |
| Rate limit budget | 600 weight per minute |
| Idempotency key TTL | 120 seconds |
| WebSocket connections per key | 10 |
| WebSocket subscriptions per connection | 1000 |
MT5 Return Codes
Section titled “MT5 Return Codes”Trade-related endpoints return an MT5 retcode in the response. Common values:
| Retcode | Meaning |
|---|---|
| 10008 | Order placed (pending confirmation) |
| 10009 | Order executed successfully |
| 10004 | Requote |
| 10006 | Request rejected |
| 10007 | Request canceled by trader |
| 10010 | Order partially filled |
| 10013 | Invalid request |
| 10014 | Invalid volume |
| 10015 | Invalid price |
| 10016 | Invalid stops |
| 10019 | Not enough money |
Handling Errors
Section titled “Handling Errors”- 400 errors: Fix the request parameters and retry.
- 401/403 errors: Verify your API key is valid, active, and has the required permissions.
- 404 errors: The position may have been closed by SL/TP or another process. Refresh your position list.
- 429 errors: Wait for
retry_after_secseconds before retrying. See Rate Limits. - 503/504 errors: These are transient. Retry with an idempotency key to prevent duplicates.