MT5 Account Management API

Link, list, and remove MetaTrader 5 accounts programmatically with the account-management API. Linking an account provisions its own dedicated MT5 terminal in our cloud and returns the account_id you'll use across every per-account REST and WebSocket route.

Link, list, and remove MT5 accounts programmatically. These endpoints live under a different base URL — https://api.fxsocket.com/v1 — and use the same X-API-Key authentication. Linking an account provisions its own dedicated terminal; once its status reads "connected" you can drive it through the per-account REST and WebSocket API documented below.

GET/v1/accounts

List every MT5 account linked to your API key.

Example request
curl -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/v1/accounts
Response
[{
  "id": "b5236acf-c39b-4e8b-be64-a96afb7e6086",
  "nickname": "my demo",
  "platform": "mt5",
  "server": "VTMarkets-Demo",
  "login": 1234567,
  "status": "connected",
  "error": "",
  "created_at": "2026-06-13T22:52:23Z"
}]
POST/v1/accounts

Link a new MT5 account and provision its terminal. The response comes back with status "connecting" — poll GET /v1/accounts/{account_id} until it reads "connected" (usually 1–3 minutes). Returns 402 if you're at your plan's account limit, 409 if the account is already linked, or 400 if the broker rejects the login. MT5 only.

  • server* Broker server name, exactly as MT5 shows it (e.g. VTMarkets-Demo).
  • login* MT5 account login number.
  • password* Account password (investor or master). Stored encrypted; never returned.
  • nickname Optional label shown in the dashboard.
Request body
{
  "server": "VTMarkets-Demo",
  "login": 1234567,
  "password": "your-account-password",
  "nickname": "my demo"
}
Example request
curl -X POST https://api.fxsocket.com/v1/accounts \
  -H "X-API-Key: fxs_live_..." \
  -H "Content-Type: application/json" \
  -d '{"server":"VTMarkets-Demo","login":1234567,"password":"your-account-password","nickname":"my demo"}'
201 response
{
  "id": "b5236acf-c39b-4e8b-be64-a96afb7e6086",
  "nickname": "my demo",
  "platform": "mt5",
  "server": "VTMarkets-Demo",
  "login": 1234567,
  "status": "connecting",
  "error": "",
  "created_at": "2026-06-13T22:52:23Z"
}
GET/v1/accounts/{account_id}

Fetch a single account by id — use it to poll status after linking, until it turns "connected".

Example request
curl -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/v1/accounts/{account_id}
Response
{
  "id": "b5236acf-c39b-4e8b-be64-a96afb7e6086",
  "nickname": "my demo",
  "platform": "mt5",
  "server": "VTMarkets-Demo",
  "login": 1234567,
  "status": "connected",
  "error": "",
  "created_at": "2026-06-13T22:52:23Z"
}
DELETE/v1/accounts/{account_id}

Unlink an account: disconnects it, tears down its dedicated terminal, and removes it — freeing the account slot on your plan. Returns 204 No Content with an empty body.

Example request
curl -X DELETE \
  -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/v1/accounts/{account_id}
Response
204 No Content

status is the account's overall health: "connecting" while its terminal is still starting up (typically 1–3 minutes after linking), "connected" once it's logged in and serving data, "error" if provisioning or the broker login failed (see the error field), and "disconnected" otherwise. The id returned here is the {account_id} used in every per-account route below.