CPlugin

MT4 v2 :: Trades

API v2 (current) · MT4 · 16 operations · base URL https://cloud.mywebapi.com · OpenAPI v2 (JSON) · Redoc

Every call needs Authorization: Bearer $TOKEN — an OAuth 2.0 client-credentials token (scope webapi). The token server belongs to the environment: for the Sandbox call https://pre.mywebapi.com and take the token from https://pre.auth.cplugin.net/connect/token; for Production take it from https://auth.cplugin.net/connect/token. Clients and tokens of the two are separate — a token from one answers 401 on the other. $TRADE_PLATFORM_ID is the id of a trade platform registered in Toolbox. A failed operation is also answered with HTTP 200: check error before using data. Access and transport failures use HTTP codes — see Errors.

Operations

List open trades (cached)

GET /api/v2/MT4/{tradePlatform}/TradesGet

Cached snapshot of all open trades on the platform, returned paginated. Sort key is the order ticket ascending. ?limit= caps page size; without it all open trades come back in one page.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes
limit query integer (int32) no Maximum number of items to return in one page. Omit to return all items in a single page. Maximum allowed value is 5000.
cursor query string no Opaque continuation token. Pass the value from the previous response's meta.paging.nextCursor to fetch the next page; omit for the first page. A token is accepted only by the call that issued it: a corrupt, truncated or foreign token answers a Validation error instead of restarting from the first page.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradesGet" \
  -H "Authorization: Bearer $TOKEN"

Get trade by ticket (cached)

GET /api/v2/MT4/{tradePlatform}/TradesGet/{ticket}

Open trade by ticket from the cached copy (dictionary lookup variant).

Counterpart to TradeRecordGet/{order} — both are cached reads, but the platform exposes two distinct call paths: TradeRecordGet uses a dedicated single-record method, while this endpoint looks the trade up in the open-trades dictionary. Behaviourally equivalent for open trades; TradeRecordGet can also resolve recently closed trades that linger in cache.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
ticket path integer (int32) yes Order ticket
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradesGet/$TICKET" \
  -H "Authorization: Bearer $TOKEN"

List trades by account (cached)

GET /api/v2/MT4/{tradePlatform}/TradesGetByLogin/{login}/{group}

Open trades for a single account from the cached copy.

Cached lookup, keyed by login + group. The group parameter is required because the platform organises trades by group internally — callers can fetch the group via UserRecordGet/{login} first. Empty list when the account has no open trades.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
login path integer (int32) yes Account login (positive integer)
group path string yes Account group name (max 16 chars)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradesGetByLogin/$LOGIN/$GROUP" \
  -H "Authorization: Bearer $TOKEN"

List trades by symbol (cached)

GET /api/v2/MT4/{tradePlatform}/TradesGetBySymbol

Open and pending orders for a specific symbol from the cached copy.

Cached snapshot — instant local lookup, no MT4 round-trip. Useful for per-instrument risk monitoring. Empty array is a legitimate result (no live trades on that symbol).

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
symbol query string no Symbol to filter by (e.g. EURUSD)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradesGetBySymbol" \
  -H "Authorization: Bearer $TOKEN"

List market trades (cached)

GET /api/v2/MT4/{tradePlatform}/TradesGetByMarket

All market-condition (non-pending) open trades from the cached copy.

Cached snapshot of every open market order across all accounts. Pending orders (limits/stops) are excluded — for those query per-symbol or per-account. Empty array is a legitimate result on idle servers.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradesGetByMarket" \
  -H "Authorization: Bearer $TOKEN"

Get trade record (cached)

GET /api/v2/MT4/{tradePlatform}/TradeRecordGet/{order}

Single trade record by order ticket from the cached copy.

Cached lookup of one order. Platform-level failures (unknown ticket, cache miss) come back with error.code and error.managerCode set, and data null — check error before using data.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
order path integer (int32) yes Order ticket number
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradeRecordGet/$ORDER" \
  -H "Authorization: Bearer $TOKEN"

Validate order stops

POST /api/v2/MT4/{tradePlatform}/TradeCheckStops

Validate an order's SL/TP/pending-open levels against the symbol's administrator-set stops_level.

The MT4 server verifies that the supplied SL/TP (and, for pending orders, the open price) sit at least stops_level away from the current market and that pending expiration is at least ten minutes in the future. Returns a bare boolean envelope: true when the platform's ResultCode is Ok.

Useful for client-side pre-flight before submitting a real TradeTransaction — saves a server round-trip for invalid orders.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
price query number (double) no Reference price for the validation (typically current bid/ask).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT4TradeTransaction (application/json) — Trade transaction shape — same shape as TradeTransaction.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradeCheckStops" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "tradeTransactionType": "", "tradeCommand": "", "tradeRequestFlags": "", "expiration": "2026-01-01T00:00:00Z", "order": 0, "orderBy": 0 }'

Roll back trade transaction

POST /api/v2/MT4/{tradePlatform}/TradeClearRollback/{order}

Roll back an in-flight trade transaction by ticket.

Cancels a pending trade transaction that the MT4 server is still holding in the rollback buffer (e.g. an instant-execution requote that has not yet been confirmed). Has no effect once the transaction has been committed; returns the the platform's ResultCode as part of the envelope on failure.

Idempotent on already-committed/already-rolled-back tickets.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
order path integer (int32) yes Order ticket (positive int) to roll back.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradeClearRollback/$ORDER" \
  -H "Authorization: Bearer $TOKEN"

Get trade record (live)

GET /api/v2/MT4/{tradePlatform}/TradeRecordRequest/{order}

Fresh-from-server fetch of a single trade record by ticket.

Server-side counterpart of TradeRecordGet. Where the live connection variant reads from local cache (may lag by milliseconds), this round- trips to the MT4 server every call — slower but authoritative. Useful for reconciliation, post-close ticket lookups (the cached copy may have flushed), or any flow where the caller can tolerate the latency cost in exchange for guaranteed freshness. Returns NotFound envelope when the ticket does not exist on the server.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
order path integer (int32) yes Order ticket number
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradeRecordRequest/$ORDER" \
  -H "Authorization: Bearer $TOKEN"

Query trades (live)

GET /api/v2/MT4/{tradePlatform}/TradesRequest

Broad Trade query that asks the trade server directly. Returns every trade visible to the authenticated manager, paged by ticket ascending.

Each call asks the trade server directly. Designed as the "scan from scratch" counterpart to the cached variants (TradesGetByMarket, TradesGetBySymbol): cached reads are instant but limited to currently-open trades visible to the live connection; this endpoint returns the full server-side set the manager can see. Heavy — paginate aggressively, prefer the cached variants when freshness is not critical.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
limit query integer (int32) no Maximum number of items to return in one page. Omit to return all items in a single page. Maximum allowed value is 5000.
cursor query string no Opaque continuation token. Pass the value from the previous response's meta.paging.nextCursor to fetch the next page; omit for the first page. A token is accepted only by the call that issued it: a corrupt, truncated or foreign token answers a Validation error instead of restarting from the first page.
group query string no Optional case-sensitive exact-match filter on account group.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradesRequest" \
  -H "Authorization: Bearer $TOKEN"

Modify trade record (admin)

POST /api/v2/MT4/{tradePlatform}/AdmTradeRecordModify/{ticket}

Admin direct edit of a single trade record: the record is read first, changed, and written back.

Low-level back-office override that writes directly to the trade record. For SL/TP edits prefer POST TradeTransaction with tradeTransactionType=BrModify — that route goes through the platform's audited path. Use this endpoint for manual accounting corrections (commission/storage/taxes/ profit, comment, magic) that the standard TradeTransaction path does not cover.

Only the fields present in the body are written: sl, tp, magic, comment, commission, commissionAgent, storage, profit and taxes. A field left out keeps the value the record has on the trade server, so a correction of one field does not touch the others. A body with none of them, and a non-finite number, are refused. Order, login, symbol, volume, prices, times and gateway fields are never taken from the body.

Idempotency-Key strongly recommended. A retried edit without it can land twice — usually harmless, but generates audit log noise.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
ticket path integer (int32) yes Order ticket (path)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT4TradeUpdate (application/json) — The fields to change; an omitted one keeps its server value. order is ignored — the path is the source of truth.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/AdmTradeRecordModify/$TICKET" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "order": 0, "sl": 0, "tp": 0, "magic": 0, "comment": "", "commission": 0 }'

Submit trade transaction

POST /api/v2/MT4/{tradePlatform}/TradeTransaction

Submit a trade transaction — open / modify / close / balance op.

POST mutator covering every platform trade operation through the single TradeTransaction entry point. The request body's tradeTransactionType + tradeCommand combination selects the actual operation — OpenMarket+Buy, PendingOpen+BuyLimit, CloseMarket+Sell, and the manager-side Br* types: BrModify (open price, SL, TP of an order), BrDelete, BrBalance+Balance or Credit (balance/credit operation on orderBy). The schema of the request body lists every accepted value.

An unknown tradeTransactionType, tradeCommand or tradeRequestFlags value is refused with error code Validation and the list of valid values; nothing is sent to the trading platform. Names are case-insensitive; the numeric value of a member is accepted too.

On success the response echoes the platform's mutated structure — most importantly the Order field, which the server assigns on Open operations and clients use to track the ticket afterwards.

Idempotency-Key is essentially mandatory. A retried trade transaction without the header can open a second position, double- close, or apply a balance op twice. With the header the second call returns the cached envelope from the first.

The trade server can answer "accepted", "in process" or "timeout" (TradeAccepted, TradeProcess, TradeTimeout), or a temporary condition — requote, price changed, broker busy, too many requests. Those are not plain failures: the request reached the server and the order may exist or appear later. They are reported as OutcomeUnknown with the raw code in error.managerCode, and the answer is not reused for a retry with the same idempotency key. Check the account's orders before repeating the trade.

A definite refusal (for example an invalid volume, no money or a closed market) is answered as MT4Error with the raw code in error.managerCode; nothing was executed, so the request may be repeated with the same idempotency key.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT4TradeTransaction (application/json) — Transaction request body

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradeTransaction" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "tradeTransactionType": "", "tradeCommand": "", "tradeRequestFlags": "", "expiration": "2026-01-01T00:00:00Z", "order": 0, "orderBy": 0 }'

Get trade records batch (live)

GET /api/v2/MT4/{tradePlatform}/TradeRecordsRequest

Trade records for a batch of order tickets — live round-trip.

Asks the trade server directly. Pass tickets as repeated query parameters: ?orders=12345&orders=67890. Server-side billing counts this as one Manager request regardless of array length — prefer this over looping single TradeRecordGet calls.

Returns the trade records the server has for the requested tickets. Order in the response is NOT guaranteed to match the request order; missing tickets are silently omitted (the envelope is not an error envelope in that case — match by order field on the client).

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
orders query integer (int32)[] no Order tickets to request (repeat the query parameter)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradeRecordsRequest" \
  -H "Authorization: Bearer $TOKEN"

List group trades (admin)

GET /api/v2/MT4/{tradePlatform}/AdmTradesRequest/{group}

All trades belonging to accounts in a given group (admin scope).

Asks the trade server directly. Returns trades for every account assigned to the given group. openOnly=true filters out closed trades on the server side. Pair with Idempotency-Key on retry — large groups can return substantial payloads.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
group path string yes Account group name (max 16 chars)
openOnly query boolean no If true, only open trades are returned. Defaults to true.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/AdmTradesRequest/$GROUP" \
  -H "Authorization: Bearer $TOKEN"

Delete trades (admin)

POST /api/v2/MT4/{tradePlatform}/AdmTradesDelete

Bulk-deletes a list of trade tickets (administrative scope). Used for cleanup after reconciliation mistakes, simulator state reset, or compliance-mandated removal.

The platform accepts a flat int[] of order tickets and a count; we mirror the existing batched-int pattern (repeat ?orders= per ticket — same convention as UserRecordsRequest's ?logins=). Empty arrays are rejected with Validation.

Destructive. Each ticket in the array is removed from the server's trade table; this is not reversible from the API side. Pair with Idempotency-Key so retries don't re-process partial failures.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
orders query integer (int32)[] no Order tickets to delete (repeat the query parameter — must be non-empty)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/AdmTradesDelete" \
  -H "Authorization: Bearer $TOKEN"

Start trade-records sync

POST /api/v2/MT4/{tradePlatform}/TradesSyncStart

Opens a server-side incremental sync session for trade records modified at or after timestamp.

Read the session with TradesSyncRead on the companion host. Pass timestamp=0 to request all trades. The timestamp is Unix epoch seconds (int32) in MT4 server-local time, not UTC.

There is one sync session per trade platform, shared by every caller of that platform: a second start replaces the first, and a read by one caller drains what another started. Serialize imports per trade platform.

Timeout: 60 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
timestamp query integer (int32) no Unix-epoch-second cutoff (server-local time; 0 = pull all)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 60 s (server maintenance). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradesSyncStart" \
  -H "Authorization: Bearer $TOKEN"

Schemas

Types the operations above take and return, with their first-level properties; * marks a required one. The full graph is in the OpenAPI specification.

MT4TradeListApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). A call that reaches an operation answers HTTP 200 — only transport failures (401, 403, 404, 400, 5xx) use other status codes.

PropertyTypeDescription
data MT4Trade[]
error ApiError v2 error body, present when a call failed even though it answered HTTP 200. Code is the stable error category. ManagerCode is the raw result code of the trade server on MT4 (null otherwise: on MT5 the result name is in Message). Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT4TradeApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). A call that reaches an operation answers HTTP 200 — only transport failures (401, 403, 404, 400, 5xx) use other status codes.

PropertyTypeDescription
data MT4Trade v2 record mirroring the platform's TradeRecord. The set of fields is curated for typical client use-cases — order monitoring, P&L reporting, trade history reconciliation. Internal padding/reserved/gateway-internal/raw underscore-prefixed fields are intentionally excluded, as are the raw conversion-rate and API data blocks (ConvRates, ConvReserv, APIData). Enum members (TradeCommand, TradeRecordState, TradeRecordReason, ActivationType) are returned as their names — e.g. "Buy" rather than 0.
error ApiError v2 error body, present when a call failed even though it answered HTTP 200. Code is the stable error category. ManagerCode is the raw result code of the trade server on MT4 (null otherwise: on MT5 the result name is in Message). Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT4TradeTransaction

v2 record for a trade transaction — input AND output of TradeTransaction. The platform's TradeTransInfo is in/out: the caller fills the request fields (operation type, command, symbol, volume, price), submits via POST, and the server populates the resulting Order id (for Open) or echoes the modified record (for Modify/Close). Enum fields (TradeTransactionType, TradeCommand, TradeRequestFlags) are plain strings. Clients submit the name (e.g. "Buy", "PendingOpen"); the response echoes the names back. Each field lists its valid names.

PropertyTypeDescription
tradeTransactionType string, nullable Transaction type (required). Manager-side operations use the Br* types, e.g. BrBalance with trade command Balance or Credit for a balance or credit operation. One of: PricesGet, PricesRequote, OpenInstant, OpenRequest, OpenMarket, PendingOpen, CloseInstant, CloseRequest, CloseMarket, Modify, Delete, CloseBy, CloseAll, BrOpen, BrClose, BrDelete, BrCloseBy, BrCloseAll, BrModify, BrActivate, BrComment, BrBalance. Case-insensitive; the numeric value is accepted too. Any other value is refused with error code Validation.
tradeCommand string, nullable Trade command. Empty means Buy. One of: Buy, Sell, BuyLimit, SellLimit, BuyStop, SellStop, Balance, Credit. Case-insensitive; the numeric value is accepted too. Any other value is refused with error code Validation.
tradeRequestFlags string, nullable Request flags (who placed the request). Empty means None. Flags, names joined by ", ": None, Signal, Expert, Gateway, Mobile, Web, API. Case-insensitive; numbers are accepted.
expiration string (date-time) Pending order expiration time. Default value means GTC.
order integer (int32) Order ticket. 0 on Open requests; server fills this on success.
orderBy integer (int32) Login (account number). Required for Balance/Credit operations.
symbol string, nullable Symbol (max 12 chars)
volume integer (int32) Volume in MT4 internal units. 1 lot = 100, so e.g. 250 = 2.5 lots.
price number (double) Order price
sl number (double) Stop-loss price (0 = none)
tp number (double) Take-profit price (0 = none)
ieDeviation integer (int32) Instant-execution price deviation tolerance (points)
comment string, nullable Free-form comment (broker-visible)
crc integer (int32) CRC for transaction integrity; usually 0 (server fills).

BooleanApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). A call that reaches an operation answers HTTP 200 — only transport failures (401, 403, 404, 400, 5xx) use other status codes.

PropertyTypeDescription
data boolean
error ApiError v2 error body, present when a call failed even though it answered HTTP 200. Code is the stable error category. ManagerCode is the raw result code of the trade server on MT4 (null otherwise: on MT5 the result name is in Message). Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT4TradeUpdate

input for the admin direct-edit endpoint AdmTradeRecordModify. Only the fields a back-office tool would legitimately need to adjust are exposed; everything else (order id, login, symbol, volume, open/close times, gateway internals, conversion rates, API data blobs) is preserved from the server-side read. Every member is optional: only the members present in the body are written, so an accounting correction of one field does not wipe the others. At least one member must be present, an empty body is refused. For typical stop-loss / take-profit edits prefer POST TradeTransaction with tradeTransactionType=BrModify — that goes through the platform's audited path. This endpoint is the low-level admin override for back-office corrections.

PropertyTypeDescription
order integer (int32) Order ticket to edit (path parameter is the source of truth)
sl number (double), nullable New stop-loss price (0 = remove SL)
tp number (double), nullable New take-profit price (0 = remove TP)
magic integer (int32), nullable Magic number / EA tag
comment string, nullable Comment (broker-visible)
commission number (double), nullable Manual commission override
commissionAgent number (double), nullable Manual agent-commission override
storage number (double), nullable Swap / storage override
profit number (double), nullable Profit override (back-office correction only)
taxes number (double), nullable Taxes override

MT4TradeTransactionApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). A call that reaches an operation answers HTTP 200 — only transport failures (401, 403, 404, 400, 5xx) use other status codes.

PropertyTypeDescription
data MT4TradeTransaction v2 record for a trade transaction — input AND output of TradeTransaction. The platform's TradeTransInfo is in/out: the caller fills the request fields (operation type, command, symbol, volume, price), submits via POST, and the server populates the resulting Order id (for Open) or echoes the modified record (for Modify/Close). Enum fields (TradeTransactionType, TradeCommand, TradeRequestFlags) are plain strings. Clients submit the name (e.g. "Buy", "PendingOpen"); the response echoes the names back. Each field lists its valid names.
error ApiError v2 error body, present when a call failed even though it answered HTTP 200. Code is the stable error category. ManagerCode is the raw result code of the trade server on MT4 (null otherwise: on MT5 the result name is in Message). Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT4Trade

v2 record mirroring the platform's TradeRecord. The set of fields is curated for typical client use-cases — order monitoring, P&L reporting, trade history reconciliation. Internal padding/reserved/gateway-internal/raw underscore-prefixed fields are intentionally excluded, as are the raw conversion-rate and API data blocks (ConvRates, ConvReserv, APIData). Enum members (TradeCommand, TradeRecordState, TradeRecordReason, ActivationType) are returned as their names — e.g. "Buy" rather than 0.

PropertyTypeDescription
order integer (int32) Order ticket number
login integer (int32) Owner account login
symbol string, nullable Symbol traded (e.g. EURUSD)
digits integer (int32) Symbol precision (number of digits after the decimal point)
tradeCommand TradeCommand Trade direction / pending order type (Buy/Sell/BuyLimit/etc)
volume integer (int32) Volume stored ×100 (e.g. 15 means 0.15 lots — see VolumeLots)
volumeLots number (double) Volume expressed in lots, for human consumption (Volume / 100)
tradeRecordState TradeRecordState Lifecycle state of the trade record
openPrice number (double) Price at which the order was opened
sl number (double) Stop-loss price (0 if unset)
tp number (double) Take-profit price (0 if unset)
openTime string (date-time) Order open timestamp
closeTime string (date-time) Order close timestamp (default for still-open orders)
closePrice number (double) Price at which the order was closed
commission number (double) Broker commission
commissionAgent number (double) Agent (IB) commission
storage number (double) Accumulated swap / rollover charges
profit number (double) Realised / floating profit
taxes number (double) Taxes withheld
magic integer (int32) Expert advisor magic number — client-supplied tag
comment string, nullable Free-form order comment
expiration string (date-time) Expiration timestamp for pending orders
tradeRecordReason TradeRecordReason Reason the trade record was created/modified (Client/Expert/Dealer/Stopout/etc)
activationType ActivationType How a pending order was activated
timeStamp string (date-time) Last modification timestamp of the trade record
marginRate number (double) Margin conversion rate (margin currency → deposit currency)

ApiError

v2 error body, present when a call failed even though it answered HTTP 200. Code is the stable error category. ManagerCode is the raw result code of the trade server on MT4 (null otherwise: on MT5 the result name is in Message). Message is a human-readable description.

PropertyTypeDescription
code WebApiErrorCode Stable transport-level error code.
managerCode ResultCode Raw MT4 result code when ApiError.Code is MT4Error; null otherwise. On MT5 the result name is in ApiError.Message.
message string, nullable Human-readable error description.

ApiMeta

Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

PropertyTypeDescription
activityId string, nullable W3C trace id of the request. Quote it when you contact support: it finds this exact call in the server logs.
paging PagingMeta Pagination info; present only on list responses, omitted otherwise.