MetaTrader®, MT4® and MT5® are trademarks of MetaQuotes Ltd. This is an independent service and is not affiliated with, authorized by, or endorsed by MetaQuotes. Trustpilot4.0
ACCOUNT CONNECTION · MT4 & MT5

Connect any MetaTrader account — with one call.

Hand us a login, password and server; get back an account id and a trading key. Then watch its state, reconnect automatically if the broker drops it, and disconnect when you're done — the whole connection lifecycle over the API.

/ConnectEx · /ConnectState · /Reconnect · /Disconnect
Login + server → account id Auto-reconnect on drop Live connection state MT4 & MT5, any broker
// what it is

The front door to every other endpoint.

The Connection API turns a MetaTrader login into an addressable account you can trade and stream. You POST the login, password and broker server to /ConnectEx; a dedicated terminal boots, logs in, and syncs — and you get back an account id plus a scoped trading key. From then on, every other endpoint targets that account with ?id=. If the broker ever drops the session, /Reconnect rebuilds it, and /ConnectState tells you exactly where a connection stands at any moment.

// the lifecycle

Connect, watch, reconnect, disconnect.

1

Connect

/ConnectEx with login, password and server. Add wait=1 to block until it's live, or use /ConnectStream to watch it come up.

2

Watch

/ConnectState reports one account or all of them; /OnConnectState streams every status change over WebSocket.

3

Recover

/Reconnect rebuilds a dropped session; /Disconnect tears it down cleanly when you're finished.

connect.sh
curl "https://hrx.info/ConnectEx?user=1072…&password=…&server=Ava-Demo%201-MT5&wait=1" \
  -H "x-api-key: sk_live_…"

{ "id": "acc_5f3c…", "status": "ACTIVE", "tradingKey": "sk_live_…" }

# use that id everywhere else
curl "https://hrx.info/AccountSummary?id=acc_5f3c…" -H "x-api-key: sk_live_…"
// questions

Frequently asked

How do I connect an MT4 or MT5 account via API?+
Send the login, password and broker server to /ConnectEx. A terminal boots and logs in, and you receive an account id and trading key. Add wait=1 to block until the account is ACTIVE.
What do I do with the account id?+
Every other endpoint — quotes, trading, streaming, EAs — targets the account by passing ?id=. The id is how the API knows which connected terminal to talk to.
What happens if the broker drops the connection?+
Call /Reconnect to rebuild the session, or watch /ConnectState / stream /OnConnectState to detect drops as they happen and react automatically.
Do I pass a server name or a host and port?+
Either. Pass the broker's server name, or a host and port directly. /GetBrokerServersByBrokerName looks up a broker's servers and access points by name.
Does disconnecting stop my billing period?+
/Disconnect removes the live connection but the paid period keeps running; reconnect any time within it without re-provisioning from scratch.
Start free

One POST, and your account is on the API.

Connect an MT4 or MT5 login and get an id you can trade and stream against in seconds.