Documentation

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.

01

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.

  1. 01 Pro plan or higher on your Trading Layer account — the public API is gated to paid plans.
  2. 02 An API key minted from the dashboard. Production keys are prefixed tl_live_ and shown exactly once on creation.
  3. 03 An MT5 account connected to your owner trader. Without a connected terminal, MT5 operation routes return runtime errors.
02

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 set meta.hasMore, meta.total, and echo limit / offset.
03

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'
04

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'
05

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
  }'
06

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" }
  }'
07

Keep going

What to read next.

Two natural next stops once the three flows above are working.

Reference

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 guide
Webhooks

Push 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