View as Markdown

API reference / Terminal routes and batch orders

MT5 terminal

Terminal routes and batch orders. Generated from the OpenAPI document the services export (/openapi.json).

Samples use the placeholders YOUR_API_KEY and YOUR_ACCOUNT_ID. Paste a sandbox key (twsk_…) to fill them in and to use Try it. It stays in this browser tab and is only sent to the sandbox, never to the live API.

Try it is off in this build: No sandbox URL is configured for this build of the docs.

GET /mt5/{account_id}/AccountInfo

GET /mt5/{account_id}/AccountInfo Auth: X-API-Key

Static account identity and configuration: name, login, server, company, currency, leverage, type, margin mode (Netting/Hedging/Exchange; always Hedging on MT4), stop-out configuration and trade permissions. A value the terminal does not report is null and named in unknownFields.

Parameters of GET /mt5/{account_id}/AccountInfo
ParameterInTypeDescription
account_id requiredpathstring

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/AccountInfo' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/AccountInfo",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/AccountInfo");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/AccountSummary

GET /mt5/{account_id}/AccountSummary Auth: X-API-Key

Live financial snapshot: balance, credit, floating profit, equity, margin, free margin, margin level, leverage, currency and account type (Demo/Contest/Real; Unknown if the terminal does not say).

Parameters of GET /mt5/{account_id}/AccountSummary
ParameterInTypeDescription
account_id requiredpathstring

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/AccountSummary' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/AccountSummary",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/AccountSummary");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

POST /mt5/{account_id}/CloseAll

POST /mt5/{account_id}/CloseAll Idempotency-Key Auth: X-API-Key

Close every open position, optionally only symbol and/or magic (magic: 0 means manually opened), and with deletePending: true also delete matching pending orders. Each ticket is its own audited, idempotent close (Idempotency-Key + #ticket); the whole reply is replayed for the same key. closed counts tickets now closed (including ones already gone), failed rejections, unknown lost replies.

Parameters of POST /mt5/{account_id}/CloseAll
ParameterInTypeDescription
account_id requiredpathstring
Idempotency-KeyheaderstringUnique per intended action. A retry with the same key and body returns the first result and never sends twice. Printable ASCII, at most 255.
X-ActorheaderstringWho is acting (a person, bot or service). Recorded in the audit log.
X-ReasonheaderstringWhy, in one sentence. Recorded in the audit log.

Request body object required

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X POST 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/CloseAll' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Idempotency-Key: my-request-1' \
  -H 'X-Actor: my-app' \
  -H 'X-Reason: why you are doing this' \
  -H 'Content-Type: application/json' \
  -d '{"symbol":"EURUSD"}'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "POST",
        "/mt5/YOUR_ACCOUNT_ID/CloseAll",
        json={"symbol": "EURUSD"},
        idempotency_key="my-request-1",
        actor="my-app",
        reason="why you are doing this",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("POST", "/mt5/YOUR_ACCOUNT_ID/CloseAll", {
  body: {"symbol":"EURUSD"},
  idempotencyKey: "my-request-1",
  actor: "my-app",
  reason: "why you are doing this",
});
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/OpenedOrders

GET /mt5/{account_id}/OpenedOrders Auth: X-API-Key

All open positions (kind: position) and pending orders (kind: pending). Pending rows show their trigger price in openPrice, the current market price on their side in currentPrice, and zero swap/profit.

Parameters of GET /mt5/{account_id}/OpenedOrders
ParameterInTypeDescription
account_id requiredpathstring
timeBasisquery"broker" | "utc"utc returns real UTC times with a Z. Default: the broker's wall clock, no Z.

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OpenedOrders' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/OpenedOrders",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/OpenedOrders");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/OrderCalcMargin

GET /mt5/{account_id}/OrderCalcMargin Auth: X-API-Key

Margin (account currency) needed to open volume lots of operation on symbol at price. Places nothing.

Parameters of GET /mt5/{account_id}/OrderCalcMargin
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredquerystringSymbol name exactly as /symbols lists it (brokers add suffixes).
operation requiredquerystringBuy, Sell, BuyLimit, SellLimit, BuyStop, SellStop, BuyStopLimit or SellStopLimit (case and separators do not matter).
volume requiredquerynumberVolume in lots.
price requiredquerynumberOpen price.

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderCalcMargin?symbol=EURUSD&operation=string&volume=0.01&price=1' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/OrderCalcMargin",
        params={"symbol": "EURUSD", "operation": "string", "volume": 0.01, "price": 1},
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/OrderCalcMargin", {
  params: {"symbol":"EURUSD","operation":"string","volume":0.01,"price":1},
});
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/OrderCalcProfit

GET /mt5/{account_id}/OrderCalcProfit Auth: X-API-Key

Projected P/L (account currency) of volume lots from priceOpen to priceClose; pending operations count by direction only. Places nothing.

Parameters of GET /mt5/{account_id}/OrderCalcProfit
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredquerystringSymbol name exactly as /symbols lists it (brokers add suffixes).
operation requiredquerystringBuy, Sell, BuyLimit, SellLimit, BuyStop, SellStop, BuyStopLimit or SellStopLimit (case and separators do not matter).
volume requiredquerynumberVolume in lots.
priceOpen requiredquerynumberOpen price.
priceClose requiredquerynumberClose price.

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderCalcProfit?symbol=EURUSD&operation=string&volume=0.01&priceOpen=1&priceClose=1' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/OrderCalcProfit",
        params={
            "symbol": "EURUSD",
            "operation": "string",
            "volume": 0.01,
            "priceOpen": 1,
            "priceClose": 1,
        },
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/OrderCalcProfit", {
  params: {
    "symbol": "EURUSD",
    "operation": "string",
    "volume": 0.01,
    "priceOpen": 1,
    "priceClose": 1
  },
});
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

POST /mt5/{account_id}/OrderClose

POST /mt5/{account_id}/OrderClose Idempotency-Key Auth: X-API-Key

Close a position (volume for a partial close; omitted or 0 closes it all) or delete a pending order: the ticket type decides. slippage in points (default 10). Closing a ticket that is already gone is outcome: no_change with isEffective: true and nothing sent, so a retried close is safe.

Parameters of POST /mt5/{account_id}/OrderClose
ParameterInTypeDescription
account_id requiredpathstring
Idempotency-KeyheaderstringUnique per intended action. A retry with the same key and body returns the first result and never sends twice. Printable ASCII, at most 255.
X-ActorheaderstringWho is acting (a person, bot or service). Recorded in the audit log.
X-ReasonheaderstringWhy, in one sentence. Recorded in the audit log.

Request body object required

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X POST 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderClose' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Idempotency-Key: my-request-1' \
  -H 'X-Actor: my-app' \
  -H 'X-Reason: why you are doing this' \
  -H 'Content-Type: application/json' \
  -d '{"ticket":123456}'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "POST",
        "/mt5/YOUR_ACCOUNT_ID/OrderClose",
        json={"ticket": 123456},
        idempotency_key="my-request-1",
        actor="my-app",
        reason="why you are doing this",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("POST", "/mt5/YOUR_ACCOUNT_ID/OrderClose", {
  body: {"ticket":123456},
  idempotencyKey: "my-request-1",
  actor: "my-app",
  reason: "why you are doing this",
});
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/OrderHistory

GET /mt5/{account_id}/OrderHistory Auth: X-API-Key

Closed deals (executions, not orders) in [from, to], broker server time, ISO-8601 or YYYY-MM-DD; absent bounds mean all time. Each row carries entry (In/Out/InOut/OutBy) and position (the round trip it belongs to).

Parameters of GET /mt5/{account_id}/OrderHistory
ParameterInTypeDescription
account_id requiredpathstring
fromquerystringStart, broker time, ISO-8601 or YYYY-MM-DD, inclusive. Absent: all time.
toquerystringEnd, broker time, ISO-8601 or YYYY-MM-DD, inclusive. Absent: now.
timeBasisquery"broker" | "utc"utc returns real UTC times with a Z. Default: the broker's wall clock, no Z.

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderHistory' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/OrderHistory",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/OrderHistory");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

POST /mt5/{account_id}/OrderModify

POST /mt5/{account_id}/OrderModify Idempotency-Key Auth: X-API-Key

Modify a position (stopLoss/takeProfit only) or a pending order (also price, stopLimitPrice, expiration). Omitted fields keep their current value; 0 clears a stop. An unknown ticket is a rejected result with retcode 0 and nothing is sent.

Parameters of POST /mt5/{account_id}/OrderModify
ParameterInTypeDescription
account_id requiredpathstring
Idempotency-KeyheaderstringUnique per intended action. A retry with the same key and body returns the first result and never sends twice. Printable ASCII, at most 255.
X-ActorheaderstringWho is acting (a person, bot or service). Recorded in the audit log.
X-ReasonheaderstringWhy, in one sentence. Recorded in the audit log.

Request body object required

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X POST 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderModify' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Idempotency-Key: my-request-1' \
  -H 'X-Actor: my-app' \
  -H 'X-Reason: why you are doing this' \
  -H 'Content-Type: application/json' \
  -d '{"ticket":123456,"stopLoss":1.09,"takeProfit":1.12}'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "POST",
        "/mt5/YOUR_ACCOUNT_ID/OrderModify",
        json={"ticket": 123456, "stopLoss": 1.09, "takeProfit": 1.12},
        idempotency_key="my-request-1",
        actor="my-app",
        reason="why you are doing this",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("POST", "/mt5/YOUR_ACCOUNT_ID/OrderModify", {
  body: {"ticket":123456,"stopLoss":1.09,"takeProfit":1.12},
  idempotencyKey: "my-request-1",
  actor: "my-app",
  reason: "why you are doing this",
});
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

POST /mt5/{account_id}/OrderSend

POST /mt5/{account_id}/OrderSend Idempotency-Key Auth: X-API-Key

Submit a market (Buy/Sell) or pending (*Limit/*Stop/*StopLimit) order. Body: symbol*, operation* (case/separator-insensitive), volume*, price (pending), stopLimitPrice (*StopLimit), stopLoss, takeProfit, slippage (points, default 10), expiration (pending; absent = good till cancelled), comment, expertId (magic). Unknown fields are refused; an unknown symbol is never sent (HTTP 500, reason symbol_not_found). A 200 only means the terminal answered: read success and outcome. Stop-limit orders on MT4 give not_supported_on_mt4. Stale quotes (BUG-063): a market order (Buy/Sell) on a symbol whose quote is not moving is refused before sending: 409 {"error": "quote_stale", "message", "sent": false, "symbol", "staleScope", "quietSeconds"}. The key is freed, so the same request can be retried once prices move. allowStaleQuote: true (Tickwire extension) sends it anyway. Pending orders, closes and modifies are never refused for a stale quote.

Parameters of POST /mt5/{account_id}/OrderSend
ParameterInTypeDescription
account_id requiredpathstring
Idempotency-KeyheaderstringUnique per intended action. A retry with the same key and body returns the first result and never sends twice. Printable ASCII, at most 255.
X-ActorheaderstringWho is acting (a person, bot or service). Recorded in the audit log.
X-ReasonheaderstringWhy, in one sentence. Recorded in the audit log.

Request body object required

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X POST 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/OrderSend' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Idempotency-Key: my-request-1' \
  -H 'X-Actor: my-app' \
  -H 'X-Reason: why you are doing this' \
  -H 'Content-Type: application/json' \
  -d '{"symbol":"EURUSD","operation":"Buy","volume":0.01}'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "POST",
        "/mt5/YOUR_ACCOUNT_ID/OrderSend",
        json={"symbol": "EURUSD", "operation": "Buy", "volume": 0.01},
        idempotency_key="my-request-1",
        actor="my-app",
        reason="why you are doing this",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("POST", "/mt5/YOUR_ACCOUNT_ID/OrderSend", {
  body: {"symbol":"EURUSD","operation":"Buy","volume":0.01},
  idempotencyKey: "my-request-1",
  actor: "my-app",
  reason: "why you are doing this",
});
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/PositionHistory

GET /mt5/{account_id}/PositionHistory Auth: X-API-Key

Closed positions closed within [from, to]: one row per round trip with volume-weighted open/close prices, summed profit/swap/commission and netProfit. A position still partly open is not listed.

Parameters of GET /mt5/{account_id}/PositionHistory
ParameterInTypeDescription
account_id requiredpathstring
fromquerystringStart, broker time, ISO-8601 or YYYY-MM-DD, inclusive. Absent: all time.
toquerystringEnd, broker time, ISO-8601 or YYYY-MM-DD, inclusive. Absent: now.
timeBasisquery"broker" | "utc"utc returns real UTC times with a Z. Default: the broker's wall clock, no Z.

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/PositionHistory' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/PositionHistory",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/PositionHistory");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/PriceHistory

GET /mt5/{account_id}/PriceHistory Auth: X-API-Key

OHLC bars for symbol and timeframe (M1, M5, M15, M30, H1, H4, D1, W1, MN1 or 5min/1h/1d; required), oldest first. With from (broker time): the bars in [from, to], and count keeps the first count. Without from: the latest count bars (default 1000), up to to when given. count is 1 to 10000; larger values are capped. Prices are rounded to the symbol's digits. spread is the bar's spread in points (null when the terminal does not report it). MT5-only timeframes on MT4 give not_supported_on_mt4.

Parameters of GET /mt5/{account_id}/PriceHistory
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredquerystringSymbol name exactly as /symbols lists it (brokers add suffixes).
timeframe requiredquerystringM1, M5, M15, M30, H1, H4, D1, W1, MN1 (or 1m, 5m, 1h, 1d). MT5-only timeframes give not_supported_on_mt4 on MT4.
fromquerystringStart, broker time, ISO-8601 or YYYY-MM-DD, inclusive. Absent: the latest count bars.
toquerystringEnd, broker time, ISO-8601 or YYYY-MM-DD, inclusive.
countqueryintegerMost bars to return, 1 to 10000 (larger values are capped). Default 1000 without from.
timeBasisquery"broker" | "utc"utc returns real UTC times with a Z. Default: the broker's wall clock, no Z.

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/PriceHistory?symbol=EURUSD&timeframe=2026-09-01T00%3A00%3A00.000' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/PriceHistory",
        params={"symbol": "EURUSD", "timeframe": "2026-09-01T00:00:00.000"},
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/PriceHistory", {
  params: {"symbol":"EURUSD","timeframe":"2026-09-01T00:00:00.000"},
});
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/ServerTimezone

GET /mt5/{account_id}/ServerTimezone Auth: X-API-Key

Broker server time and its offset from UTC: utc = serverTime - utcOffsetSeconds. utcOffsetSource says where the offset came from. It is the same value as offsetSource on /users/current/accounts/{id}/server-time (terminal, override, live, detected, stored), or estimated from a live broker clock. If no source can tell, the answer is 503 broker_offset_unknown, never a guess.

Parameters of GET /mt5/{account_id}/ServerTimezone
ParameterInTypeDescription
account_id requiredpathstring
timeBasisquery"broker" | "utc"utc returns real UTC times with a Z. Default: the broker's wall clock, no Z.

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/ServerTimezone' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/ServerTimezone",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/ServerTimezone");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/SymbolInfo

GET /mt5/{account_id}/SymbolInfo Auth: X-API-Key

Contract specification for symbol: digits, point, spread, contract size, tick size/value, volume limits, stops and freeze levels, trade mode, swaps, currencies, trade sessions (broker time), plus the current bid/ask. A value the terminal does not report is null, never a made-up 0.

Parameters of GET /mt5/{account_id}/SymbolInfo
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredquerystringSymbol name exactly as /symbols lists it (brokers add suffixes).

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/SymbolInfo?symbol=EURUSD' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/SymbolInfo",
        params={"symbol": "EURUSD"},
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/SymbolInfo", {
  params: {"symbol":"EURUSD"},
});
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/getQuote

GET /mt5/{account_id}/getQuote Auth: X-API-Key

Latest tick for symbol: bid, ask, last, volume, time (to the millisecond, in the chosen time basis) and brokerTime (the broker's wall clock, YYYY-MM-DD HH:mm:ss.SSS).

Parameters of GET /mt5/{account_id}/getQuote
ParameterInTypeDescription
account_id requiredpathstring
symbol requiredquerystringSymbol name exactly as /symbols lists it (brokers add suffixes).
timeBasisquery"broker" | "utc"utc returns real UTC times with a Z. Default: the broker's wall clock, no Z.

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/getQuote?symbol=EURUSD' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/getQuote",
        params={"symbol": "EURUSD"},
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/getQuote", {
  params: {"symbol":"EURUSD"},
});
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/healthz

GET /mt5/{account_id}/healthz Auth: X-API-Key

Readiness check: 200 once the terminal is ready, otherwise 503. The body holds no personal data: {status, terminal, broker, account}.

Parameters of GET /mt5/{account_id}/healthz
ParameterInTypeDescription
account_id requiredpathstring

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/healthz' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/healthz",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/healthz");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/livez

GET /mt5/{account_id}/livez Auth: X-API-Key

Liveness check: 200 while the terminal answered our last health check (whatever the broker link), otherwise 503. It reads the health poller's result (at most 60 seconds old) and never calls the terminal itself, so it answers at once (BUG-141). With no recent check it starts one in the background and waits at most a second for it; if that is not done, it answers 503 with status: "unknown" and null checks (no evidence either way: retry shortly). Body: {status, terminal, broker, account}.

Parameters of GET /mt5/{account_id}/livez
ParameterInTypeDescription
account_id requiredpathstring

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/livez' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/livez",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/livez");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/status

GET /mt5/{account_id}/status Auth: X-API-Key

Connection health in one call, always HTTP 200: ready (connected, logged in, ticks live), starting (not ready yet since the terminal started, within 5 minutes), degraded (broker link down or quotes frozen) or down (terminal not answering). tickwire carries our full ladder (healthy, degraded with reason code prices_stale, disconnected, down) with reasons and ages. The trade heartbeat age is null when it is not measured.

Parameters of GET /mt5/{account_id}/status
ParameterInTypeDescription
account_id requiredpathstring
timeBasisquery"broker" | "utc"utc returns real UTC times with a Z. Default: the broker's wall clock, no Z.

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/status' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/status",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/status");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.

GET /mt5/{account_id}/symbols

GET /mt5/{account_id}/symbols Auth: X-API-Key

Names of all symbols available on this terminal. Use them verbatim: brokers suffix symbols (EURUSD.sd, XAUUSDm).

Parameters of GET /mt5/{account_id}/symbols
ParameterInTypeDescription
account_id requiredpathstring

Responses

  • 200 Successful Response
  • 400 Bad request: a parameter, header or body field is not valid. Nothing was sent to the terminal. · ErrorEnvelope
  • 401 No credential was sent, or it is not valid or has expired. · ErrorEnvelope
  • 403 The credential is valid but may not do this, for example a read-only key on a change, or a token without the needed role or account. · ErrorEnvelope
  • 404 The account does not exist or this credential cannot see it, or the position, order or symbol in the path was not found. · ErrorEnvelope
  • 429 Too many requests. Wait the Retry-After seconds, then try again. · ErrorEnvelope
  • 503 The terminal is not connected or not synchronized yet. Wait the Retry-After seconds, then try again. · ErrorEnvelope

Errors (common for this kind of call; every error uses one envelope)

curl

curl -sS -X GET 'https://api.tickwire.io/mt5/YOUR_ACCOUNT_ID/symbols' \
  -H 'X-API-Key: YOUR_API_KEY'

Python

from tickwire import Tickwire

with Tickwire("https://api.tickwire.io", "YOUR_API_KEY") as tw:
    result = tw.request(
        "GET",
        "/mt5/YOUR_ACCOUNT_ID/symbols",
    )
    print(result)

TypeScript

import { TickwireClient } from "@tickwire/sdk";

const tw = new TickwireClient({ baseUrl: "https://api.tickwire.io", token: "YOUR_API_KEY" });
const result = await tw.request("GET", "/mt5/YOUR_ACCOUNT_ID/symbols");
console.log(result);
tw.close();
Try it in the sandbox

Try it is off in this build of the docs: no sandbox URL is configured. The samples above work against the sandbox with your sandbox key.