SWAGGER STYLE
MT4 Client Explorer
Test session management, account reads, and trade execution against the MT4 client surface.
Base URLhttps://api.metatraderapi.xyz/mt4/client
AuthBearer API key + x-session-id header
How To Test This API
Start by creating a bridge session, then attach the returned session id to subsequent reads or trade writes.
In production, you should validate symbols and lot sizes locally before submitting trade requests.
- Open the session bootstrap endpoint with your broker login and server data.
- Copy the returned session id into the x-session-id header for the next request.
- Test a read endpoint such as /account or /positions before placing any trade task.
- Open the websocket channel to confirm quote or order events are flowing.
| Header | Value | Notes |
|---|---|---|
| Authorization | Bearer <api-key> | Workspace API key. |
| x-session-id | sess_mt4_demo_01 | Bridge session id. |
| x-request-id | req_demo_001 | Recommended for retry-safe task writes. |
Sample Request
BASH
curl -X POST https://api.metatraderapi.xyz/mt4/client/orders \
-H "Authorization: Bearer <api-key>" \
-H "x-session-id: sess_mt4_demo_01" \
-d '{
"symbol": "EURUSD",
"type": "BUY",
"volume": 0.10
}'Sample Response
JSON
{
"taskId": "ord_7x82b1",
"status": "queued",
"submittedAt": "2026-04-07T08:20:11Z"
}Common Status Codes
| Code | Meaning | Typical Cause |
|---|---|---|
| 200 | OK | Read endpoints completed successfully. |
| 202 | Accepted | Trade task was queued and will complete asynchronously. |
| 401 | Unauthorized | API key or session id is invalid. |
| 429 | Rate Limited | Too many requests from the current workspace or account. |
| 502 | Bridge Unavailable | The MT4 bridge is disconnected from the broker. |