API v2Trading API

Account

Account state, open trades, deal history.

Static identity and configuration of the connected account.

The account's who and how — name, login, broker company/server, currency, leverage, account type, margin mode (netting/hedging/ exchange), stop-out configuration, and trade permissions. These rarely change. For the live balance/equity/margin figures use /AccountSummary instead; for whether the account is logged in at all, use /status.

GET
/AccountInfo
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

Response Body

curl -X GET "https://api.api2trade.com/v2/{account_id}/AccountInfo"
{
  "company": "string",
  "currency": "string",
  "currencyDigits": 0,
  "fifoClose": true,
  "leverage": 0,
  "limitOrders": 0,
  "login": 0,
  "marginCallLevel": 0.1,
  "marginMode": "string",
  "marginSoMode": "string",
  "name": "string",
  "server": "string",
  "stopOutLevel": 0.1,
  "tradeAllowed": true,
  "tradeExpert": true,
  "type": "string"
}
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}

Snapshot of the connected trading account.

Returns the current balance, equity, margin, free margin, floating profit, leverage, account currency, broker name, server name, and trade-allowed flags. Reflects broker-side state at call time — no caching.

GET
/AccountSummary
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

Response Body

curl -X GET "https://api.api2trade.com/v2/{account_id}/AccountSummary"
{
  "balance": 0.1,
  "credit": 0.1,
  "currency": "string",
  "equity": 0.1,
  "freeMargin": 0.1,
  "leverage": 0,
  "margin": 0.1,
  "marginLevel": 0.1,
  "profit": 0.1,
  "type": "string"
}
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}

All open positions and active pending orders.

Returns one row per position (already-filled trade) and one row per pending order (limit / stop / stop-limit). Each row carries ticket, symbol, type (Buy/Sell/BuyLimit/…), volume (lots), open price, current price, SL/TP, swap, floating profit, comment, and magic number. Pending orders show their trigger price in the open- price field.

GET
/OpenedOrders
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

Response Body

curl -X GET "https://api.api2trade.com/v2/{account_id}/OpenedOrders"
[
  {
    "comment": "string",
    "currentPrice": 0.1,
    "kind": "string",
    "lots": 0.1,
    "magic": 0,
    "openPrice": 0.1,
    "openTime": "string",
    "profit": 0.1,
    "stopLoss": 0.1,
    "swap": 0.1,
    "symbol": "string",
    "takeProfit": 0.1,
    "ticket": 0,
    "type": "string"
  }
]
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}

Closed deals in a time range.

Returns DEAL entries (executions), not ORDER entries — pending orders that never filled don't appear here. Each row has ticket, position (the id shared by a round-trip's In/Out rows — the join key to the WS trade events and /PositionHistory), symbol, type (Buy/Sell), volume, price, sl/tp, profit, commission, swap, magic, comment, and the deal time. Omit both bounds to fetch all-time history.

GET
/OrderHistory
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

Query Parameters

from?string | null

Inclusive lower bound (broker server time). Accepts ISO-8601 (2026-01-01T00:00:00Z) or YYYY-MM-DD. Empty/absent → epoch.

to?string | null

Inclusive upper bound (broker server time). Same formats as from. Empty/absent → now.

Response Body

curl -X GET "https://api.api2trade.com/v2/{account_id}/OrderHistory?from=string&to=string"
[
  {
    "comment": "string",
    "commission": 0.1,
    "entry": "string",
    "magic": 0,
    "order": 0,
    "position": 0,
    "price": 0.1,
    "profit": 0.1,
    "sl": 0.1,
    "swap": 0.1,
    "symbol": "string",
    "ticket": 0,
    "time": "string",
    "tp": 0.1,
    "type": "string",
    "volume": 0.1
  }
]
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}

Active pending orders, with their expiry.

The pending rows of /OpenedOrders plus what copying an order needs: the stop-limit price, initial and remaining volume, and the expiry — its kind, server time and real UTC. The orders WebSocket topic opens with the same rows, then reports every change as an order event.

GET
/PendingOrders
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

Response Body

curl -X GET "https://api.api2trade.com/v2/{account_id}/PendingOrders"
[
  {
    "comment": "string",
    "expiration": "string",
    "expirationMode": "string",
    "expirationUtc": "string",
    "magic": 0,
    "price": 0.1,
    "sl": 0.1,
    "stopLimitPrice": 0.1,
    "symbol": "string",
    "ticket": 0,
    "time": "string",
    "timeUtc": "string",
    "tp": 0.1,
    "type": "string",
    "volume": 0.1,
    "volumeInitial": 0.1
  }
]
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}

Closed trades (round-trip positions) in a time window.

Unlike /OrderHistory — which is the raw deal log (one row per execution, two per round-trip) — this returns one row per closed position, the view a trading-history screen wants: positionId, symbol, type (Buy/Sell), volume, open/close price + time, sl/tp (the levels the position carried when it closed), and P/L split into profit (gross), swap, commission, and netProfit (the sum — what hit the balance). Reconstructed by grouping deals on the MT5 position id, so a position opened before from but closed inside the window is still returned complete. Deposits/withdrawals are excluded. The window filters on the close time; omit both bounds for all-time.

GET
/PositionHistory
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

Query Parameters

from?string | null

Inclusive lower bound (broker server time). Accepts ISO-8601 (2026-01-01T00:00:00Z) or YYYY-MM-DD. Empty/absent → epoch.

to?string | null

Inclusive upper bound (broker server time). Same formats as from. Empty/absent → now.

Response Body

curl -X GET "https://api.api2trade.com/v2/{account_id}/PositionHistory?from=string&to=string"
[
  {
    "closePrice": 0.1,
    "closeTime": "string",
    "comment": "string",
    "commission": 0.1,
    "magic": 0,
    "netProfit": 0.1,
    "openPrice": 0.1,
    "openTime": "string",
    "positionId": 0,
    "profit": 0.1,
    "sl": 0.1,
    "swap": 0.1,
    "symbol": "string",
    "tp": 0.1,
    "type": "string",
    "volume": 0.1
  }
]
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}

Broker server time and its offset from UTC.

Returns serverTime (ISO-8601 in broker server time — the trailing Z is stylistic, matching the rest of the API) and utcOffsetSeconds, computed as TimeTradeServer() - TimeGMT(). Use the offset to translate any of the other endpoints' Z-labelled timestamps to real UTC: utc = serverTime - utcOffsetSeconds.

Common values: 0 for a UTC broker, 7200 for a UTC+2 broker, 10800 during summer (UTC+3). Most MetaTrader brokers run on EET (UTC+2 / UTC+3 with DST).

GET
/ServerTimezone
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

Response Body

curl -X GET "https://api.api2trade.com/v2/{account_id}/ServerTimezone"
{
  "serverTime": "string",
  "utcOffsetSeconds": 0
}
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}