REST API · Overview
Go from API key to your first trade in five minutes.
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
Before you start.
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.
- 01 Pro plan or higher on your Trading Layer account — the public API is gated to paid plans.
- 02 An API key minted from the dashboard. Production keys are prefixed tl_live_ and shown exactly once on creation.
- 03 An MT5 account connected to your owner trader. Without a connected terminal, MT5 operation routes return runtime errors.
Headers, scopes, and limits
Authentication.
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 token on every request:
Authorization: Bearer tl_live_…. Keys carry scopes (traders:read,mt5:trade:send, etc.) — the scope a route needs is documented in the API reference. - Rate limit
- 120 requests per 60-second window per API key. Hitting the ceiling returns HTTP 429 with
error.code = "rate_limited". - Idempotency-Key
- Required on
POST /trades/send. A repeated key returns the original result; reusing a key with a different payload returns 409. - Response envelope
- Successful responses look like
{ requestId, data, meta? }. Paginated routes setmeta.hasMore,meta.total, and echolimit/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
Get your trader id.
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
List the symbols your broker exposes.
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
Send a trade.
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
Manage sub-traders.
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
What to read next.
Two natural next stops once the three flows above are working.
Every endpoint, request, and response.
Browse the full Scalar-powered OpenAPI reference — search routes, inspect schemas, and try requests in-page once you've authenticated.
Read the guidePush events instead of polling.
Trade 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