Skip to content

REST API basics

The REST API listens on http://127.0.0.1:81 (port configurable). It follows the OpenAPI 3 standard — see the interactive reference or download openapi.yaml.

  • Read data with GET, change something (orders, subscriptions) with POST.
  • Parameters go in the query string: /v1/order?symbol=EURUSD&volume=0.01&type=ORDER_TYPE_BUY.
  • Only POST /v1/track/ohlc takes a JSON body.
  • Dates use YYYY.MM.DD HH:MI:SS (/ or - as separators also work), in the broker’s server time.
  • Timeframes use MT5 names: PERIOD_M1 … PERIOD_MN1.

Every reply is a JSON object that starts with MSG (the command name) and ends with:

Field Meaning
ERROR_ID 0 when MT5 processed the command successfully, otherwise an error code
ERROR_DESCRIPTION Human-readable description of the result

Trade replies also carry MT5’s RETCODE (for example 10009 = request completed). See Errors & return codes.

Method Path Command
GET /v1/quote Current price
POST /v1/order Send order
POST /v1/order/modify Modify order
POST /v1/order/close Close / delete order
GET /v1/order/list Open & pending orders
GET /v1/order/info One order
GET /v1/account Account information
GET /v1/symbol/list Symbol list
GET /v1/symbol/info Symbol details
GET /v1/terminal Terminal information
GET /v1/history/orders Trade history
GET /v1/history/prices Candle history
GET /v1/history/ticks Tick history
GET /v1/calendar Economic calendar
GET /v1/indicator/ma Moving average
GET /v1/indicator/atr Average true range
GET /v1/indicator/custom Custom indicator
POST /v1/track/prices Stream ticks
POST /v1/track/ohlc Stream OHLC bars
POST /v1/track/mbook Stream depth of market
POST /v1/track/orders Stream trade events
GET /v1/license License & plan limits

The API answers browser preflight requests, so web pages on your machine (and the interactive reference on this site) can call it directly.