# MetaTrader API > MetaTrader API is an independent REST and WebSocket API that connects MetaTrader 4 (MT4) and MetaTrader 5 (MT5) trading accounts to external applications — CRMs, trading bots, copy-trading platforms, and prop-firm dashboards — without running MetaTrader or an Expert Advisor (EA) yourself. MetaTrader API is not a forex/CFD broker and is not affiliated with, authorized by, or endorsed by MetaQuotes Ltd. MetaTrader API connects an account once (broker server, login, password) and then lets developers call documented HTTP endpoints with an API key and the account's id to retrieve account data (balance, equity, margin, trade history), execute or modify trades, and stream live quotes and order updates over WebSocket. It is language-agnostic (Python, Node.js, Go, C#, Java, PHP — anything that can make an HTTP request) and priced per connected account (seat): $14 per seat per month for seats 1-4, $13 for seats 5-19 and $12 from the 20th seat, with REST, WebSocket, MT4 and MT5 included in every seat. © 2026 Apex Vanguard Dynamics LLC. You, and the software tools and AI agents working for you, may read and use this documentation to build, run and support integrations with MetaTrader API; its code examples may be copied into your own software. Republishing or redistributing the documentation, in whole or in substantial part, is not permitted. Terms: https://www.metatraderapi.net/en/terms/ REST base URL: https://api.metatraderapi.net · WebSocket: wss://api.metatraderapi.net/v1/stream · OpenAPI spec version 1.0.0 · Docs last updated: 2026-10-14 ## Use this API when - Your code (any language) must read or trade existing MT4/MT5 accounts at any broker: bots, copy trading, signal distribution, dashboards, prop-firm and CRM integrations. - You need many accounts at different brokers behind one API, connected and removed programmatically (provisioning API). - You want live quotes, positions, orders and executed deals pushed over a WebSocket instead of polling. ## Do not use this API for - Broker-side administration of a whole MT4/MT5 server (that is the broker's Manager API). - FIX connectivity, liquidity or prices of its own: it is not a broker; every order executes at the account's broker. - Testing without any MetaTrader account: there is no sandbox, test key or free trial (use a broker demo account; it uses a paid seat). ## Rules for coding agents - Always send the API key as the `x-api-key` header and the account id as `?id=` (classic REST). `Authorization: Bearer` carries the management key (provisioning endpoints, `/ConnectEx`). - API keys are not limited to one account unless created with `accountScoped: true`; the `?id=` picks the account. Give end users only scoped (and if needed `readOnly`) keys. - Always check `state` in every trade response: `10009` = done. A broker refusal is HTTP 200 with another code, never an HTTP error. - Always send a unique `clientOrderId` with `/OrderSend`; a retry with the same id cannot open a second order. - Never resend a trade after `503 TIMEOUT`, `503 TERMINAL_NOT_CONNECTED`, a `500` or a CDN `52x` without checking `/OpenedOrders` first: the order may have been executed. - Set HTTP client timeouts to 75 s (a read can take up to about 65 s) and send `/ConnectEx` with `wait=60` or less. - Never hard-code symbol names across brokers (`EURUSD` vs `EURUSD.m` vs `EURUSDm`); resolve them per account with `/SymbolList`. - Always round volume to the symbol's step and keep SL/TP at least `stopsLevel` points from the price (`/SymbolParams`). - Prefer the WebSocket (`/v1/stream`) over polling quotes or positions; REST is rate limited (40 burst, 20 requests per second per key). - Use the UTC fields (`...Utc`, `openTimestampUTC`); stream `time` fields are broker server time. - Use the classic endpoints (`/OrderSend`, `/OpenedOrders`, ...) for code that must run on both MT4 and MT5. - Never put an API key into browser or mobile code; issue an `accountScoped`, `readOnly` key for front ends. ## Docs (Markdown) - [Quickstart](https://www.metatraderapi.net/docs/quickstart.md): from zero to the first API call and the first order, with curl and Python - [Authentication](https://www.metatraderapi.net/docs/authentication.md): API keys, the account id, read-only and account-scoped keys - [Core concepts and glossary](https://www.metatraderapi.net/docs/concepts.md): account, seat, broker server, symbol, lot, point, magic number, hedging vs netting, MT4 vs MT5 - [Connecting accounts](https://www.metatraderapi.net/docs/accounts.md): connect an MT4/MT5 account, connection states, reconnects, private hosting - [Orders and positions](https://www.metatraderapi.net/docs/orders.md): market and pending orders, modify, close, safe retries with clientOrderId - [WebSocket streaming](https://www.metatraderapi.net/docs/streaming.md): quotes, candles, positions, orders, trades and heartbeats over one WebSocket - [Market data and history](https://www.metatraderapi.net/docs/market-data.md): quotes, symbols, sessions, price history, deal and position history - [Provisioning API](https://www.metatraderapi.net/docs/provisioning.md): create and remove seats and keys from your own backend - [Errors](https://www.metatraderapi.net/docs/errors.md): every error the API returns, with cause and fix - [Limits](https://www.metatraderapi.net/docs/limits.md): rate limits, timeouts, sizes, and what is not supported - [Testing](https://www.metatraderapi.net/docs/testing.md): demo accounts and how to test without risking money - [FAQ](https://www.metatraderapi.net/docs/faq.md): the questions developers ask most - [OpenAPI spec](https://www.metatraderapi.net/openapi.json): the classic REST endpoints (account, market data, history, trading) and the connection, demo, logs and EA routes with their parameters, machine-readable. The provisioning (/v1/seats, /v1/seat-capacity, /v1/balance), /v1/pricing-tiers, /news and WebSocket routes are documented in the Markdown pages above, not in the spec ## Optional - [Full docs in one file](https://www.metatraderapi.net/llms-full.txt): all pages above, concatenated - [HTML API reference](https://app.metatraderapi.net/docs) ## Key pages - [Homepage](https://www.metatraderapi.net/en/): product overview, architecture, and pricing. Available in 14 locales: en, es, pt, ru, ar, de, fr, nl, tr, cn, jp, hi, ur, he. - [Documentation](https://app.metatraderapi.net/docs): full REST and WebSocket API reference. - [FAQ](https://www.metatraderapi.net/en/faq/): 33 questions covering getting started, authentication, connecting accounts, trade execution, WebSocket streaming, pricing, security, troubleshooting, and legal. - [Broker Directory](https://www.metatraderapi.net/api-for/): API-compatibility and regulation data for 3,272 real forex/CFD brokers — regulator and licence status, max leverage, spread type, EA policy, negative balance protection, and supported account types where publicly verifiable. - [Blog](https://www.metatraderapi.net/blog/): 28 technical guides covering MetaTrader REST API integration, MetaApi alternatives, copy-trading architecture, prop-firm automation, and broker CRM integration. ## What it is and is not - MetaTrader API is an API/infrastructure provider, not a broker. It does not hold client funds, set spreads, or provide trading services. - MetaQuotes does not issue MT4 or MT5 API keys and publishes no public REST API for retail trading accounts. MQL5 runs inside the MetaTrader application; the Manager/Server API is licensed to brokers only. Any "MT5 API key" therefore comes from a third-party API provider. With MetaTrader API the key is generated in the dashboard for each connected account, and requests are authenticated with an `x-api-key` header plus a per-account UUID passed as `id`. - FIX API and a MetaTrader API are different layers. A FIX bridge or gateway (oneZero, PrimeXM, Centroid Solutions, FXCubic, Gold-i, Tools for Brokers, Takeprofit Tech, Brokeree Solutions and similar vendors) connects a broker's MT4/MT5 *server* to liquidity providers, and a broker-issued client FIX session normally bypasses MetaTrader entirely. Neither can read or trade an existing MT4/MT5 account. MetaTrader API operates at the account layer and is not a FIX venue, bridge vendor, or broker. - metatrader-vps.com is a separate VPS-hosting service, referenced on broker pages as a cross-sell for users who want to keep running MetaTrader themselves. It does not provide REST/WebSocket API access and is not part of the MetaTrader API product. ## Contact Support: support@metatraderapi.net · Telegram: https://t.me/apisupport_en?text=Hello%20I%20have%20a%20question%20regarding%20MetatraderAPI.net Human support: real people answer, 7 days a week; the first response usually comes within a few hours. Replies may be drafted with AI help and are always checked by a person. Status: https://status.metatraderapi.net/ (live uptime; Atom feed https://status.metatraderapi.net/feed.xml, JSON https://status.metatraderapi.net/status.json) Feature requests: https://feedback.metatraderapi.net/ (suggest and vote on what we build next) Support and account access: https://app.metatraderapi.net/ ## Guides - [Exness MT5 API: Connect Exness Accounts to REST & WebSocket](https://www.metatraderapi.net/blog/exness-mt5-api/): Connect Exness MT5 and MT4 accounts to a REST and WebSocket API: server names, symbol suffixes like XAUUSDm, cent accounts and common errors. With code. - [MT5 Manager API Alternative: Trade Accounts at Any Broker](https://www.metatraderapi.net/blog/mt5-manager-api-alternative/): The MT5 Manager API only works on one broker's server. Compare it with a client-side API that reads and trades accounts at any broker, and when each fits. - [Execute a Trading Signal on Hundreds of MT5 Accounts Safely](https://www.metatraderapi.net/blog/execute-trading-signal-multiple-mt5-accounts-api/): Fan one trading signal out to hundreds of MT5 accounts at different brokers: per-account keys, symbol mapping, lot sizing and retries that never duplicate. - [The MetaTrader REST and Web API: What Exists, What Doesn't](https://www.metatraderapi.net/blog/metatrader-rest-and-web-api/): Four things get called the MetaTrader API: MQL5, the Manager/Server API, the web platform and REST bridges. Who can get each, and which fits your build. - [How to Get an MT5 API Key (and Why MetaTrader Never Gives You One)](https://www.metatraderapi.net/blog/how-to-get-mt5-api-key/): MetaTrader 5 does not issue API keys. Where an MT5 API key actually comes from, how to get one in about ten minutes, and the first three calls to make. - [FIX API and MT4 Integration: Which Providers Actually Support It](https://www.metatraderapi.net/blog/fix-api-connectivity-mt4-mt5-bridges/): FIX API and MetaTrader bridges: who sells them, what they cost, which brokers offer FIX sessions, and why FIX cannot read your existing MT4/MT5 account. - [MetaApi Reviews: What Developers Should Check Before Building on a MetaTrader API](https://www.metatraderapi.net/blog/metaapi-reviews-complaints-trustpilot/): A fair look at MetaApi reviews, Trustpilot ratings and common support and reliability complaints, and what to check before choosing an MT4/MT5 API. - [MetaApi Python SDK Alternative: Connecting Python Apps to MT4/MT5](https://www.metatraderapi.net/blog/metaapi-python-sdk-alternative-mt4-mt5/): Looking for a MetaApi Python alternative? Drop heavy proprietary SDKs and connect your Python app to MT4/MT5 with standard REST and WebSockets. - [MetaApi Pricing Explained: What You Really Pay for MT4/MT5 API Access](https://www.metatraderapi.net/blog/metaapi-pricing-cost-comparison-mt4-mt5/): MetaApi pricing, account costs and hidden fees explained: when the model scales, when it gets expensive, and how it compares to alternatives. - [MetaApi Not Working? Common MT4/MT5 API Issues and When to Switch](https://www.metatraderapi.net/blog/metaapi-not-working-connection-issue-troubleshooting/): MetaApi not working or disconnecting? Fix MetaApi connection issues, WebSocket errors and API downtime with this guide before deciding to switch. - [MetaApi Node.js Alternative for MT4/MT5 SaaS Apps](https://www.metatraderapi.net/blog/metaapi-node-js-javascript-alternative-mt4-mt5/): Looking for a MetaApi Node.js alternative? Connect your JavaScript backend to MT4/MT5 with a standard REST API and WebSockets, no heavy SDKs. - [How to Migrate from MetaApi to MetaTrader API Without Rebuilding Your Whole App](https://www.metatraderapi.net/blog/migrate-from-metaapi-to-metatrader-api-mt4-mt5/): Step-by-step guide to migrating from MetaApi to MetaTrader API: map endpoints, handle authentication and switch your WebSockets smoothly. - [MetaApi WebSocket Alternative: Streaming MT4/MT5 Prices and Account Data](https://www.metatraderapi.net/blog/metaapi-websocket-alternative-mt4-mt5-streaming-api/): Looking for a MetaApi WebSocket alternative? Stream live MT4/MT5 prices, positions with live profit and order updates over one plain WebSocket, no SDK required. - [MetaApi vs Direct MetaTrader API: Which Setup Is Better for Your SaaS or Trading App?](https://www.metatraderapi.net/blog/metaapi-vs-direct-metatrader-mt5-api/): MetaApi vs a direct MetaTrader API: how an SDK-centred cloud service compares to plain REST and WebSocket calls on control, pricing and scalability. - [How to Connect MetaTrader 4 to Python (Without ZeroMQ or DLLs)](https://www.metatraderapi.net/blog/how-to-connect-metatrader-4-to-python-without-zeromq/): Connect MT4 to Python without ZeroMQ sockets, C++ DLLs or MetaTrader crashes. Execute trades and stream quotes through MetaTrader API. - [How to Build a Copy Trading Platform with MT5 REST API](https://www.metatraderapi.net/blog/how-to-build-a-copy-trading-platform-mt5-rest-api/): Build a copy trading platform on MT5 with a REST API and WebSocket: master detection, risk engine, follower execution and scaling, with real Python code. - [How to Become a Forex Signal Provider Without Writing a Single Line of MQL5](https://www.metatraderapi.net/blog/how-to-become-a-forex-signal-provider/): Become a MetaTrader signal provider with a REST API, no MQL5 needed: connect MT4/MT5, detect trades in real time and broadcast signals with Python. - [Best MetaApi CopyFactory Alternative for MT4/MT5 Copy Trading Apps](https://www.metatraderapi.net/blog/best-metaapi-copyfactory-alternative-mt4-mt5/): Looking for a MetaApi CopyFactory alternative? How to build a scalable MT4/MT5 copy trading API for order mirroring and multi-account management. - [Best MetaApi Alternatives for MT4/MT5: When to Switch and What to Look For](https://www.metatraderapi.net/blog/best-metaapi-alternatives-mt4-mt5/): A comprehensive buying guide comparing the best MetaApi alternatives for MT4/MT5, including FIX API, Manager API, custom EA bridges, and REST wrappers. - [MetaTrader API vs MetaApi: Which MetaTrader REST API Is Right for Your Project?](https://www.metatraderapi.net/blog/metatrader-api-vs-metaapi/): An honest comparison of MetaTrader API and MetaApi: pricing, architecture, developer experience, and which wins for copy trading, prop firms and SaaS. - [How to Build an AI Forex Trading Bot: A Step-by-Step Python and MT5 Guide](https://www.metatraderapi.net/blog/how-to-build-an-ai-forex-trading-bot/): Developer guide to a fully autonomous, multi-strategy AI forex trading bot built with Python, OpenAI and MetaTrader API's REST API. - [Forex Broker API Integration: A Complete Developer Guide](https://www.metatraderapi.net/blog/forex-broker-api-integration/): Everything a developer needs to know about integrating a forex broker backend with MetaTrader 4 and MetaTrader 5 via REST API and WebSocket. - [MetaTrader API CRM Integration for Brokers](https://www.metatraderapi.net/blog/metatrader-api-crm-salesforce-integration/): Design a MetaTrader API CRM integration for brokers: map account, connection and trading workflows to Salesforce or HubSpot objects, tickets and onboarding. - [Low-Latency MetaTrader Infrastructure for Brokers](https://www.metatraderapi.net/blog/low-latency-metatrader-infrastructure-brokers/): How brokers can shorten and observe the MetaTrader execution path with an API — and what that means for broker infrastructure design. - [Build Prop Firm Rule Enforcement on MetaTrader Accounts](https://www.metatraderapi.net/blog/build-prop-firm-rule-enforcement-metatrader-accounts/): A developer guide to implementing drawdown limits, daily loss caps, and challenge rules on MetaTrader accounts with MetaTrader API. - [MT5 API for Prop Trading Firms: Challenge Automation and Risk Workflows](https://www.metatraderapi.net/blog/mt5-api-for-prop-trading-firms/): How prop trading firms use an MT5 API for challenge account onboarding, connection checks, monitoring, evaluation workflows and operational control. - [How Brokers Automate Account Management with MetaTrader API](https://www.metatraderapi.net/blog/how-brokers-automate-account-management-with-metatrader-api/): Discover how retail brokers and prop firms use the MetaTrader API to automate account onboarding, monitoring dashboards, and CRM integration. - [Build a Reliable Forex & CFD Scalping Bot with MetaTrader API](https://www.metatraderapi.net/blog/build-reliable-forex-cfd-scalping-bot-metatrader-api/): Build a low-latency scalping bot with MetaTrader API's REST and WebSocket API: risk controls, order lifecycle and streaming quotes.