MetaTrader API: read and trade MT4 and MT5 from code

A hosted MetaTrader API for MT4 and MT5, over REST and WebSocket. Read balance, equity, positions and history, and trade with a Full Access key.

$8 per account every 30 days. First account free for 15 days.

MT5 10482913Sample data

Equity (USD)

100,842.65

/account-information

  • /positions2 open+842.65
  • /history-positions3 closed today+390.90
  • /ordersEURUSD buy limit1.08200
  • /quotesEURUSD1.08735

Endpoints

Every path starts with /v1.

Account lifecycle

9 endpoints
  • GET/accounts
  • POST/accounts
  • GET/accounts/{id}
  • PATCH/accounts/{id}
  • DELETE/accounts/{id}
  • POST/accounts/{id}/deploy
  • POST/accounts/{id}/redeploy
  • POST/accounts/{id}/undeploy
  • GET/servers

Trading

12 endpoints
  • POST/accounts/{id}/orders
  • PATCH/accounts/{id}/orders/{ticket}
  • DELETE/accounts/{id}/orders/{ticket}
  • PATCH/accounts/{id}/positions/{ticket}
  • POST/accounts/{id}/positions/{ticket}/close
  • POST/accounts/{id}/positions/close
  • POST/accounts/{id}/positions/{ticket}/close-by
  • GET/accounts/{id}/calculate-margin
  • GET/accounts/{id}/calculate-profit
  • GET/accounts/{id}/check-order
  • GET/accounts/{id}/trade-requests
  • GET/accounts/{id}/trade-requests/{trade_request_id}

Account data

12 endpoints
  • GET/accounts/{id}/account-information
  • GET/accounts/{id}/positions
  • GET/accounts/{id}/orders
  • GET/accounts/{id}/history-deals
  • GET/accounts/{id}/history-orders
  • GET/accounts/{id}/history-positions
  • GET/accounts/{id}/trade-stats
  • GET/accounts/{id}/equity-history
  • GET/accounts/{id}/balance-history
  • GET/accounts/{id}/balance-operations
  • GET/accounts/{id}/symbols
  • GET/accounts/{id}/symbols/{symbol}

Market data

3 endpoints
  • GET/accounts/{id}/quote
  • GET/accounts/{id}/quotes
  • GET/accounts/{id}/candles

Billing

2 endpoints
  • GET/billing
  • POST/billing/checkout

Health

1 endpoint
  • GET/ping

MCP server

1 endpoint
  • POST/mcp

Every operation above is a tool in our MetaTrader MCP server for AI apps such as Claude Code and Cursor, with the same API key and the same errors and limits.

WebSocket stream

1 endpoint
  • WSS/stream

Subscribe to an account to get a full snapshot, then live updates to account information, positions, orders and new deals. Quotes and candles stream on the same socket.

Full request and response shapes are in the API reference.

Limits

Go over the request limit and you get a 429 with a Retry-After header.

requests per second, shared by all your keys
25
requests in a single burst
100
WebSocket connections per developer account, shared by all its keys
5
account subscriptions per connection
50

MT4 works the same way

MT4 accounts use the same endpoints and data model as MT5, with five differences:

  1. Every record says its platform

    Each position, order and deal has a platform field that says MT4 or MT5 (mt4 or mt5).
  2. One history pool

    MT4 keeps one history. You read it as closed deals from /history-deals or as finished orders from /history-orders.
  3. Ticket and position ID match

    On MT4 a position's ticket is also its position ID. Deals and orders point to it through positionId.
  4. No stop-limit orders

    MT4 pending orders are buy_limit, sell_limit, buy_stop and sell_stop only.
  5. A partial close opens a new ticket

    Closing part of an MT4 position opens a new ticket for the volume that is left. List History Positions joins those tickets back into one row through the broker's comment links, and a piece the broker does not number stays its own row. After a Close By, the position that was closed by the other shows volume 0 and the other carries the profit.