MetaTrader 5 APIErrors & Rate Limits

For AI agents: this page is also available as Markdown at /docs/mt5/errors.md. The index of every docs page is /docs/llms.txt.

Errors & Rate Limits

Every error from the MetaTrader 5 API is machine-readable. Auth failures return a fixed code, and everything else (timeouts, validation, broker or MQL rejections) comes back in a uniform envelope you can branch on.

Errors

A wrong or missing API key returns HTTP 401 with MRPC_UNAUTHORIZED (see Authentication). An unknown account ID or path returns a plain 404 from the edge. Everything else (timeouts, validation failures, broker/MQL rejections) comes back in a uniform envelope with an error code, a message, and a command_id for log correlation:

Error envelope
{
  "error": "MRPC_TIMEOUT",
  "message": "MarketInfo.PriceHistory timed out",
  "command_id": 19
}

5xx responses come in two flavors. A 500 or 504 with the envelope above means the terminal processed your request but the underlying operation failed or timed out, for example {"error": "MRPC", "message": "CopyRates failed"} when requesting history for a symbol your broker doesn't list (check /symbols for the exact spelling, suffixes included). Envelope-less 5xx responses mean the terminal itself is down or restarting, for example during the brief restart after an API-key rotation. Trading routes can briefly return 503 right after a terminal start, before the trade engine has registered.

Rate Limits

Terminal requests are served by your own dedicated terminal, so heavy polling only slows down your own account, nobody else's. Platform routes under /v1 are rate limited per API key: if you exceed a limit you get a 429 with a Retry-After header, so wait that long and retry. For live prices, positions, or account changes, prefer the WebSocket streams over polling: you get pushed updates without burning round-trips.