Metered REST + WebSocket gateway for MT4/MT5 trading accounts -- one API key across every broker, with connection handling, automatic reconnection, and usage metering built in. You never write broker-specific socket/protocol code.
1. Get an API key from your dashboard, under API Keys. Send it as the x-api-key header on every request below.
2. Store a broker account (once per account):
``
curl -X POST https://api.metatraderapi.net/v1/broker-accounts \
-H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"platform":"MT4/MT5","user":"12345678","password":"...","server":"Exness-Real9"}'
`
Credentials are encrypted at rest and never appear in any response. This returns an account id.
3. Open a session:
`
curl -X POST https://api.metatraderapi.net/v1/connect \
-H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"brokerAccountId":"<id from step 2>"}'
# => {"handle":"883de362-..."}
`
Calling this again for the same account while a session is still live returns the same handle instead of opening a second one -- safe to call every time your app starts.
4. Call any endpoint below with that handle:
`
curl "https://api.metatraderapi.net/v1/proxy/AccountSummary?handle=883de362-..." \
-H "x-api-key: YOUR_API_KEY"
``
Open, check, and close a trading session.
/v1/proxy/CheckConnectReports whether the session behind this handle is still connected to the broker server, and reconnects it if not. MetaTraderAPI's own reconnect supervisor already polls this in the background and transparently resumes a dropped session, so you don't need to call this yourself to keep a handle alive -- it's mainly useful if your own code wants to confirm connectivity before a time-sensitive action.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/CheckConnect?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/ConnectionStatusReports the current connection state for this handle. Same underlying check as CheckConnect; both are documented identically upstream. As with CheckConnect, MetaTraderAPI already keeps sessions alive in the background, so this is informational rather than something you need to poll to stay connected.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/ConnectionStatus?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/DisconnectCloses this handle's connection to the broker server and invalidates it. Call POST /v1/connect again afterward to open a fresh session for the same broker account.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/Disconnect?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
Balance, equity, margin, and account profile.
/v1/proxy/AccountThe connected account holder's full profile: name, address, phone, email, country, plus balance, credit, and leverage. This returns personal information belonging to whoever owns the connected broker account -- only call it for a session you opened on that account's behalf.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/Account?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/AccountSummaryReal-time trading state: balance, equity, floating profit, used/free margin, margin level, leverage, and account currency. Poll this to display account health or drive your own margin-based logic. synced: false means the terminal is still (re)synchronizing after a reconnect -- balance/equity can briefly read 0 in that window, so don't size a trade off an unsynced summary.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/AccountSummary?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/AccountDetailsStatic account and server metadata: account number, display name, broker server name and time zone, currency, margin-call/stop-out levels, account group, account type, and configured leverage. Fetch this once after connecting to label the account in your UI; poll AccountSummary for anything that changes tick-by-tick.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/AccountDetails?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
Tradable instruments and their live/latest prices.
/v1/proxy/SymbolListEvery tradable symbol name available on this broker server -- names only, no metadata. On MT5, prefer Symbols for full per-symbol metadata in one call; MT4 has no bulk-metadata endpoint, so pair this with SymbolParams per symbol if you need details.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/SymbolList?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SymbolsFull metadata (description, currency, digits, contract size, tick size/value, margin currency, trading limits) for every symbol on the server in a single call -- the bulk equivalent of calling SymbolParams once per symbol.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/Symbols?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SymbolParamsFull trading parameters for one symbol: digits, contract size, tick value/size, margin requirements, and the group it belongs to. These change rarely, so cache the result rather than re-fetching on every quote.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Required symbol |
curl "https://api.metatraderapi.net/v1/proxy/SymbolParams?handle=YOUR_HANDLE&symbol=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SymbolParamsManySame as SymbolParams but for several symbols in one call. Optionally pass filter to return only specific fields and shrink the response.
symbols is also accepted as an alias for symbol.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | array | optional | Symbol name(s) to fetch parameters for. |
| limit | integer | optional | If server has more than 'limit' symbols functon throws an exception |
| filter | array | optional | List of fields that need to return. If not specified - all fields. |
curl "https://api.metatraderapi.net/v1/proxy/SymbolParamsMany?handle=YOUR_HANDLE&symbol=...&limit=...&filter=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/GetQuoteThe latest bid/ask tick for one symbol. msNotOlder trades off freshness vs. latency: 0 always returns whatever the server has cached right now; a positive value makes the call wait for a strictly newer tick if the cached one is older than that. For a live-updating stream instead of polling, use Subscribe over /ws.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Symbol |
| msNotOlder | integer | optional | If last quote arrived less than msOlderMs milliseconds ago function returns last quote, overwise - wait for new quote. If zero - always returns last quote. |
curl "https://api.metatraderapi.net/v1/proxy/GetQuote?handle=YOUR_HANDLE&symbol=...&msNotOlder=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/GetQuoteManySame as GetQuote, for several symbols in one call.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbols | array | required | Symbols |
| msNotOlder | integer | optional | If last quote arrived less than msOlderMs milliseconds ago function returns last quote, overwise - wait for new quote. If zero - always returns last quote. |
curl "https://api.metatraderapi.net/v1/proxy/GetQuoteMany?handle=YOUR_HANDLE&symbols=...&msNotOlder=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/MarketWatchManySnapshot of the broker's Market Watch panel for the given symbols -- the same at-a-glance bid/ask fields a human trader sees in the terminal, for several symbols at once.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbols | array | required | Symbols |
curl "https://api.metatraderapi.net/v1/proxy/MarketWatchMany?handle=YOUR_HANDLE&symbols=..." \
-H "x-api-key: YOUR_API_KEY"
Read and place/modify/close orders.
/v1/proxy/OpenedOrdersAll currently open positions and pending orders on this account. On MT5 you can sort by open or close time via sort/ascending; MT4 always returns them in the account's natural order.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| sort | integer | optional | Sort by open time or close time |
| ascending | boolean | optional | Ascending sort |
curl "https://api.metatraderapi.net/v1/proxy/OpenedOrders?handle=YOUR_HANDLE&sort=...&ascending=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OpenedOrderA single open position/order by ticket number -- use this to refresh one order's state (e.g. right after placing or modifying it) without re-fetching the whole list.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| ticket | integer | optional | Ticket number |
curl "https://api.metatraderapi.net/v1/proxy/OpenedOrder?handle=YOUR_HANDLE&ticket=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OpenedOrdersTicketsJust the ticket numbers of currently open orders, with none of the surrounding detail. Cheaper than OpenedOrders when all you need is to detect which tickets exist right now.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/OpenedOrdersTickets?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/ClosedOrdersThe last 100 orders closed during the current session (since this handle connected) -- not a full historical query. For a specific date range, use OrderHistory instead.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/ClosedOrders?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OrderHistoryClosed orders within an explicit date range. MT5 additionally supports sort/ascending and a filter to restrict which fields come back.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| from | string | required | Range start, format yyyy-MM-ddTHH:mm:ss. |
| to | string | required | Range end, format yyyy-MM-ddTHH:mm:ss. |
| sort | integer | optional | Sort by open time or close time |
| ascending | boolean | optional | Ascending sort |
| filter | array | optional | List of fields that need to return. If not specified - all fields. |
curl "https://api.metatraderapi.net/v1/proxy/OrderHistory?handle=YOUR_HANDLE&from=...&to=...&sort=...&ascending=...&filter=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/RequiredMarginComputes the margin a hypothetical trade would require, without placing it -- use this to pre-flight whether an account has enough free margin before calling one of the Order* endpoints below.
This gateway validates this endpoint's parameters itself (the upstream broker does not) -- a bad value is rejected with a 400 instead of silently producing a wrong result.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Symbol |
| lots | number | required | Lots |
| type | integer | optional | Trade direction: "Buy" or "Sell". |
| price | number | optional | Price |
curl "https://api.metatraderapi.net/v1/proxy/RequiredMargin?handle=YOUR_HANDLE&symbol=...&lots=...&type=...&price=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OrderSendSafePlaces a market or pending order. operation selects the order type using MT5's numeric codes: 0=Buy, 1=Sell, 2=BuyLimit, 3=SellLimit, 4=BuyStop, 5=SellStop (a broker may support a few additional codes beyond these six). price is optional for a market order but required for a pending one.
This gateway validates this endpoint's parameters itself (the upstream broker does not) -- a bad value is rejected with a 400 instead of silently producing a wrong result.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Symbol |
| operation | integer | required | Order type code -- see the endpoint description for the full list. |
| volume | number | required | Lots |
| price | number | optional | Price. Optional, but required in case of Instant Execution. |
| slippage | integer | optional | Slippage. Optional. |
| stoploss | number | optional | StopLoss. Optional. |
| takeprofit | number | optional | TakeProfit. Optional. |
| comment | string | optional | Comment. Optional. |
| stopLimitPrice | number | optional | For the StopLimit order. Optional. |
| expiration | string | optional | Expiration time in yyyy-MM-ddTHH:mm:ss format |
| expirationType | integer | optional | Expiration type |
| placedType | integer | optional | Who placed the order |
curl "https://api.metatraderapi.net/v1/proxy/OrderSendSafe?handle=YOUR_HANDLE&symbol=...&operation=...&volume=...&price=...&slippage=...&stoploss=...&takeprofit=...&comment=...&stopLimitPrice=...&expiration=...&expirationType=...&placedType=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OrderModifySafeChanges stop-loss/take-profit (and, for pending orders, the trigger price/expiration) on an existing order by ticket. Only the fields you pass are changed.
This gateway validates this endpoint's parameters itself (the upstream broker does not) -- a bad value is rejected with a 400 instead of silently producing a wrong result.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| ticket | integer | required | Order ticket |
| stoploss | number | required | StopLoss. |
| takeprofit | number | required | TakeProfit |
| price | number | optional | Price |
| expiration | string | optional | Expiartion in format: yyyy-MM-ddTHH:mm:ss |
| expirationType | integer | optional | Expiration type |
| stoplimit | number | optional | Stop limit price for stop limit orders |
curl "https://api.metatraderapi.net/v1/proxy/OrderModifySafe?handle=YOUR_HANDLE&ticket=...&stoploss=...&takeprofit=...&price=...&expiration=...&expirationType=...&stoplimit=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OrderCloseSafeCloses an open position by ticket, fully or partially via lots. price is required for Instant Execution brokers, optional otherwise.
This gateway validates this endpoint's parameters itself (the upstream broker does not) -- a bad value is rejected with a 400 instead of silently producing a wrong result.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| ticket | integer | required | Order ticket |
| lots | number | optional | Lots. Optional. |
| price | number | optional | Price. Optional, but required in case of Instant Execution. |
| slippage | integer | optional | Slippage. Optional. |
| comment | string | optional | Comment |
curl "https://api.metatraderapi.net/v1/proxy/OrderCloseSafe?handle=YOUR_HANDLE&ticket=...&lots=...&price=...&slippage=...&comment=..." \
-H "x-api-key: YOUR_API_KEY"
Historical OHLC candles and equity curves.
/v1/proxy/PriceHistoryHistorical OHLC candles for a symbol over a date range. Prefer PriceHistoryV2, which takes the same parameters with a clearer timeFrame enum.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | |
| from | string | required | |
| to | string | required | |
| timeFrame | integer | required | |
| timeoutSeconds | integer | optional | Timeout in seconds for the entire request (default 30) |
curl "https://api.metatraderapi.net/v1/proxy/PriceHistory?handle=YOUR_HANDLE&symbol=...&from=...&to=...&timeFrame=...&timeoutSeconds=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/PriceHistoryV2Historical OHLC candles for a symbol between from and to (ISO 8601). timeoutSeconds bounds how long the upstream is given to assemble a large range before the call gives up (default 30s).
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Trading symbol |
| from | string | required | Start date (ISO 8601) |
| to | string | required | End date (ISO 8601) |
| timeFrame | integer | required | Candle timeframe |
| timeoutSeconds | integer | optional | Timeout in seconds for the entire request (default 30) |
curl "https://api.metatraderapi.net/v1/proxy/PriceHistoryV2?handle=YOUR_HANDLE&symbol=...&from=...&to=...&timeFrame=...&timeoutSeconds=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/EquityHistoryAccount equity over time since from, as a series of (time, equity) points -- useful for drawing an equity curve. excludeSameBars trims consecutive points where equity didn't change, for a smaller payload.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| from | string | required | From datetime |
| excludeSameBars | boolean | optional | Return short version without equal bars |
curl "https://api.metatraderapi.net/v1/proxy/EquityHistory?handle=YOUR_HANDLE&from=...&excludeSameBars=..." \
-H "x-api-key: YOUR_API_KEY"
Start/stop live push updates delivered over the /ws socket.
/v1/proxy/SubscribeStarts pushing live quote updates for a symbol over the /ws socket for this handle -- the data doesn't come back in this call's response, it arrives as events on the socket. interval throttles how often updates are pushed for a fast-moving symbol. The subscription persists until you call UnSubscribe or the session ends.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Symbol |
| interval | integer | optional | Minimum interval between events in milliseconds |
curl "https://api.metatraderapi.net/v1/proxy/Subscribe?handle=YOUR_HANDLE&symbol=...&interval=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SubscribeManySame as Subscribe, for several symbols at once.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbols | array | required | Symbols array |
| interval | integer | optional | Minimum interval between events in milliseconds |
| force | boolean | optional | Susbcribe all symbols with one reuest to MT5 server. Experimantal. |
curl "https://api.metatraderapi.net/v1/proxy/SubscribeMany?handle=YOUR_HANDLE&symbols=...&interval=...&force=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/UnSubscribeStops live quote updates for a symbol previously started with Subscribe.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Symbol |
curl "https://api.metatraderapi.net/v1/proxy/UnSubscribe?handle=YOUR_HANDLE&symbol=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/UnSubscribeManyStops live quote updates for several symbols previously started with SubscribeMany.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbols | array | optional | Symbols array |
curl "https://api.metatraderapi.net/v1/proxy/UnSubscribeMany?handle=YOUR_HANDLE&symbols=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SubscribeOhlcSame idea as Subscribe, but pushes OHLC candle updates at the given timeframe instead of tick-level quotes.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | optional | Symbol |
| timeframe | integer | optional | Timeframe in minutes |
| interval | integer | optional | Minimum interval between events in seconds |
curl "https://api.metatraderapi.net/v1/proxy/SubscribeOhlc?handle=YOUR_HANDLE&symbol=...&timeframe=...&interval=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/UnsubscribeOhlcStops OHLC candle updates previously started with SubscribeOhlc.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | optional | Symbol |
| timeframe | integer | optional | Timeframe in minutes |
curl "https://api.metatraderapi.net/v1/proxy/UnsubscribeOhlc?handle=YOUR_HANDLE&symbol=...&timeframe=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SubscribeOrderBookPushes live order-book (market depth) updates for the given symbols over the socket, where the broker exposes depth-of-market data.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbols | array | required | Symbols array |
| interval | integer | optional | Minimum interval between events in milliseconds |
curl "https://api.metatraderapi.net/v1/proxy/SubscribeOrderBook?handle=YOUR_HANDLE&symbols=...&interval=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/UnsubscribeOrderBookStops order-book updates previously started with SubscribeOrderBook.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbols | array | required | Symbols array |
curl "https://api.metatraderapi.net/v1/proxy/UnsubscribeOrderBook?handle=YOUR_HANDLE&symbols=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SubscribedSymbolsLists which symbols this handle currently has an active quote subscription for.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/SubscribedSymbols?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
Connectivity checks.
/v1/proxy/PingNo-op connectivity check -- returns success with no parameters required. Doesn't touch a specific session, so it works even without a handle.
curl "https://api.metatraderapi.net/v1/proxy/Ping?" \
-H "x-api-key: YOUR_API_KEY"
Open, check, and close a trading session.
/v1/proxy/CheckConnectReports whether the session behind this handle is still connected to the broker server, and reconnects it if not. MetaTraderAPI's own reconnect supervisor already polls this in the background and transparently resumes a dropped session, so you don't need to call this yourself to keep a handle alive -- it's mainly useful if your own code wants to confirm connectivity before a time-sensitive action.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/CheckConnect?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/ConnectionStatusReports the current connection state for this handle. Same underlying check as CheckConnect; both are documented identically upstream. As with CheckConnect, MetaTraderAPI already keeps sessions alive in the background, so this is informational rather than something you need to poll to stay connected.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/ConnectionStatus?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/DisconnectCloses this handle's connection to the broker server and invalidates it. Call POST /v1/connect again afterward to open a fresh session for the same broker account.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/Disconnect?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
Balance, equity, margin, and account profile.
/v1/proxy/AccountSummaryReal-time trading state: balance, equity, floating profit, used/free margin, margin level, leverage, and account currency. Poll this to display account health or drive your own margin-based logic. synced: false means the terminal is still (re)synchronizing after a reconnect -- balance/equity can briefly read 0 in that window, so don't size a trade off an unsynced summary.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/AccountSummary?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/AccountDetailsStatic account and server metadata: account number, display name, broker server name and time zone, currency, margin-call/stop-out levels, account group, account type, and configured leverage. Fetch this once after connecting to label the account in your UI; poll AccountSummary for anything that changes tick-by-tick.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/AccountDetails?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
Tradable instruments and their live/latest prices.
/v1/proxy/SymbolListEvery tradable symbol name available on this broker server -- names only, no metadata. On MT5, prefer Symbols for full per-symbol metadata in one call; MT4 has no bulk-metadata endpoint, so pair this with SymbolParams per symbol if you need details.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/SymbolList?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SymbolParamsFull trading parameters for one symbol: digits, contract size, tick value/size, margin requirements, and the group it belongs to. These change rarely, so cache the result rather than re-fetching on every quote.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Required symbol |
curl "https://api.metatraderapi.net/v1/proxy/SymbolParams?handle=YOUR_HANDLE&symbol=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SymbolParamsManySame as SymbolParams but for several symbols in one call. Optionally pass filter to return only specific fields and shrink the response.
symbols is also accepted as an alias for symbol.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbols | array | optional | Required symbols |
curl "https://api.metatraderapi.net/v1/proxy/SymbolParamsMany?handle=YOUR_HANDLE&symbols=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/GetQuoteManySame as GetQuote, for several symbols in one call.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbols | array | required | Symbols |
| msNotOlder | integer | optional | If last quote arrived less than msOlderMs milliseconds ago function returns last quote, overwise - wait for new quote. If zero - always returns last quote. |
curl "https://api.metatraderapi.net/v1/proxy/GetQuoteMany?handle=YOUR_HANDLE&symbols=...&msNotOlder=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/QuoteMT4's single-symbol latest-tick endpoint (equivalent to GetQuote on MT5). See GetQuote for how msNotOlder controls freshness vs. latency.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Symbol |
| msNotOlder | integer | optional | If last quote arrived less than msOlderMs milliseconds ago function returns last quote, overwise - wait for new quote. If zero - always returns last quote. |
curl "https://api.metatraderapi.net/v1/proxy/Quote?handle=YOUR_HANDLE&symbol=...&msNotOlder=..." \
-H "x-api-key: YOUR_API_KEY"
Read and place/modify/close orders.
/v1/proxy/OpenedOrdersAll currently open positions and pending orders on this account. On MT5 you can sort by open or close time via sort/ascending; MT4 always returns them in the account's natural order.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/OpenedOrders?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OpenedOrderA single open position/order by ticket number -- use this to refresh one order's state (e.g. right after placing or modifying it) without re-fetching the whole list.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| ticket | integer | required | Ticket number |
curl "https://api.metatraderapi.net/v1/proxy/OpenedOrder?handle=YOUR_HANDLE&ticket=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OpenedOrdersTicketsJust the ticket numbers of currently open orders, with none of the surrounding detail. Cheaper than OpenedOrders when all you need is to detect which tickets exist right now.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/OpenedOrdersTickets?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OrderHistoryClosed orders within an explicit date range. MT5 additionally supports sort/ascending and a filter to restrict which fields come back.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| from | string | required | Range start, format yyyy-MM-ddTHH:mm:ss. |
| to | string | optional | Range end, format yyyy-MM-ddTHH:mm:ss. |
curl "https://api.metatraderapi.net/v1/proxy/OrderHistory?handle=YOUR_HANDLE&from=...&to=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/RequiredMarginComputes the margin a hypothetical trade would require, without placing it -- use this to pre-flight whether an account has enough free margin before calling one of the Order* endpoints below.
This gateway validates this endpoint's parameters itself (the upstream broker does not) -- a bad value is rejected with a 400 instead of silently producing a wrong result.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Symbol |
| lots | number | required | Lots |
| type | string | optional | Trade direction: "Buy" or "Sell". |
| price | number | optional | Price |
curl "https://api.metatraderapi.net/v1/proxy/RequiredMargin?handle=YOUR_HANDLE&symbol=...&lots=...&type=...&price=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OrderSendPlaces a market or pending order. operation is one of the strings "Buy", "Sell", "BuyLimit", "SellLimit", "BuyStop", "SellStop". price is optional for a market order but required for a pending one.
This gateway validates this endpoint's parameters itself (the upstream broker does not) -- a bad value is rejected with a 400 instead of silently producing a wrong result.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Symbol |
| operation | string | required | Buy, Sell, BuyLimit, SellLimit, BuyStop, SellStop |
| volume | number | required | Lots |
| price | number | optional | Price. Optional, but required in case of Instant Execution. |
| slippage | integer | optional | Slippage. Optional. |
| stoploss | number | optional | StopLoss. Optional. |
| takeprofit | number | optional | TakeProfit. Optional. |
| comment | string | optional | Comment. Optional. |
| magic | integer | optional | Magic. Optional. |
| expiration | string | optional | Expiartion in format: yyyy-MM-ddTHH:mm:ss. Optional. |
| placedType | string | optional | Placed type |
curl "https://api.metatraderapi.net/v1/proxy/OrderSend?handle=YOUR_HANDLE&symbol=...&operation=...&volume=...&price=...&slippage=...&stoploss=...&takeprofit=...&comment=...&magic=...&expiration=...&placedType=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OrderModifyChanges stop-loss/take-profit/price/expiration on an existing order by ticket. Only the fields you pass are changed.
This gateway validates this endpoint's parameters itself (the upstream broker does not) -- a bad value is rejected with a 400 instead of silently producing a wrong result.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| ticket | integer | required | Order ticket |
| stoploss | number | required | StopLoss. |
| takeprofit | number | required | TakeProfit |
| price | number | optional | Price |
| expiration | string | optional | Expiartion in format: yyyy-MM-ddTHH:mm:ss |
curl "https://api.metatraderapi.net/v1/proxy/OrderModify?handle=YOUR_HANDLE&ticket=...&stoploss=...&takeprofit=...&price=...&expiration=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OrderCloseCloses an open position by ticket, fully or partially via lots. price is required for Instant Execution brokers, optional otherwise.
This gateway validates this endpoint's parameters itself (the upstream broker does not) -- a bad value is rejected with a 400 instead of silently producing a wrong result.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| ticket | integer | required | Order ticket |
| lots | number | optional | Lots |
| price | number | optional | Price. Optional, but required in case of Instant Execution. |
| slippage | integer | optional | Slippage. Optional. |
curl "https://api.metatraderapi.net/v1/proxy/OrderClose?handle=YOUR_HANDLE&ticket=...&lots=...&price=...&slippage=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/OrderDeleteCancels a pending order (one that hasn't triggered yet) by ticket. For an already-open position, use OrderClose instead.
This gateway validates this endpoint's parameters itself (the upstream broker does not) -- a bad value is rejected with a 400 instead of silently producing a wrong result.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| ticket | integer | required | Order ticket |
curl "https://api.metatraderapi.net/v1/proxy/OrderDelete?handle=YOUR_HANDLE&ticket=..." \
-H "x-api-key: YOUR_API_KEY"
Historical OHLC candles and equity curves.
/v1/proxy/QuoteHistoryHistorical OHLC candles for a symbol, going back count bars from from at the given timeframe (M1/M5/M15/M30/H1/H4/D1/W1/MN1).
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Symbol |
| timeframe | string | required | Timeframe. M1,M5,M15,M30,H1,H4,D1,W1,MN1 |
| from | string | required | 'From date' in format: yyyy-MM-ddTHH:mm:ss |
| count | integer | required | Number of bars back from specified date. |
curl "https://api.metatraderapi.net/v1/proxy/QuoteHistory?handle=YOUR_HANDLE&symbol=...&timeframe=...&from=...&count=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/EquityHistoryAccount equity over time since from, as a series of (time, equity) points -- useful for drawing an equity curve. excludeSameBars trims consecutive points where equity didn't change, for a smaller payload.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| from | string | required | From datetime |
| excludeSameBars | boolean | optional | Return short version without equal bars |
curl "https://api.metatraderapi.net/v1/proxy/EquityHistory?handle=YOUR_HANDLE&from=...&excludeSameBars=..." \
-H "x-api-key: YOUR_API_KEY"
Start/stop live push updates delivered over the /ws socket.
/v1/proxy/SubscribeStarts pushing live quote updates for a symbol over the /ws socket for this handle -- the data doesn't come back in this call's response, it arrives as events on the socket. interval throttles how often updates are pushed for a fast-moving symbol. The subscription persists until you call UnSubscribe or the session ends.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Symbol |
| interval | integer | optional | Minimum interval between events in milliseconds |
curl "https://api.metatraderapi.net/v1/proxy/Subscribe?handle=YOUR_HANDLE&symbol=...&interval=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SubscribeManySame as Subscribe, for several symbols at once.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbols | array | optional | Symbols array. Subscribe to all - if not specified. |
| interval | integer | optional | Minimum interval between events in milliseconds |
| replace | boolean | optional | Remove previuos subscriptions and replace the with new symbols |
curl "https://api.metatraderapi.net/v1/proxy/SubscribeMany?handle=YOUR_HANDLE&symbols=...&interval=...&replace=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/UnSubscribeStops live quote updates for a symbol previously started with Subscribe.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | required | Symbol |
curl "https://api.metatraderapi.net/v1/proxy/UnSubscribe?handle=YOUR_HANDLE&symbol=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/UnSubscribeManyStops live quote updates for several symbols previously started with SubscribeMany.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbols | array | required | Symbols array. UnSubscribe all - if not specified. |
curl "https://api.metatraderapi.net/v1/proxy/UnSubscribeMany?handle=YOUR_HANDLE&symbols=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SubscribeOhlcSame idea as Subscribe, but pushes OHLC candle updates at the given timeframe instead of tick-level quotes.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | optional | Symbol |
| timeframe | string | optional | Timeframe in minutes |
| interval | integer | optional | Minimum interval between events in seconds |
curl "https://api.metatraderapi.net/v1/proxy/SubscribeOhlc?handle=YOUR_HANDLE&symbol=...&timeframe=...&interval=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/UnsubscribeOhlcStops OHLC candle updates previously started with SubscribeOhlc.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
| symbol | string | optional | Symbol |
| timeframe | string | optional | Timeframe in minutes |
curl "https://api.metatraderapi.net/v1/proxy/UnsubscribeOhlc?handle=YOUR_HANDLE&symbol=...&timeframe=..." \
-H "x-api-key: YOUR_API_KEY"
/v1/proxy/SubscribedSymbolsLists which symbols this handle currently has an active quote subscription for.
| Param | Type | Description | |
|---|---|---|---|
| handle | string | required | Opaque session handle returned by POST /v1/connect. Never the raw upstream session token. |
curl "https://api.metatraderapi.net/v1/proxy/SubscribedSymbols?handle=YOUR_HANDLE" \
-H "x-api-key: YOUR_API_KEY"
Connectivity checks.
/v1/proxy/PingNo-op connectivity check -- returns success with no parameters required. Doesn't touch a specific session, so it works even without a handle.
curl "https://api.metatraderapi.net/v1/proxy/Ping?" \
-H "x-api-key: YOUR_API_KEY"