MT Cloud

MT Cloud API

Build an MT5 workflow you can inspect.

Provision accounts, deploy hosted terminals, copy trades, read terminal state, and manage risk through a tenant-scoped HTTPS API.

Base URLhttps://api.mtcloudapi.com/api/v1Formatapplication/jsonPublic limit300 requests/minute

Start here

Quickstart

Create an account, copy the API key shown once, then use it to create an MT5 account record. The example below does not deploy or bill the terminal by itself.

1 · Create an account record
curl -X POST https://api.mtcloudapi.com/api/v1/accounts \
  -H "Authorization: Bearer $MT_CLOUD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "login": "5001234",
    "password": "your-mt5-password",
    "server": "Broker-Live",
    "platform": "mt5",
    "role": "master",
    "label": "Primary master",
    "accessMode": "full",
    "autoDeploy": false,
    "allowDirectTrading": false
  }'

Success

201 Created returns the saved account and a Location header.

Server discovery

202 Accepted can return an account plus broker-server search state. Inspect that state before deployment.

Next

Deploy the returned account ID, then poll connection status until the terminal is connected.

Access

Authentication & scopes

Send the key as a Bearer token on every protected request. Keys begin with mtc_; only their hash is stored and plaintext is shown once on create or rotate.

Authorization: Bearer mtc_your_key
ScopePurpose
accounts:readAccounts, terminal state, stats, equity, usage, events, and streams.
accounts:writeCreate, edit, deploy, undeploy, delete, and protect accounts.
relationships:readCopy relationships, strategies, risk state, and risk events.
relationships:writeCreate, update, delete, or protect copy relationships.
trade:read / trade:writeRead command outcomes / submit direct trade commands.
keys:manageList, create, rotate, and revoke API keys.
webhooks:manageList, create, remove, and replay webhook deliveries.

Account lifecycle

Accounts

An account record holds the encrypted MT5 credentials and operating choices. Creating a record does not necessarily mean the hosted terminal is deployed.

POST/accountsaccounts:write

Creates an MT5 account. Required: login, password, and server. Role is master or slave; access mode is full or investor.

201 account created202 server search pending409 account belongs to another tenant503 credential storage unavailable
GET/accountsaccounts:read

Lists account views for the current tenant.

PATCH/accounts/{id}accounts:write

Updates label, role, auto-deploy, access mode, and direct-trading permission.

DELETE/accounts/{id}accounts:write

Undeploys and permanently removes the account record. Confirm this action in your application.

Broker server lookup

Use GET /servers?q=xm for saved matches. If automatic detection cannot resolve the broker, the API also accepts an uploaded provisioning profile.

Hosted terminal

Deployment

2 · Deploy the account
curl -X POST \
  https://api.mtcloudapi.com/api/v1/accounts/$ACCOUNT_ID/deploy \
  -H "Authorization: Bearer $MT_CLOUD_API_KEY"

200 deployed

The response includes the action and resulting state.

202 searching

The broker server is still resolving. Respect the Retry-After header.

402 payment required

The balance does not cover one hour. Open the returned top-up URL, then deploy again. A deployed terminal costs $0.02 per hour.

403 verification required

Confirm the tenant email before the first deployment.

POST/accounts/{id}/undeployaccounts:write

Stops the hosted terminal but keeps the account record.

POST/accounts/{id}/redeployaccounts:write

Restarts a deployed terminal. Billing checks still apply.

GET/accounts/{id}/connection-statusaccounts:read

Returns connection state and the latest available heartbeat information.

Terminal snapshots

Account information, positions & history

Terminal endpoints require a synchronized snapshot. Responses include synchronization metadata where applicable; 409 terminal_not_synchronized means the terminal is not ready yet.

GET /accounts/{id}/account-informationBalance, equity, margin, currency, and account metadata.
GET /accounts/{id}/positionsOpen positions and synchronization state.
GET /accounts/{id}/ordersPending orders and synchronization state.
GET /accounts/{id}/dealsPaginated deals with date, ticket, and position filters.
GET /accounts/{id}/history-ordersPaginated historical orders.
GET /accounts/{id}/symbolsAvailable symbols, specifications, and latest ticks.

Scope: accounts:read

Realtime

Live stream

Open wss://api.mtcloudapi.com/api/v1/stream with the same API key. Server-side clients send the Authorization: Bearer header. Browser clients pass the key as a WebSocket subprotocol: new WebSocket(url, ["mtc", "mtc-key.mtc_..."]), which keeps it out of URLs and logs. The older ?api_key= query form still works but is deprecated. The first message is session. Then send commands as text frames.

{ "type": "sync", "accountId": "..." }
{ "type": "subscribeQuotes", "accountId": "...", "symbols": [] }
{ "type": "resume", "after": 120 }
  • sync returns snapshot with account information, positions, orders, and recent deals.
  • An empty symbols list subscribes to every quote. A list subscribes to those symbols only, up to 20.
  • Live frames use eventType: Snapshot, Quote, Heartbeat, Disconnected, plus trade and copy events. Each has sequence.
  • resume replays a short buffer. resyncRequired means call sync again.

Trade routing

Copy relationships

3 · Create a copy route
curl -X POST https://api.mtcloudapi.com/api/v1/relationships \
  -H "Authorization: Bearer $MT_CLOUD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "masterAccountId": "MASTER_UUID",
    "slaveAccountId": "SLAVE_UUID",
    "volumeMode": "multiplier",
    "volumeMultiplier": 1,
    "sideFilter": "all",
    "copyStops": true,
    "copyMode": "all",
    "unsubscribeAction": "leave"
  }'

Master and slave must be different accounts owned by the same tenant. Optional controls include fixed volume, symbol and magic filters, symbol mapping, reverse direction, leverage/SL filters, signal delay, and trading hours.

GET /relationshipsList routes with relationships:read.
PATCH /relationships/{id}Enable, pause, or update route settings.
DELETE /relationships/{id}Remove the route and apply unsubscribe behavior.
POST /strategiesCreate strategy metadata for a master account.
PUT /relationships/{id}/strategyAssign or clear a route strategy.
POST /signalsPush an idempotent external-strategy signal.

Measurement & protection

Analytics & risk

GET /accounts/{id}/statsTrades, win rate, profit factor, expectancy, drawdown, equity curve, and breakdowns.
GET /accounts/{id}/equityRecorded equity samples ordered by time.
PUT /relationships/{id}/riskRelationship-level daily, weekly, monthly, lifetime, drawdown, lot, and target limits.
GET /relationships/{id}/risk/eventsInspect recorded risk events for a route.
GET /accounts/{id}/riskAccount-level rules plus live status: status (active or paused), reason, pausedAt, equity, openPositions.
PUT /accounts/{id}/riskApply the same protection model at account level, plus equityFloor and equityFloorPercent.
POST /accounts/{id}/kill-switchDisable every copy route into the account, pause it, and close every open position now.
POST /accounts/{id}/risk/resetClear a pause and restart the measurement period. Routes stay disabled until you enable them.
POST /blackoutsCreate a symbol-specific blackout window.
{
  "dailyLoss": 500,
  "drawdownAmount": 1200,
  "maxLot": 1,
  "maxOpenLots": 3,
  "profitTarget": 2500,
  "equityFloor": 9500,
  "equityFloorPercent": 5
}

Equity kill switch

The equity floor is a hard stop at account level. equityFloor is an absolute equity in account currency; equityFloorPercent is a drop from the equity recorded when the account started copying. The hub checks connected accounts every few seconds, and the moment equity is under either floor it fires the same action as the manual kill switch: every copy route into the account is disabled, the account is marked paused with reason equity_floor or equity_floor_percent, and every open position and pending order is closed through the terminal. The pause also blocks new copies on the fast path until you call the reset endpoint.

curl -X POST https://api.mtcloudapi.com/api/v1/accounts/{id}/kill-switch \
  -H "Authorization: Bearer $MT_CLOUD_KEY" -H "Content-Type: application/json" \
  -d '{"closePositions": true, "reason": "manual_kill"}'

{ "accountId": "…", "status": "paused", "reason": "manual_kill",
  "relationshipsDisabled": 2, "closeCommands": 5, "equity": 9842.10 }

Set closePositions to false to pause copying without flattening. The call needs the accounts:write scope; reading GET /accounts/{id}/risk needs accounts:read. Every kill switch, whether manual or automatic, is recorded as a KillSwitch event with one KillSwitchClose or KillSwitchCancel event per ticket, so GET /events and webhooks show exactly what was closed.

Proof

Public status

GET /api/v1/status needs no API key and returns the numbers behind the status page: 30-day and 24-hour uptime, p50 and p95 copy latency over the last 24 hours, terminals connected, and trades copied. Latency is measured inside the hub from the moment a master trade event arrives until the slave command is on the wire (dispatch) and until the slave terminal acknowledges the fill (ack). Responses are cacheable for 60 seconds and allow cross-origin reads.

curl https://api.mtcloudapi.com/api/v1/status

{ "healthy": true,
  "uptime": { "percent30d": 99.98, "percent24h": 100, "minutesTracked30d": 43200, "trackingSince": "…" },
  "copyLatencyMs": { "dispatchP50": 4, "dispatchP95": 11, "ackP50": 92, "ackP95": 240, "samples24h": 318, "window": "24h" },
  "terminals": { "connected": 12, "deployed": 14 },
  "tradesCopied": { "last24h": 318, "last30d": 6210, "total": 48102 } }

Optional execution

Direct trading

Direct trading is available only when the account is not investor-only and allowDirectTrading is enabled. Every write requires an Idempotency-Key header.

Open a market order
curl -X POST https://api.mtcloudapi.com/api/v1/accounts/$ACCOUNT_ID/trade \
  -H "Authorization: Bearer $MT_CLOUD_TRADE_KEY" \
  -H "Idempotency-Key: order-2026-10-21-001" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "open",
    "symbol": "EURUSD",
    "side": "BUY",
    "orderType": "MARKET",
    "volume": 0.1
  }'

202 Accepted returns a command that is pending or sent. Poll GET /trade-commands/{commandId} with trade:read. Reusing an idempotency key with a different payload returns 409 idempotency_key_conflict.

Operations

API keys & webhooks

Key lifecycle

Use keys:manage to list, create, rotate, and revoke keys. A create request accepts a label, scopes, and optional future expiry. The plaintext key appears once.

  • GET /api-keys
  • POST /api-keys
  • POST /api-keys/{keyId}/rotate
  • DELETE /api-keys/{keyId}

Webhook lifecycle

Use webhooks:manage. The URL must be absolute HTTP(S); events can contain account, trade, and copy. Store the signing secret returned once.

  • GET /webhooks
  • POST /webhooks
  • DELETE /webhooks/{webhookId}
  • POST /webhooks/deliveries/{deliveryId}/replay

Reading safely

Pagination, filtering & synchronization

  • Deals and history orders: send cursor from the previous nextCursor; optional filters include from, to, ticket, positionId, and limit.
  • Tenant trades: including the cursor query returns the paged object with items and nextCursor.
  • Tenant events: pass the last event cursor to continue backwards through the timeline.
  • Terminal reads: inspect synchronization metadata and retry only when the terminal is connected and a snapshot is available.

Failure handling

Errors & safe retries

Non-success responses use one stable envelope. Log the request ID when contacting support.

{
  "error": {
    "code": "terminal_not_synchronized",
    "message": "The terminal has not synchronized yet.",
    "requestId": "0HN...",
    "details": null
  }
}
StatusMeaningClient action
400Invalid request or missing idempotency key.Fix the request; do not retry unchanged.
401Missing, invalid, expired, or revoked key.Use a valid server-side key.
402Deployment needs payment.Complete the returned invoice, then retry.
403Scope, verification, or direct-trading restriction.Change permission/state; do not loop.
404Tenant-scoped resource not found.Check the ID and tenant.
409State conflict, unsynchronized terminal, or reused idempotency key.Inspect the error code before retrying.
429Rate limit reached.Back off and retry after the indicated window.

Reference map

Endpoint index

This page explains common workflows. The machine-readable schemas, complete request models, and response definitions live in the OpenAPI explorer.

Accounts & terminal

GET/POST /accounts · GET/PATCH/DELETE /accounts/{id} · POST /accounts/{id}/deploy|undeploy|redeploy · GET /accounts/{id}/connection-status|account-information|positions|orders|deals|history-orders|symbols|stats|equity · GET /servers

Risk & kill switch

GET/PUT /accounts/{id}/risk · POST /accounts/{id}/risk/reset · POST /accounts/{id}/kill-switch · PUT /relationships/{id}/risk · POST /relationships/{id}/risk/reset · GET /relationships/{id}/risk/events

Copier & strategy

GET/POST /relationships · GET/PATCH/DELETE /relationships/{id} · relationship risk and strategy endpoints · GET/POST /strategies · POST /signals · POST /blackouts

Public (no key)

GET /api/v1/status · GET /healthz

Trading & activity

POST /accounts/{id}/trade · GET /trade-commands/{commandId} · GET /trades · GET /events · GET /stream

Developer management

API key create/list/rotate/revoke · webhook create/list/delete/replay · GET /usage · provisioning profile upload.

Need the exact schema?

Use the OpenAPI explorer as the canonical contract.

Open API explorer