API v2 (beta) · MT5 · 3 operations ·
base URL https://cloud.mywebapi.com ·
OpenAPI v2 (JSON) ·
Redoc
Every call needs Authorization: Bearer $TOKEN — an OAuth 2.0 client-credentials token from
https://auth.cplugin.net/connect/token (scope webapi).
$TRADE_PLATFORM_ID is the id of a trade platform registered in Toolbox.
Sends a trade request to the trade server as a dealer and waits for the server answer.
Only dealer request types (200–255, the Dealer* actions) are accepted; any other
request type is rejected by the server with the corresponding platform error, which is
returned in the error envelope.
The call blocks while the dealer answer is awaited. When the answer does not arrive
before the server timeout, the platform error MT_RET_ERR_TIMEOUT is returned.
The response carries the request as the server processed it, including the assigned
request identifier and the resulting order and deal references.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform identifier (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
MT5Request (application/json) — Dealer request to send.
Credits or debits the balance of the account with the given login, creating a balance
deal on the server. When the request type is omitted the balance operation is used;
buy and sell types make no sense here. The comment is stored with the deal.
The operation is validated by the server against the standard credit and margin rules.
On success the response carries the identifier of the created deal; a rejection is
returned as the platform error that explains it.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform identifier (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.
Send a balance operation without the standard validation checks
POST /api/v2/MT5/{tradePlatform}/DealerBalanceRaw
Performs the same balance operation as the validated variant, but the trade server skips
the standard credit and margin checks. Intended for administrative corrections, where the
resulting account state is deliberately allowed to fall outside the usual limits.
On success the response carries the identifier of the created deal; a rejection is
returned as the platform error that explains it.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform identifier (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.
Read-only: the trade server does not let this value be changed. request result information
resultDealer
integer (int64), nullable
request result deal request dealer
resultDeal
integer (int64), nullable
Read-only: the trade server does not let this value be changed. request result deal
resultOrder
integer (int64), nullable
Read-only: the trade server does not let this value be changed. request result order
resultVolume
integer (int64), nullable
Read-only: the trade server does not let this value be changed. request result confirmed volume
resultPrice
number (double), nullable
Read-only: the trade server does not let this value be changed. request result confirmed price
resultDealerBid
number (double), nullable
Read-only: the trade server does not let this value be changed. request result dealer prices
resultDealerAsk
number (double), nullable
Read-only: the trade server does not let this value be changed.
resultDealerLast
number (double), nullable
Read-only: the trade server does not let this value be changed.
resultMarketBid
number (double), nullable
Read-only: the trade server does not let this value be changed. request result market prices
resultMarketAsk
number (double), nullable
Read-only: the trade server does not let this value be changed.
resultMarketLast
number (double), nullable
Read-only: the trade server does not let this value be changed.
resultComment
string, nullable
Read-only: the trade server does not let this value be changed. request result comment
externalAccount
string, nullable
external system trade account (exchange, ECN, etc)
idClient
integer (int32), nullable
Read-only: the trade server does not let this value be changed. client side request id
ip
string, nullable
source request ip
sourceLogin
integer (int64), nullable
source dealer login (for dealer transaction)
position
integer (int64), nullable
position ticket
positionBy
integer (int64), nullable
position ticket for close-by
positionExternalID
string, nullable
position ticket in external system (exchange, ECN, etc)
positionByExternalID
string, nullable
position ticket in external system (exchange, ECN, etc)
volumeExt
integer (int64), nullable
volume with extended accuracy, 1 lot = 100_000_000
resultVolumeExt
integer (int64), nullable
Read-only: the trade server does not let this value be changed. request result confirmed volume with extended accuracy
volumeCurrent
integer (int64), nullable
current order volume
volumeCurrentExt
integer (int64), nullable
current order volume
MT5RequestApiResponse
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). HTTP status is always 200.
v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.
if none specified - it will be Balance operation. Buy/Sell actions here - pointless.
comment
string, nullable
UInt64ApiResponse
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). HTTP status is always 200.
v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.
Flags: names of the set bits joined by ", " ("Close, Market"), "None" when none is set; a set bit without a name is "Bit<n>" (bit number). Bits: Close = 0x1, Market = 0x2, ChangedPrice = 0x4, ChangedTrigger = 0x8, ChangedSL = 0x10, ChangedTP = 0x20, ChangedExpType = 0x40, ChangedExpTime = 0x80, Expert = 0x100, Signal = 0x200, SkipMarginCheck = 0x400. Accepted on input, never written: All = Close, Market, ChangedPrice, ChangedTrigger, ChangedSL, ChangedTP, ChangedExpType, ChangedExpTime, Expert, Signal, SkipMarginCheck.
v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
Property
Type
Description
code
WebApiErrorCode
Stable transport-level error code.
managerCode
ResultCode
Raw MT4/MT5 manager result code, when the error came from the trading platform; otherwise null.
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.
Property
Type
Description
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.