REST API · Overview
A linear walk-through of the three flows every integration needs: get your accountId, list the symbols your broker exposes, and submit a trade. Everything is curl-able — copy a snippet, drop in your key, and you'll see a real broker round-trip on the other end.
Checklist
Four things to have on hand. The first three are configured from the dashboard; the last is the one URL you'll hit for every example below.
Headers, scopes, and limits
One bearer token per environment. The token grants a fixed set of scopes — read, market data, trade-send, history — and the API enforces them per route.
Authorization: Bearer tl_live_…. Keys carry scopes (traders:read, mt5:trade:send, etc.) — the scope a route needs is documented in the API reference.error.code = "rate_limited".POST /trades/send. A repeated key returns the original result; reusing a key with a different payload returns 409.{ requestId, data, meta? }. Paginated routes set meta.hasMore, meta.total, and echo limit / offset.tl_live_… tokens grant trading authority on every connected MT5 account. Store them server-side, rotate periodically from the dashboard, and never commit them to a repo or ship them in a browser bundle.Step 1
MT5 operation routes are scoped to a trader. Your tenant has one owner trader out of the box; sub-traders (covered below) each get their own. The same UUID is called accountId in MT5 operation URLs and traderId in trader payloads.
curl https://api.trading-layer.com/api/v1/tenant \
-H 'Authorization: Bearer tl_live_xxx'data.ownerAccount.accountId is the owner trader id. Use it as {accountId} for MT5 operation routes such as /api/v1/accounts/{accountId}/symbols. Live MT5 account details are returned by /api/v1/traders/{traderId}.Step 2
Symbol lists are broker-specific and read live from the connected MT5 terminal — so they live under the account, not at the tenant level. Filter by group, search by name, and paginate with limit / offset.
curl 'https://api.trading-layer.com/api/v1/accounts/0c2f7d1a-3c88-4f17-b0c4-b43187c93d9d/symbols?search=EURUSD&limit=5' \
-H 'Authorization: Bearer tl_live_xxx'20, max 1000. When meta.hasMore is true, advance offset by your limit to fetch the next page. Pass includeTotal=true if you need the full count for a UI.Step 3
Trade send accepts a high-level payload — kind, side, symbol, volume, plus optional stop-loss / take-profit — and normalizes it into MT5's request format on the server. Always include an Idempotency-Key: a network blip retried by your client must not create a duplicate order.
curl -X POST https://api.trading-layer.com/api/v1/accounts/0c2f7d1a-3c88-4f17-b0c4-b43187c93d9d/trades/send \
-H 'Authorization: Bearer tl_live_xxx' \
-H 'Idempotency-Key: trade-2026-05-08-eurusd-001' \
-H 'Content-Type: application/json' \
-d '{
"side": "buy",
"symbol": "EURUSD",
"volume": 0.1,
"stopLoss": 1.07,
"takeProfit": 1.10,
"deviation": 20
}'data.classification — done means filled, rejected means the broker refused (the retcode tells you why), placed / partial indicate a working pending or partial fill. Treat anything other than done as a state to handle.Multi-tenant
Your owner account is created automatically and represents your own MT5 connection. If you're routing trades for end-customers — copy-trading, signal subscribers, white-labels — create one trader per customer. Each trader gets a fresh traderId, which acts as accountId everywhere else in the API.
curl -X POST https://api.trading-layer.com/api/v1/traders \
-H 'Authorization: Bearer tl_live_xxx' \
-H 'Content-Type: application/json' \
-d '{
"externalTraderId": "customer-1001",
"displayName": "Jane Trader",
"metadata": { "segment": "vip" }
}'externalTraderId — send the same id again with updated fields and the trader is updated in place. Use whatever stable identifier you already have in your system (customer id, Telegram id, etc.).Keep going
Two natural next stops once the three flows above are working.
Browse the full Scalar-powered OpenAPI reference — search routes, inspect schemas, and try requests in-page once you've authenticated.
Read the guideTrade fills, trader lifecycle, and signal events are delivered to your endpoint with HMAC signatures and a delivery log. Wire one up before scaling polling.
Read the guide