Skip to main content

Two levels of results

Check both the HTTP status and content. Some queries preserve the MT5 envelope, for example {"retcode":"0 Done","answer":{}}; the shape of answer depends on the route. Transport success is not confirmed trade execution. A failed password verification may return HTTP 200 with valid:false.

HTTP errors

Service validation errors are simplified to {"detail":"Invalid request"} to avoid returning sensitive data. Do not depend on detail containing a list of fields or the submitted value. Closing may also return a specific message when parameters do not match the position. An MT5 error may return:
The code is a string and is filtered before being returned. An execution rejection can also appear inside the asynchronous result with HTTP 200.

Recovery

GET queries can be retried with a delay and a maximum number of attempts. Do not automatically apply the same policy to opening and closing orders. Follow idempotency and recovery for uncertain results. A Retry-After header is not guaranteed; do not invent a fixed server waiting period. If you receive HTML or a proxy block instead of JSON, treat it as an invalid response for your workflow. Keep HTTPS validation enabled and confirm state before trading.

Information for support

Keep the method, route, UTC time, HTTP status, X-Request-ID, X-Audit-ID when present, login, MT5 request ID, and idempotency key for trades. Responses generated by the application include X-Request-ID; an earlier proxy or network failure may not include it. X-Audit-ID depends on the audit record being stored. Never send tokens, passwords, or the verification body in a report.