# MetaBridgeAPI integration guide

Read the guide inside the [MetaBridgeAPI console](https://metabridgeapi.com/app). No download or installation is required to explore your connected account.

## Start with your broker account

1. Sign up, confirm your email and create your workspace.
2. In Trading accounts, select MT4 or MT5 to match the broker account. Enter the exact server name shown in MetaTrader, login and trading password. Save the account, then select Connect. Use the trading password, not your broker website password. Advanced setup accepts a broker address and port.
3. In Billing, activate a 14-day trial for one demo account or purchase access for selected demo or live accounts.
4. Open Explore data on the connected account.

The demo trial starts when you activate it, lasts 14 days and covers one broker-confirmed demo account. Each owner can use one trial. Reconnecting or creating another workspace does not restart it. Trial expiry does not close positions at your broker.

## Try it without code

Explore data uses your signed-in console session to send real API requests:

- Details shows account information.
- Symbols lists names available at your broker. Use the exact name, including any suffix.
- Quote shows bid, ask and timestamp for the symbol you enter.
- Open orders and Closed orders show broker positions and history.
- The stream panel provides Quotes, Orders and Profit. Select Start to receive updates and Stop to end the stream. An empty position list is a valid result.

The console lets you check connectivity and data before building your integration. Explore data uses your console login, rather than a developer API key.

### Interactive API reference

Open API guide. Get started walks through connection, access and your first test. Playground lets you send real requests without writing code. Integration guide contains the request examples, permissions and error explanations.

In Playground, choose **Accounts & trading**, **Live streams**, or **Workspace management**. These choices stay visible, so you can move directly between tasks.

- Accounts & trading: paste your key into the API key field, choose Trading, Accounts, Market data or Orders & history, then open an endpoint, select Try it out, fill the fields and Execute. The workspace ID is pre-filled. The actual response and duration appear below the request.
- Live streams: uses the same key entered above. Enter the account ID, choose Quotes, Orders or Profit, and Start/Stop live updates. The key needs streams:read and access to that account.
- Workspace management: uses your app login for billing, keys and members. No API key needs to be copied. Workspace owners can use this view.

Requests stay on the deployment you are viewing. Your key remains only in the open playground; leaving it, refreshing or opening Workspace management clears it. Account data and trading never automatically borrow your app login.

Trading requests execute on the selected broker account. Check its ID, symbol, volume and prices before executing. Use a demo account for practice and a unique Idempotency-Key for each new trade. Read the returned operation before retrying an uncertain result.

## Create an API key

Open API keys, name the integration and select its required permissions. Select the account IDs it can access and an expiry if needed. Leaving account selection empty permits all accounts in the workspace.

| Permission | Purpose |
| --- | --- |
| accounts:read | Account listing, information and capabilities |
| accounts:write | Save, connect, disconnect and manage account records |
| market:read | Symbols, quotes, price history and supported market calculations |
| trades:read | Orders, history and trade outcomes |
| trades:write | Send, modify, close, cancel and explicit batches |
| streams:read | Quote, order and profit streams |

Copy the full key when it is created and keep it in your server's secret store. Never put it in public browser code, URLs or logs. Rotation immediately replaces the old key. To avoid an access gap, create and test a replacement before revoking the original.

## Send a request

Base URL: `https://metabridgeapi.com/api/v1`.

Use the workspace and account UUIDs shown in the console, rather than the broker login number. Send `Authorization: Bearer YOUR_API_KEY` in every authenticated request.

```http
GET /organizations/YOUR_ORGANIZATION_ID/accounts/YOUR_ACCOUNT_ID/quote?symbol=YOUR_BROKER_SYMBOL
Authorization: Bearer YOUR_API_KEY
```

Successful responses wrap the result in `data`. Example prices below are illustrative:

```json
{"data":{"symbol":"EURUSD","bid":1.0842,"ask":1.0844,"time":"2026-10-12T12:00:00Z"}}
```

Quotes require market:read. Account information requires accounts:read. Use the account's Symbols list to choose a symbol. Private responses are not cached.

## Trading

Both MT4 and MT5 support market, limit and stop orders. MT5 also supports stop-limit orders. Your broker determines available symbols, prices, volume rules and order acceptance. Paid access supports demo and live accounts.

Send a trading request to `POST /organizations/{org}/accounts/{account}/trades` with trades:write, an `Idempotency-Key` header and a JSON body containing `kind` and `request`. Actions include send, modify, close and cancel. See the [API schema](openapi.yaml) for fields and examples.

A 202 response records an operation. Read its status before taking further action; acceptance of the API request does not mean the broker executed the order. Reuse the same key for the same request. If an outcome is uncertain, inspect the saved operation before retrying. A new key could create another trade.

MT4 partial close can return a replacement ticket. Use `remainingTicket` to manage the remaining position. Send broker tickets as decimal strings. Account summaries provide current margin and free margin on both platforms. Pre-trade margin estimates are offered for MT4; MT5 pre-trade estimates are not currently offered.

## Streaming

Use an HTTP client supporting server-sent events and Bearer authentication. All stream routes require streams:read.

```http
GET /organizations/{org}/accounts/{account}/quotes/stream?symbols=YOUR_BROKER_SYMBOL
GET /organizations/{org}/accounts/{account}/orders/stream
GET /organizations/{org}/accounts/{account}/profits/stream
```

Quote events contain symbol, bid, ask and UTC time. Order and profit streams describe current positions. Quote streams accept up to ten distinct symbols. Streams last up to ten minutes; reconnect explicitly and refresh state after a disconnect. Missed events are not replayed. Use Start/Stop in Explore data to try streams without code.

## Plans and payment

| Plan | USD price per 30 days | Selected accounts |
| --- | --- | --- |
| Starter | $10 | 1 |
| Builder | $40 | Up to 5 |
| Scale | $120 | Up to 20 |
| Enterprise | Contact support | Custom |

Billing is managed by workspace owners in the console. Select the accounts to cover before creating a crypto invoice. Account selections are fixed for that invoice. Pay the exact amount using the network shown in checkout. Paid access starts when full payment is confirmed. A checkout return or a waiting invoice does not activate access. Renewals are manual; there are no automatic charges. Subscription payments purchase API software access; broker trading funds stay with your broker.

## Troubleshooting

| Response | Next step |
| --- | --- |
| 400 | Correct the request fields or broker symbol |
| 401 | Check the API key or sign in again |
| 402 | Activate access for the selected account in Billing |
| 403 | Check key permissions and selected accounts |
| 409 | Refresh connection state or inspect the existing operation |
| 429 | Wait for Retry-After before sending another request |
| 502 / 503 | Check connectivity and supported features; inspect trade status before retrying |

Contact [MetaBridgeAPI Support](mailto:support@mail.metabridgeapi.com) for help or Enterprise pricing. Errors include a request ID for support. Share that ID, action and time; never share API keys or passwords. Request pacing matters: respect Retry-After, keep HTTP connections open for repeated reads, and never automatically retry trading mutations with new keys.

OpenAPI is a machine-readable API reference for developer tools. Import the [schema](openapi.yaml) into an API client when you are ready to integrate. The in-app guide remains available without downloading anything.
