API documentation
Connect an MT4 or MT5 account, choose its access and make a read-only request. Start here, then use the console playground to explore the full reference.
Updated
On this page
What is MetaBridgeAPI?
MetaBridgeAPI is a hosted REST API for connecting applications to MetaTrader 4 and MetaTrader 5 broker accounts. It provides authenticated account data, market data and customer-directed trade requests, with server-sent events (SSE) for quote, order and profit updates. You do not need to run your own MetaTrader desktop terminal or VPS.
Use it to build account dashboards, trade-history reports or applications that send the trade requests you choose. MetaBridgeAPI is independent of MetaQuotes, is not a broker and does not provide investment advice. Your trading funds and positions remain with your broker. Read the service disclaimer.
MT4 and MT5 features
Both platforms support account data, trading and streaming. Read the connected account’s capabilities before choosing an operation.
| Feature | MT4 | MT5 |
|---|---|---|
| Account information, current margin and free margin | Yes | Yes |
| Symbols and quotes | Yes | Yes |
| Open orders and trade history | Yes | Yes |
| Market, limit and stop orders | Yes | Yes |
| Stop-limit orders | No | Yes |
| Modify, partial close, close and cancel | Yes | Yes |
| Quote, order and profit streams | Yes | Yes |
| Pre-trade margin estimate | Yes | Not currently offered |
| Price history | Count-based bars | Date-range, month and day reads |
| Symbol trading-session lookup | Not currently offered | Yes |
| Daily-profit statistics | Not currently offered | Yes |
Broker rules determine available instruments, trading hours, order acceptance and historical data. Historical queries return the data available from the broker for the requested window. An MT4 partial close can create a replacement ticket; use the returned remainingTicket for the position that remains.
Quote streams accept up to ten distinct broker symbols. Streams last up to ten minutes and do not replay missed events. Reconnect explicitly and refresh current state after a disconnect. See the MT4 API and MT5 API for platform details.
1. Connect your broker account
Create a MetaBridgeAPI account, confirm your email and create a workspace. Open Trading accounts and select the platform used by your broker account: MT4 or MT5.
Enter the login number, exact broker server name and trading password shown for that account. The trading password is different from your broker website password. Save the account, then select Connect. Saving stores the connection details; connecting authenticates with the broker.
2. Activate account access
In Billing, start a 14-day trial for one broker-verified demo account or purchase access for selected demo or live accounts. The trial starts when you activate it. Each owner can use one trial; creating another workspace does not restart it.
Paid plans provide 30 days of access after full payment is confirmed. Renewals are manual. A waiting invoice or return from checkout does not activate a plan. View current plans.
3. Create a scoped API key
In API keys, name the integration, select its permissions and choose the accounts it may access. Copy the full key when it is created, and store it in your server’s secret store.
| Permission | Use |
|---|---|
accounts:read | Account information and capabilities |
accounts:write | Save, connect and manage account records |
market:read | Symbols, quotes and price history |
trades:read | Orders, history and operation outcomes |
trades:write | Send, modify, close, cancel and batches |
streams:read | Quote, order and profit streams |
Keep the key out of browser bundles, URLs and logs. Rotation replaces the old key immediately. For a gradual migration, create and test a replacement before revoking the original.
4. Make a read-only request
The base URL is https://metabridgeapi.com/api/v1. Use the workspace UUID and account UUID shown in the console—not the broker login number. Set METABRIDGE_WORKSPACE_ID, METABRIDGE_ACCOUNT_ID and METABRIDGE_API_KEY in your server environment. This example requires accounts:read.
curl --fail-with-body \
"https://metabridgeapi.com/api/v1/organizations/$METABRIDGE_WORKSPACE_ID/accounts/$METABRIDGE_ACCOUNT_ID/summary" \
-H "Authorization: Bearer $METABRIDGE_API_KEY"Successful responses wrap the result in data. For a quote, use /quote?symbol=YOUR_BROKER_SYMBOL with market:read. Get the exact symbol from the account’s Symbols list.
Stream quotes, orders and profit
Streams use server-sent events over HTTP, with Bearer authentication and streams:read. Use an HTTP client that supports a streaming response and custom headers.
GET /organizations/{org}/accounts/{account}/quotes/stream?symbols=EURUSD
GET /organizations/{org}/accounts/{account}/orders/stream
GET /organizations/{org}/accounts/{account}/profits/streamQuote streams accept up to ten distinct broker symbols. Streams last up to ten minutes. Reconnect explicitly, refresh current state after a disconnect and do not assume missed events will replay. Read the Python streaming guide.
Distinguish accepted from executed
Trading uses POST /organizations/{org}/accounts/{account}/trades, a trades:write key, an Idempotency-Key header and a JSON body containing kind and request.
HTTP 202 means the API recorded an operation; it does not prove the broker executed an order. Read the operation status before acting again. Reuse the same key for the same request. Creating a new key after an uncertain result could create another trade.
Use demo accounts while developing. Broker rules determine allowed symbols, volume, prices, stops and trading hours. The console reference describes each supported operation and its request body.
Read the response before retrying
| Status | What to check |
|---|---|
| 400 | Request fields, platform, broker server or credentials |
| 401 | API key, expiry or console sign-in |
| 402 | Billing access for the selected account |
| 403 | Key permissions and permitted accounts |
| 409 | Connection state or an existing operation |
| 429 | Retry-After before sending another request |
| 502 / 503 | Connectivity; inspect trade status before retrying |
Errors include a request ID. Share that ID, the action and time with support; never send passwords or API keys. See the connection troubleshooting guide for setup failures.
Reference and downloads
- OpenAPI specification for API clients and developer tooling.
- Integration guide in Markdown for setup, authentication, requests and account access.
- Supported features in Markdown for MT4 and MT5 platform differences.
- Python account-read example for making an authenticated read-only request.
Use the console playground to explore the full reference and test requests without downloading a file. Contact MetaBridgeAPI Support for integration questions; never share passwords or API keys.