Guide for brokers & developers
MT5 Manager API vs Server API vs Gateway API vs Web API: which one does your project need?
MetaQuotes gives brokers four ways to build on MetaTrader 5. The choice decides where your code runs, what it can change, and what can go wrong. Here is what each API is for, and which combination a terminal, CRM, gateway, copy trading, or risk project needs.
The short answer
Use the Server API to change how the MT5 server itself behaves, the Manager API to connect back-office systems that manage accounts and follow trades in real time, the Web API for simpler HTTP integrations from websites and portals, and the Gateway API to connect MT5 to liquidity providers and price feeds. Most broker projects combine two or three of them.
| API | What it is | Where the code runs | Typical uses |
|---|---|---|---|
| Server API | Plugins the MT5 server loads | Inside the MT5 server process | Dynamic leverage, custom margin and risk checks, bonus logic, server-side copy trading |
| Manager API | A library for external manager applications | On your own servers, signed in as a manager account | CRM and trader's room sync, account and group automation, real-time trade and exposure feeds, reports |
| Web API | An HTTP interface to the MT5 server | Any backend that can make HTTPS requests | Account opening and balance operations from a website or portal, account reads |
| Gateway API | A library for gateways and data feeds | In a gateway or data feed module the MT5 server connects to | Liquidity provider and prime broker connections, custom price feeds, synthetic instruments |
Server API: plugins that change how MT5 behaves
A server plugin is a C++ library that the MetaTrader 5 server loads and calls on its own events — a trade request arriving, a deal being executed, an account's margin changing. Because it runs inside the server, a plugin can do what no outside application can: adjust leverage before a trade is checked, reject or modify a request, or apply custom margin rules to every account in a group.
- Dynamic leverage by exposure, position size, trading session, or scheduled news.
- Custom risk and margin rules per group, beyond MT5's built-in settings.
- Bonus and credit logic, including negative balance handling.
- Server-side copy trading, with the shortest delay between a provider's trade and the followers' trades.
That power comes with responsibility. A slow plugin slows every trade it touches, and a crashing plugin can take the server with it, so plugins have to be fast, defensive, and tested on a staging server with realistic load — and again on every new MT5 build before production. See MT5 plugin development.
Manager API: external systems that manage MT5
The Manager API is a library that external applications use to connect to the MetaTrader 5 server as a manager account, with exactly the permissions that account has been given. It is the workhorse of broker integrations: the CRM, the trader's room, the risk dashboard, and the back office all use it.
- Accounts and groups — open accounts, change groups and leverage, enable or block trading.
- Money operations — deposits, withdrawals, credit, and corrections, written to the account as balance deals.
- Real-time data — follow trades, positions, orders, and prices as they change, for exposure, copy trading, and prop engines.
- History and reports — deals, orders, and daily statements for reconciliation and BI.
Manager API applications are long-running services, so the engineering is in the connection handling: reconnecting cleanly, catching up on events missed during a disconnect, and keeping the number of manager connections to the server under control. Putting one API gateway in front of MT5 keeps those connections in one place for every app you run.
Web API: HTTP access for websites and portals
The MT5 Web API lets any backend that can make HTTPS requests work with the MetaTrader 5 server, with no native library to install. It is built for request–response tasks: opening an account from a registration form, posting a deposit from a payment callback, or reading an account's balance and positions for a portal page.
For following every trade and price change in real time, the Manager API is the better fit. A common pattern uses both: the Web API for simple operations from the website and CRM, and a Manager API service behind the trading terminal and risk systems.
Gateway API: connecting MT5 to liquidity and prices
The Gateway API is how MetaTrader 5 talks to the outside market. A gateway takes the orders MT5 routes externally to a liquidity provider, prime broker, or bridge, and returns fills and rejections as MT5 deals. A data feed brings prices into MT5 from an outside source.
- A client order reaches the MT5 server and matches a routing rule that sends it to a gateway.
- The gateway translates it into the provider's protocol — usually FIX 4.4 — with symbol, volume, and price mapped to the provider's conventions.
- The provider answers with an execution report: filled, partially filled, or rejected.
- The gateway turns that answer into an MT5 deal or a rejection, and the client sees the result in their terminal.
With one provider, a gateway can be all a broker needs. With several, aggregation, markups, and A-book/B-book routing usually move into a liquidity bridge that the gateway connects to. See MT5 gateway development.
Which MT5 API does your project need?
| Project | APIs it uses | Why |
|---|---|---|
| Web or mobile trading terminal | Manager API behind an API gateway; Web API for simple operations | Real-time quotes, positions, and orders for many clients through one controlled backend |
| Forex CRM and trader's room | Manager API or Web API | Account opening, deposits, withdrawals, and account data in the client portal |
| New liquidity provider | Gateway API | Orders out to the provider, fills back into MT5 |
| Custom price feed or synthetic instruments | Gateway API (data feed) | Prices into MT5 from your own sources |
| Dynamic leverage or custom margin rules | Server API | Has to act inside the server before a trade is checked |
| Copy trading, PAMM, or MAM | Server API, Manager API, or both | A plugin for the fastest copying on one server; a Manager API service across servers and platforms |
| Prop firm challenge engine | Manager API, plus a plugin where a rule must block trades instantly | Reads every trade and equity change in real time to evaluate rules |
| Risk and exposure dashboard | Manager API | Follows positions and deals across groups for the dealing desk |
| MCP server for AI assistants | Manager or Web API, through an API gateway | Gives assistants scoped, audited access to a client's own account |
| Client algo trading (EAs, scripts) | None of these — MQL5 or the MetaTrader 5 Python package | Runs in a client terminal, not on the broker's server |
Related pages: MT5 gateway development, copy trading software, prop firm software, broker risk management software, and MCP servers for brokers.
Who can use the MT5 server APIs
The server-side APIs are part of the MetaTrader 5 platform that brokers license from MetaQuotes, and their SDKs and documentation go to licensees rather than being published openly. The client-side tools — MQL5 and the MetaTrader 5 Python package — are public, but they run in a trading terminal and cannot manage a broker's server.
A broker on a white-label MT5 server — one operated by another company — can usually get a manager account for Manager API and Web API integrations. A plugin or a gateway runs on the server owner's infrastructure, so it needs the owner's approval and installation.
Whatever the API, build against the MT5 build your server runs and test each new build on staging first: MetaQuotes ended support for older MT4 and MT5 builds on 1 July 2025.
Sources: MetaQuotes — MetaTrader 5 for brokers · MQL5 documentation — MetaTrader 5 Python package · FX News Group — older MT4/MT5 builds cut off 1 July 2025
FAQ
What is the difference between the MT5 Manager API and the MT5 Web API?
Both let an outside application work with a MetaTrader 5 server as a manager account. The Manager API is a native library for long-running services that follow trades, positions, and prices in real time. The Web API is an HTTP interface for request–response tasks such as opening an account or posting a deposit from a website backend.
Which MT5 API do I need to build a web trading terminal?
Usually the Manager API, behind your own API gateway: the gateway streams quotes, positions, and order updates to every connected client over WebSocket and sends their orders to MT5. The Web API can handle simpler operations such as account opening. The terminal itself never connects to MT5 directly.
Can a white-label MT5 broker use plugins or the Gateway API?
Only with the server owner's approval. A white-label broker can usually get a manager account for Manager API and Web API integrations, but plugins and gateways run on the server owner's infrastructure, so the white-label provider has to approve and install them.
Does MetaTrader 5 have a REST API?
The closest is the Web API, an HTTP interface MetaQuotes describes as “used for platform integration with web resources and other services of the company”. It works as a manager account, so it is for a broker's backend, not for a browser or a mobile app, and it does not push live prices. Brokers who need a REST and WebSocket API for their own terminals and apps put an API gateway in front of the MT5 server.
Is the MetaTrader 5 Python package a broker API?
No. The MetaTrader5 Python package connects to a MetaTrader 5 terminal running on the same computer and trades from that terminal's client account. It is for traders and analysts. Broker systems use the server-side APIs: the Manager, Web, Server, and Gateway APIs.