Quickstart

From an API key to live quotes in four steps.

Everything below uses one credential: your team's API key, which you can copy from Settings in the dashboard.

export API2TRADE_API_KEY="your-key"

1. Connect a trading account

Give the API your MetaTrader credentials and the server name exactly as your broker writes it in the account details email.

curl -X POST \
  -H "X-API-Key: $API2TRADE_API_KEY" \
  -H 'content-type: application/json' \
  -d '{
    "accountNumber": "1082118",
    "name": "Demo one",
    "type": "Metatrader 5",
    "accountPassword": "your-mt-password",
    "accountServerHost": "ICMarketsEU-Demo"
  }' \
  'https://api.api2trade.com/v2/accounts'

The response comes back immediately with "terminalStatus": "provisioning" and the account's id — a UUID. Every call from here on uses it.

Prefer clicking?

The dashboard does the same thing: Accounts → Add Account → API v2. The API Playground then lets you try every endpoint on this page without writing any code, and shows the matching curl for each one.

2. Wait for it to come up

A dedicated connection is set up for your account and logs in to your broker. That takes a few minutes. Poll until it settles:

curl -s -H "X-API-Key: $API2TRADE_API_KEY" \
  'https://api.api2trade.com/v2/accounts/YOUR_ACCOUNT_ID' \
  | grep -o '"terminalStatus":"[^"]*"'

ready means it is logged in and serving. error means it will not come up on its own, and terminalLastError says why — usually a wrong account number, password or server name. See Errors.

3. Call the account's own API

Each connected account gets its own base URL:

https://api.api2trade.com/v2/{account_id}/
Is it actually trading-ready?
curl -s -H "X-API-Key: $API2TRADE_API_KEY" \
  'https://api.api2trade.com/v2/YOUR_ACCOUNT_ID/status'

Check broker.connected and account.loggedIn before trusting any numbers — a connection that never logged in still answers 200, with zeros.

A quote
curl -s -H "X-API-Key: $API2TRADE_API_KEY" \
  'https://api.api2trade.com/v2/YOUR_ACCOUNT_ID/getQuote?symbol=EURUSD'
Balance and equity
curl -s -H "X-API-Key: $API2TRADE_API_KEY" \
  'https://api.api2trade.com/v2/YOUR_ACCOUNT_ID/AccountSummary'

The full list is under Trading API.

4. Stream instead of polling

Quotes, positions and trade events are all available on one socket, which is cheaper and faster than polling getQuote in a loop:

wss://api.api2trade.com/v2/{account_id}/ws?api_key=YOUR_API_KEY
{ "action": "subscribe", "topic": "prices", "symbol": "EURUSD" }

See WebSocket for every topic and the frame shapes.

What next