MetaTrader API — Help Center
Search or browse the categories on the left to find answers. Each question has its own shareable URL.
Search or browse the categories on the left to find answers. Each question has its own shareable URL.
MetaTrader API is a hosted REST API service that lets you interact with MT4 and MT5 trading accounts programmatically — without running MetaTrader yourself on your computer.
You connect your trading account once, and from that point on you can execute trades, retrieve account data, and read market prices from any programming language using standard HTTP requests.
For full technical details, see the official documentation.
Getting started takes under 30 minutes:
POST /v1/seats or /ConnectEx).See the step-by-step guide in the Authentication docs.
Any language capable of making HTTP requests works with the MetaTrader API. Because it is a plain REST API over HTTPS, you can use Python, JavaScript/Node.js, Go, C#, Java, Ruby, PHP, or any other language.
It also works with no-code tools like Postman, Make (Integromat), n8n, Zapier, or anything that can call an HTTP endpoint.
Yes. The API supports both MetaTrader 4 (MT4) and MetaTrader 5 (MT5) accounts. You can connect and manage accounts from both platforms simultaneously.
Billing is per seat: each seat connects one MT4 or one MT5 account, and you can mix MT4 and MT5 seats on the same subscription.
The endpoints and response shapes are the same on both platforms. The differences are small: stop-limit orders (BuyStopLimit, SellStopLimit) exist on MT5 only, and pending-order (ORDERS) frames on the WebSocket are MT5-only. See the documentation for the full endpoint reference.
No. That is the core purpose of this service. MetaTrader API runs entirely server-side. You connect your broker credentials once, and the API maintains the connection to the broker on your behalf.
You do not need to install MetaTrader, keep any desktop app running, or write any MQL Expert Advisors.
Use your API key in the x-api-key header, and pass the account UUID as the id (or accountId) query parameter:
curl -X GET "https://api.metatraderapi.net/AccountSummary?id=YOUR_ACCOUNT_UUID" \
-H "x-api-key: YOUR_API_KEY"
You create the API key on the account’s card in the dashboard with Generate key; it is shown only once. The management key in Settings is for provisioning, not for the x-api-key header.
The API key for an account is created on that account’s card in the dashboard at app.metatraderapi.net: click Generate key. It is shown only once, so store it right away. /ConnectEx and POST /v1/seats also return a new key for the account they connect. The Settings tab holds your management key, which is for provisioning (creating and removing seats), not for trading calls.
Best practice: store it as an environment variable (e.g. MTAPI_KEY) and inject it at runtime.
You can connect accounts in two ways:
Log in at app.metatraderapi.net, go to the Accounts section, and add your MT4/MT5 credentials (login ID, password, broker server name). Once connected, you receive a unique UUID for that account.
From a backend, use POST /v1/seats with a JSON body and your management key. Alternatively, call /ConnectEx?user=&password=&server=&platform=MT5&wait=60 with a management key or an API key that is neither read-only nor account-scoped. Both return the account id and a new apiKey for it. The exact parameters and response format are in the API documentation.
BrokerName-Live or BrokerName-Demo.Use /CheckConnect?id=. It answers true or false: whether the account is connected to its broker right now. Dropped connections are restored automatically by the service. /ConnectState?id= shows the status and its statusReason, and /Reconnect?id= forces a reconnect.
For details on the request format and response values, see the documentation.
Use /Disconnect?id= (or DELETE /v1/seats/{id} with a management key) to disconnect and remove a connected trading account. You can list all currently connected accounts with /ConnectState called without an id (or with GET /v1/seats).
Disconnecting frees the account’s seat. The seat stays paid until the end of the billing month, and the next account you connect uses it at no extra charge.
See the API documentation for request parameters.
As many as you have seats. Billing is per seat: one seat = one connected account at a time. Add seats whenever you need them ($14 per seat per month for seats 1–4, $13 for seats 5–19 and $12 from the 20th seat, charged upfront).
Each customer can have up to 50 seats; more on request — contact support.
The API covers the full trading lifecycle:
/OrderClose), or against an opposite position (/OrderCloseBy)For full endpoint details, parameters, and response formats, see the API documentation.
Use the /OrderSend endpoint. Like every classic endpoint it is a GET request with query parameters: symbol, operation (Buy, Sell, BuyLimit, ...), volume in lots, and optionally stop loss, take profit, a comment and a clientOrderId:
curl -H "x-api-key: YOUR_API_KEY" \
"https://api.metatraderapi.net/OrderSend?id=YOUR_ACCOUNT_UUID&symbol=EURUSD&operation=Buy&volume=0.01&clientOrderId=order-1"
The parameters are the same on MT4 and MT5. Stop-limit orders (stopLimitPrice) exist on MT5 only. Pending orders take an optional expiration; expirationType is ignored on MT5.
Use the /OrderHistory or /OrderHistoryPagination endpoints. Both filter by date range only (from and to, ISO-8601 or unix seconds); /OrderHistoryPagination splits the result into pages (ordersPerPage, pageNumber). Filter by ticket or sort in your own code. /PendingOrderHistory and /HistoryDealsByPositionId (on MT4 and MT5) give more granular views.
Full parameter reference is in the documentation.
Yes. The API provides a WebSocket (events) connection for real-time streaming. This allows you to receive live updates instead of repeatedly polling REST endpoints.
Through the WebSocket stream (wss://api.metatraderapi.net/v1/stream?id=, authenticated with the x-api-key header) you receive live quotes and candles for the symbols you subscribe to, your open positions with live profit, pending orders and every executed trade, plus a heartbeat every 10 seconds. Up to 25 streams can be open per account.
For live bid/ask prices you can use the REST endpoint /GetQuote (or /GetQuoteMany for multiple symbols), or subscribe to quotes via the WebSocket stream for continuous real-time updates.
/GetQuote takes the account id and a symbol. Answers are cached for 250 ms per account and symbol; add cached=0 to bypass the cache.
For historical OHLC candles, use /PriceHistory on MT4 and MT5 (/QuoteHistory is an alias of it) — see the documentation for timeframe options and parameters.
There is one plan: you pay per seat, and every seat includes the full API — REST, WebSocket streaming and both MT4 and MT5 support. Prices shown excl. VAT:
Each seat holds one connected MT4 or MT5 account at a time and is charged for a full billing month, upfront. Example: 10 seats cost 4 × $14 + 6 × $13 = $134 per month. All prices are confirmed on the pricing page.
No. We do not currently offer a free trial. For questions about evaluating the API, contact us by Telegram or email support@metatraderapi.net.
You can start with a single seat for $14 and add more once your integration works.
Yes. The per-seat plan is billed per seat, and each seat holds one connected account at a time. When all your seats are in use, connecting another account adds a seat for $14 per month ($13 for seats 5–19, $12 from the 20th seat), charged upfront when it is added. Disconnecting an account frees its seat for the next one at no charge, and you can release unused seats from your dashboard. Each customer can have up to 50 seats; more on request — contact support.
Payment is by credit or debit card through Stripe, as a subscription billed monthly. We do not accept crypto or bank transfer.
By placing an order you also accept the Stripe Services Agreement.
Yes, you can cancel at any time. Cancellations take effect at the end of the current billing month — there are no partial refunds for unused days.
The service is operated by Apex Vanguard Dynamics LLC, a Limited Liability Company registered in the United States, with registered address at 30 N Gould St Ste R, Sheridan, WY 82801, United States.
Contact email: support@metatraderapi.net · Phone: +1 (929) 333-6422
For legal details, see the Imprint.
The Terms and Conditions are governed by the laws of the State of Wyoming, United States. Any disputes are subject to the exclusive jurisdiction of the courts in Wyoming, and both parties agree to attempt resolution through good-faith negotiation first.
You can read the full Terms and Conditions on the website.
No. The Terms of Service explicitly require that you keep your login credentials and API keys confidential and must not share them with third parties without prior written consent from MetaTrader API.
If you are building a product or service on top of the API (e.g. for your own clients), you should build your own authentication layer and keep the MetaTrader API key server-side only — never expose it to end users.
No. The Terms of Service prohibit scraping or reselling data from the service without explicit written permission from MetaTrader API. Subscriptions are also non-transferable.
If you have a specific business case, contact support@metatraderapi.net.
Yes. NDAs are available upon request and must be mutually agreed upon in writing. Standard NDA terms apply unless otherwise negotiated.
Contact support@metatraderapi.net to request one.
MetaTrader API protects connected accounts with the following measures:
Security measures, subprocessors and measured uptime are documented in the Trust Center; data handling is described in the Privacy Policy.
MetaTrader API is operated by a US company (see Who operates MetaTrader API?). We comply with applicable data protection law, including the GDPR where it applies to users in the EU/EEA.
Personal data we process includes, for example: account information (name, email, billing details), your sign-up answers, sign-in, security and dashboard usage data (IP address, browser/OS, pages and buttons used), support conversations, and payment information processed through Stripe. The Privacy Policy lists every category with its purpose and retention period.
We do not sell personal data. It is shared only with service providers that process it on our behalf (such as hosting, payments and email delivery), and a Data Processing Agreement is available for customers. Full details are in the Privacy Policy and the Trust Center.
According to the Privacy Policy, the data we process includes:
For connected trading accounts, the broker login credentials are stored as well (encrypted at rest with AES-256-GCM), and the trading data the API retrieves is processed on your behalf. The servers that store this data are located in the EU (Finland and Germany). Private-hosting seats run in the region you choose.
Read the full Privacy Policy for complete information.
The most common reasons a connection fails:
ICMarkets-Live02). Find it in MetaTrader under File → Open an Account.Use the /CheckConnect endpoint to verify the current connection status. If the problem persists, contact support@metatraderapi.net.
Authentication errors typically mean your API key is missing, wrong, or being sent in the incorrect format. Check the following:
x-api-key header — not Authorization: Bearer.See the Authentication documentation for the correct format.
MetaTrader API publishes its measured uptime on a public status page, with the live status and uptime history of the REST API, WebSocket streaming and the dashboard. There is no SLA or uptime commitment; see the Trust Center for how the service is operated.
Note that per the Terms of Service, the service is provided "as is" and "as available" — uninterrupted or error-free operation is not formally guaranteed by contract. For production systems, always implement proper retry logic and error handling on your side.
Trade rejections come from the broker's trading server, not from the MetaTrader API itself. Common causes include:
EURUSD vs EURUSDm).A broker refusal is not an HTTP error: the API answers HTTP 200 with the order object, and its state field carries the broker's result code. 10009 means done; any other value is the reason (for example 10016 invalid stops, 10018 market closed, 10019 not enough money; on MT4, the MT4 error number).