API v2 (beta) · MT4 · 6 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.
GET /api/v2/MT4/{tradePlatform}/PerformanceRequest
Time series of MT4 server resource snapshots — CPU, memory, network, sockets, connected-users — captured at server-defined cadence.
Manager-live read (round-trip to MT4 server). The MT4 server records
these snapshots periodically (typically every five minutes, broker-
configurable). Pass from as the earliest timestamp
to include; the server returns every snapshot at or after that point
up to the present, in ascending Ctm order. Useful for capacity
dashboards, oncall incident timelines, and load investigations. Pump
cache is NOT consulted — data reflects the authoritative server log.
Returns an empty list (Ok envelope, not an error) when the window
contains no snapshots.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
from
query
string (date-time)
no
Window start timestamp (UTC, ISO 8601). Snapshots with Ctm >= from are returned. Marshalled to the wrapper as __time32_t — values before 1970 or after 2038 are out of range.
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.
Closed-trade reports for a batch of account logins within a time window — the data set that drives broker financial reporting (PnL, commissions, taxes) and customer trade-history exports.
Manager-live read (round-trip to MT4 server). Pass logins as repeated
query parameters: ?logins=1001&logins=1002&logins=1003.
Server-side billing counts this as one Manager request regardless of
batch size — prefer one batched call over a per-login loop.
The wrapper returns a dictionary keyed by order ticket; the v2 envelope
flattens it to a list. Missing logins are silently omitted (no error
envelope). The optional name parameter selects a
server-defined report template — leave it null/empty to use the
default "RTL_report" template (closed trades within the window).
Pump cache is NOT consulted — data reflects authoritative server
history. Note: the wrapper comment warns that asking for a window
where the manager account lacks the Reports permission may
cause MT4 to drop the manager connection; this endpoint guards that
indirectly via the API-side ResourceAccess check, but a broker
that mis-configured the underlying manager rights can still observe
transient connection bounces.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
from
query
string (date-time)
no
Window start (UTC, ISO 8601 — required)
to
query
string (date-time)
no
Window end (UTC, ISO 8601 — required)
logins
query
integer (int32)[]
no
Account logins to include (repeat the query parameter for batch — must be non-empty)
name
query
string
no
Report template name (max 32 chars). Defaults to "RTL_report" when null or empty.
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.
GET /api/v2/MT4/{tradePlatform}/DailyReportsRequest
End-of-day balance/equity/PnL snapshots for a batch of account logins within a date window — the broker daily-report data set, flat shape (one row per (login, day) pair).
Manager-live read (round-trip to MT4 server). Pass logins as repeated
query parameters: ?logins=1001&logins=1002&logins=1003.
Server-side billing counts this as one Manager request regardless of
batch size — prefer one batched call over a per-login loop.
Each row carries its own Login field, so the flat shape is
joinable on the client side. The MT4 server returns dates in its
local time zone, not UTC — clients should treat Ctm as
"broker day boundary" and convert as appropriate.
Note: the wrapper warns that asking for a window where the manager
account lacks the Automatic server reports permission may
cause MT4 to drop the manager connection. The API-side
ResourceAccess check is an indirect guard; a broker that
mis-configured the underlying manager rights can still observe
transient connection bounces.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
from
query
string (date-time)
no
Window start (UTC, ISO 8601 — required)
to
query
string (date-time)
no
Window end (UTC, ISO 8601 — required)
logins
query
integer (int32)[]
no
Account logins to include (repeat the query parameter — must be non-empty)
name
query
string
no
Report template name (max 31 chars). Defaults to "RTL_dailyreport" when null or empty.
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.
GET /api/v2/MT4/{tradePlatform}/DailyReportsRequestEx
Same data set as DailyReportsRequest, but server-side grouped by login. Convenience shape for clients that pivot the data per-account (per-day rollups, account dashboards).
Manager-live read — single round-trip to MT4 server, identical billing
cost to DailyReportsRequest. The wrapper returns a sorted-list
of sorted-lists (by login, then by date); the v2 envelope flattens
the inner list to a chronologically-ordered MT4DailyReport
array, leaving the outer keying by login.
JSON shape: { "817542": [ ... ], "1001": [ ... ] } — JSON
object keys are strings, so int logins are stringified. Clients
should parse keys back to int if needed.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
from
query
string (date-time)
no
Window start (UTC, ISO 8601 — required)
to
query
string (date-time)
no
Window end (UTC, ISO 8601 — required)
logins
query
integer (int32)[]
no
Account logins to include (repeat the query parameter — must be non-empty)
name
query
string
no
Report template name (max 31 chars). Defaults to "RTL_dailyreport" when null or empty.
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.
Opens a server-side incremental sync session for daily reports modified at or after timestamp. Follow up with DailySyncRead to retrieve the snapshot.
Manager-live POST (modifies server-side session state). The two-call
cycle DailySyncStart → DailySyncRead is the broker pattern for
pulling only-changed-since-last-poll daily reports; pass
timestamp=0 to request all records.
timestamp is a Unix epoch second (int32) in MT4 server-local
time, not UTC. Wrapper marshals it directly to __time32_t —
pre-1970 / post-2038 values are out of range.
Returns a bare success envelope (no payload); the actual data comes
from a subsequent DailySyncRead call.
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.
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.
curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/DailySyncStart" \
-H "Authorization: Bearer $TOKEN"
Read daily-report sync
POST /api/v2/MT4/{tradePlatform}/DailySyncRead
Drains the daily-report snapshot opened by the most recent DailySyncStart call. Returns every record reserved by the server in that sync session.
Manager-live POST (consumes server-side session state — the snapshot
is dropped after a successful read). Empty payload ([]) is a
valid response when the snapshot held no records; this is NOT an
error.
Call DailySyncStart first; calling DailySyncRead without
a prior DailySyncStart may return an empty list or a non-Ok
managerAPICode depending on server build.
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
Name
In
Type
Required
Description
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: 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.
curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/DailySyncRead" \
-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.
MT4PerformanceListApiResponse
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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.
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). 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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.
MT4DailyReportListApiResponse
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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.
Int32MT4DailyReportListDictionaryApiResponse
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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.
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). 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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.
MT4Performance
v2 DTO for a single MT4 server performance snapshot — one row in the time-series that PerformanceRequest returns. Mirrors the wrapper's PerformanceInfo struct: a periodic resource sample (server-defined cadence, typically every 5 minutes) covering CPU, memory, network, socket count, and connected-user count at CPlugin.SaaSWebApps.WebAPI.DTOs.MT4.v2.MT4Performance.Ctm. Used for capacity planning, dashboards, and incident timelines. The wrapper's private underscore-prefixed unix-time field is masked by CPlugin.SaaSWebApps.WebAPI.DTOs.MT4.v2.MT4Performance.Ctm.
Property
Type
Description
ctm
string (date-time)
Snapshot timestamp (wrapper internal: __time32_t)
users
integer (int32)
Connected-users count at the snapshot
cpu
integer (int32)
CPU load, percent (0..100)
freeMem
integer (int32)
Free memory at the snapshot, in kilobytes
network
integer (int32)
Network throughput at the snapshot, in kilobytes per second
sockets
integer (int32)
Open-sockets count at the snapshot
ApiError
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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.
Property
Type
Description
activityId
string, nullable
W3C trace id for correlating this response in logs and tracing (Seq/SigNoz).
paging
PagingMeta
Pagination info; present only on list responses, omitted otherwise.
MT4Trade
v2 DTO mirroring the wrapper'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. Span<>-typed helpers (ConvRates, ConvReserv, APIData) are excluded because System.Text.Json cannot serialize ref-struct-backed properties — those would force callers onto a custom converter for marginal value. Enum members (TradeCommand, TradeRecordState, TradeRecordReason, ActivationType) serialize as string names via V2JsonContext UseStringEnumConverter — e.g. "Buy" rather than 0.
Property
Type
Description
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)
v2 DTO mirroring the wrapper's DailyReport: one end-of-day balance/equity/PnL snapshot for a single account. Used by the broker daily-report family (per-login query, bulk pull, incremental sync). Internal underscore-prefixed unix-time field, the Next pointer chain, and the 3-int Reserved padding are intentionally excluded. Note: Ctm is reported by the MT4 server in its local time zone, not UTC — clients should treat it as "broker day boundary" and convert as appropriate.
Property
Type
Description
login
integer (int32)
Account login the report belongs to
ctm
string (date-time)
Day boundary timestamp (wrapper internal: __time32_t, server-local time)
group
string, nullable
Trading group the account was in on that day
bank
string, nullable
Free-form bank/payment identifier recorded with the day's deposits
balancePrev
number (double)
Balance at the start of the reporting day
balance
number (double)
Balance at the end of the reporting day
deposit
number (double)
Net deposits credited within the day (positive = inflow)
credit
number (double)
Credit balance at end-of-day
profitClosed
number (double)
Closed-position profit/loss realised within the day
profit
number (double)
Floating (open-position) profit/loss at end-of-day