MetaTrader REST API. Any broker, no VPS.
Connect a MetaTrader login and trade it over HTTPS. Place orders, read positions and history, and flatten the account, from any language that can make a request.
$15 per account, per month. MT5 today, MT4 next.
$ curl https://api.pipsocket.com/v1/accounts/$ACCOUNT/orders \
-H "Authorization: Bearer $PIPSOCKET_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{ "symbol": "EURUSD", "type": "buy",
"volume": 0.10, "type_filling": "ioc" }'
import os, uuid, requests
response = requests.post(
f"https://api.pipsocket.com/v1/accounts/{os.environ['ACCOUNT']}/orders",
headers={
"Authorization": f"Bearer {os.environ['PIPSOCKET_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={"symbol": "EURUSD", "type": "buy", "volume": 0.10, "type_filling": "ioc"},
)
print(response.status_code, response.json()["state"])
const response = await fetch( `https://api.pipsocket.com/v1/accounts/${process.env.ACCOUNT}/orders`, { method: "POST", headers: { Authorization: `Bearer ${process.env.PIPSOCKET_KEY}`, "Idempotency-Key": crypto.randomUUID(), "Content-Type": "application/json", }, body: JSON.stringify({ symbol: "EURUSD", type: "buy", volume: 0.1, type_filling: "ioc" }), }, ) console.log(response.status, (await response.json()).state)
200 OK
{
"request": "req_5f0c2a9e41d7b3a8c6e2f190",
"state": "done",
"result": {
"retcode": 10009,
"retcode_name": "TRADE_RETCODE_DONE",
"deal": 771203455, "volume": 0.1, "price": 1.08412
},
…
}
- One call, one MT5 request
- Sent once, exactly as you wrote it. No splitting, rounding or hidden retries.
- MT5's answer, as it is
- A fill or a rejection comes back with the broker's own retcode.
- Five seconds for the broker
- No answer by then and you get a request id to look up. It is never resent.
- Safe to retry
- Send an Idempotency-Key and a repeat returns the first order instead of trading twice.
Everything the terminal does, as an endpoint.
Every field maps to its MT5 field, so what you know about MqlTradeRequest still applies. One base URL for every account.
api.pipsocket.com/v1/accounts/{account}
Orders
- POST
/ordersA market or pending order, sent once - POST
/orders/checkMT5's dry run, with the margin it needs - POST
/positions/{ticket}/closeClose all or part of a position - GET
/requests/{request}A trade request and the broker's answer
Account data and control
- GET
/Status, balance, equity and margin - GET
/positionsOpen positions, read fresh from the terminal - GET
/history/dealsDeals and past orders in a time range - GET
/symbols/{symbol}/tickThe broker's latest price for a symbol - POST
/kill-switchBlock new orders, then try to close everything
From MetaTrader login to first order. Three steps, no Windows.
Connect your MT5 login
Server, login and password, from any MT5 broker. Your terminal starts next to your broker's trade server and stays on.
Make your API key
One key for your workspace, shown once. Keep it on your server and roll it whenever you like.
Send your first order
Python, Node, Go, a spreadsheet script. If it can make an HTTPS request, it can trade.
Why not a bridge EA on your own VPS?
| Bridge EA on a VPS | Pipsocket REST API | |
|---|---|---|
| Hosting | A Windows VPS to rent, patch and log into | Nothing to host. We run the MT5 terminal. |
| When it hangs at 3am | Nobody notices until the morning | Restarted and reconnected to your broker automatically |
| Order behaviour | Whatever the EA's author decided, often with silent retries | One MT5 request per call, idempotent, with the broker's retcode |
| Security | A port open on the VPS for your bot to reach | No open ports. Terminals dial out, and your key is checked for every account. |
| More accounts | Another terminal, another EA install, another config | Connect it in the dashboard. Same API, new account id. |
MetaTrader REST API questions
Something else? The docs cover every call and field.
- Does MetaTrader 5 have a REST API?
- Not for traders. MetaQuotes' Python package needs a Windows terminal running on the same machine. Pipsocket runs that terminal for you and puts an HTTPS API in front of it.
- Does it work with my broker?
- If your broker gives you an MT5 login, yes. You keep your broker and your account. Symbol names are the broker's own, so EURUSD on one can be EURUSD.r on another.
- Can I use it with a prop firm account?
- If the firm gives you an MT5 login, it connects like any other. Check your firm's rules on automated trading before you point a bot at it.
- Is MT4 supported?
- Not yet. MT5 is live today and MT4 is next.
- What does it cost?
- $15 per account, per month. REST, WebSocket, TradingView alerts, MCP and the kill switch are all included. No per-trade fees.