CPlugin

MT4 v2 :: Users

API v2 (beta) · MT4 · 13 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.

Operations

Get account (cached)

GET /api/v2/MT4/{tradePlatform}/UserRecordGet/{login}

Account record for a single login from the pump cache.

Pump-cached read of the wrapper's UserRecord, mapped to the v2 MT4User DTO. Secrets (passwords, OTP secret, API blob) are stripped at the mapper level — they cannot be exposed via this endpoint regardless of caller permissions. Returns NotFound envelope when the pump cache does not contain the requested login.

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)
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/UserRecordGet/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Get account (live)

GET /api/v2/MT4/{tradePlatform}/UserRecordRequest/{login}

Account record for a single login — live round-trip to MT4 server.

Manager variant — bypasses the pump cache and asks the MT4 server directly via UserRecordsRequest with a single-login array. Slower than UserRecordGet but guarantees fresh data (just changed group, balance fix, etc). Same curated DTO, same security guarantees — passwords/OTP/API blob never cross the boundary.

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)
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/UserRecordRequest/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Get accounts batch (live)

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

Account records for a list of logins — live round-trip to MT4 server.

Manager batch variant. Pass logins as repeated query parameters: ?logins=1001&logins=1002&logins=1003. Server-side billing counts this as one Manager request regardless of the array length — prefer batch over a loop of single-login calls.

Order in the response is not guaranteed to match the request — the wrapper returns a dictionary. Missing logins are silently omitted; the envelope is not an error envelope in that case.

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)
logins query integer (int32)[] no Account logins to request (repeat the query param)
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/UserRecordsRequest" \
  -H "Authorization: Bearer $TOKEN"

Check account balance

GET /api/v2/MT4/{tradePlatform}/AdmBalanceCheck/{login}

Admin balance integrity check for a single account.

Manager (live) call. Returns the difference between the recorded account balance and what the MT4 server recomputes from closed orders + balance operations. diff = 0 → balance is intact; non-zero → admin tooling can run AdmBalanceFix to recompute (forthcoming Wave 3 endpoint).

Read-only operation despite the wrapper's "Adm" prefix (the prefix signals the elevated authorization requirement, not a write side effect).

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)
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/AdmBalanceCheck/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Check account balances (batch)

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

Admin balance integrity check for a batch of accounts.

Same semantics as the single-login variant but takes a list of logins via repeated query parameters: ?logins=1001&logins=1002. One billed Manager request regardless of the array length. The response list contains entries only for accounts the server flagged with a non-zero diff — clean accounts are silently omitted. Clients should treat "missing from response" as "diff = 0".

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)
logins query integer (int32)[] no Account logins (repeat 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/AdmBalanceCheck" \
  -H "Authorization: Bearer $TOKEN"

Fix account balances

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

Admin balance fix — recompute balances for the given logins.

POST mutator. Asks MT4 server to take the diffs reported by AdmBalanceCheck and write them onto the accounts. Empty body — the logins are submitted as repeated query parameters (?logins=1001&logins=1002) to keep the URL shape parallel with the read variant and avoid the awkward "POST with int[] body" pattern.

This DOES modify account balances. Pair every retry with an Idempotency-Key header; otherwise a retried fix can double- apply on an account whose original fix happened to land but whose response was lost on the wire.

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)
logins query integer (int32)[] no Account logins to fix (repeat 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: 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/AdmBalanceFix" \
  -H "Authorization: Bearer $TOKEN"

List accounts (live)

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

Manager (live) call returning a paged list of every account on the platform. When ?limit= is omitted the response contains all users in one page (back-compat). Set ?limit=N to bound page size; the response's paging.nextCursor drives the next call.

Wrapper-side this still fetches the full users dictionary — paging reduces only the wire payload, not MT4 server load. Items are sorted by login ascending; pages are stable across concurrent inserts as long as the new login is greater than the previous page's last login.

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.
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/UsersRequest" \
  -H "Authorization: Bearer $TOKEN"

Create account

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

Create a new account — Type 1 mutator.

POST mutator. Pass the full MT4UserCreate DTO. Set Login = 0 to let MT4 server assign the next free id, or request a specific id by setting Login > 0 (the server rejects collisions with an MT4 error envelope).

The wrapper accepts the account with empty password bytes; clients MUST follow up with POST UserPasswordSet/{login} before the account is usable.

Idempotency-Key strongly recommended — a retried create without it can land twice when the original response was lost on the wire, burning a second login id from the broker's sequence.

Timeout: 15 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: 15 s (change). 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

MT4UserCreate (application/json) — New account fields. Login=0 for server-assigned id.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/UserRecordNew" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "login": 0, "group": "", "name": "", "externalId": "", "status": "", "country": "" }'

Update account

POST /api/v2/MT4/{tradePlatform}/UserRecordUpdate/{login}

Update an account record — Type 1 mutator with secret-preservation read.

Surface-level Type 1 semantics: client submits the full MT4UserUpdate DTO and the server writes it back. Implementation requires an extra read step because the wrapper UserRecord struct contains secret/computed/read-only fields the v2 input DTO deliberately omits (Password, OTPSecret, LastDate, etc.). Without the read step those would be zeroed out by the write.

Flow:

  • Fetch the existing record via UserRecordsRequest (live, not pump cache).

  • Apply the DTO over the in-memory record using ApplyTo. Secrets and read-only fields are [MapperIgnoreTarget]'d so they survive.

  • Write the modified record back via UserRecordUpdate.

This is NOT Type 2. Type 2 mutators (single-field) are deferred to a later release and will accept just the field name + value, doing the read-modify-write entirely server-side. Both flows happen to use the same read-modify-write structure on the implementation side — the difference is what the client submits.

Idempotency-Key is strongly recommended; without it a retried update risks silently overwriting concurrent edits that happened between the original send and the retry.

Timeout: 15 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)
login path integer (int32) yes Account login (positive integer)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 15 s (change). 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

MT4UserUpdate (application/json) — Replacement fields. Omitted-from-DTO fields are preserved server-side.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/UserRecordUpdate/$LOGIN" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "group": "", "name": "", "externalId": "", "status": "", "country": "", "city": "" }'

Patch account

PATCH /api/v2/MT4/{tradePlatform}/UserRecord/{login}

Type 2 mutator — partial update of a user record. Client sends a JSON object containing only the fields to change; the server reads the current record live from MT4 (Manager, not pump), overlays the patch, and writes back. Echoes the merged record.

Unknown keys in the patch body are silently ignored (forwards-compat). Field-level validation is delegated to MT4 server — invalid values surface as MT4Error envelopes. Secret-preservation and computed-field protection are handled by the existing Type 1 ApplyTo mapper's ignore list.

Timeout: 15 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)
login path integer (int32) yes Account login (immutable identity)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 15 s (change). 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

object (application/json, required) — JSON Merge Patch: an object with only the fields to change.

Responses

Example

curl -X PATCH "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/UserRecord/$LOGIN" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

List group accounts (admin)

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

All user accounts in a given group (admin scope) — the safe variant that honors permission checks server-side.

Manager (live) call. Returns the curated MT4User projection for every account in the specified group. The wrapper's "Safe" suffix indicates it runs through RunSafe with the Admin rights guard — a manager lacking that permission receives a sensible error rather than a connection drop.

Comma-separated group lists are accepted by the wrapper (it strips commas and trims whitespace internally); the simplest call pattern is a single group name. Large groups may return substantial payloads — pair with Idempotency-Key on retry.

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)
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/AdmUsersRequestSafe/$GROUP" \
  -H "Authorization: Bearer $TOKEN"

Start user-records sync

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

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

Manager-live POST (modifies server-side session state). The wrapper supports a follow-up UsersSyncRead call that drains the snapshot, but the read-side endpoint is currently deferred under wine x64 (see deferral note above this method). Pass timestamp=0 to request all user records.

timestamp is Unix epoch seconds (int32) in MT4 server-local time, not UTC. Returns a bare success envelope.

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/UsersSyncStart" \
  -H "Authorization: Bearer $TOKEN"

Bulk account operation

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

Bulk operation on a list of account logins — change group, leverage, enable/disable, or delete in a single Manager round-trip.

Manager (live) call. Wraps UsersGroupOp(GroupCommandInfo, ICollection<int>). The body specifies the command and its parameter (NewGroup for SetGroup, Leverage for Leverage; both ignored for Delete/Enable/ Disable) plus the list of target logins. The wrapper auto-fills the internal Len field from the logins array — clients do not set it.

Wine x64 safe: the wrapper uses AllocArraySafe on the int login array (single contiguous pack, no UnpackObject loop) and AllocSafe on the GroupCommandInfo struct.

Requires Manager or Administrator access rights on the manager account; the wrapper enforces this server-side. Idempotency-Key strongly recommended — bulk Delete / SetGroup operations are destructive on customer-visible state.

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)
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.

Request body

MT4UsersGroupOp (application/json) — Operation envelope (Command, NewGroup/Leverage, Logins).

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/UsersGroupOp" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "command": "", "newGroup": "", "leverage": 0, "logins": [0] }'

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.

MT4UserApiResponse

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.

PropertyTypeDescription
data MT4User v2 DTO describing a trading account. Curated subset of the wrapper's UserRecord — exposes identity, contact, financial and flag fields that callers actually need. Deliberately omitted from v2 (vs v1's full UserRecord shape): * Password / PasswordInvestor / PasswordPhone / OtpSecret / ApiData / SecureReserved — credentials and secrets must never cross the v2 boundary regardless of access level. * Unused / Reserved2 / EnableReserved / TimeStamp — wrapper bookkeeping with no caller-visible semantics. Account flags are exposed as a single CPlugin.SaaSWebApps.WebAPI.DTOs.MT4.v2.MT4User.EnableFlags bitfield (the wrapper's native representation). Bit semantics are documented under that property — splitting it into separate booleans would hide the fact that MetaQuotes occasionally reuses bit positions across builds.
error 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.
meta 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.

MT4UserListApiResponse

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.

PropertyTypeDescription
data MT4User[]
error 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.
meta 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.

MT4BalanceDiffApiResponse

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.

PropertyTypeDescription
data MT4BalanceDiff v2 DTO returned by AdmBalanceCheck. Reports the difference between the account's recorded balance and what the MT4 server recomputes from closed orders + balance operations. Diff = 0 means the integrity check passed; non-zero means the recorded balance has drifted and would be set to recorded + Diff if AdmBalanceFix ran.
error 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.
meta 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.

MT4BalanceDiffListApiResponse

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.

PropertyTypeDescription
data MT4BalanceDiff[]
error 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.
meta 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.

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.

PropertyTypeDescription
data boolean
error 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.
meta 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.

MT4UserCreate

Type 1 mutator input — full create shape for UserRecordNew. Same writable fields as CPlugin.SaaSWebApps.WebAPI.DTOs.MT4.v2.MT4UserUpdate minus the explicit Balance/Credit (those should come through dedicated balance operations after the account exists). The wrapper allocates the next free login id when Login = 0; clients may also request a specific id by setting Login > 0 (the server rejects collisions). Password / OTP / API-data fields are NOT on this DTO. After successful creation, set the initial password via a separate POST UserPasswordSet/{login} call. The wrapper accepts the new account with empty password bytes; the password endpoint lifts it to usable credentials.

PropertyTypeDescription
login integer (int32) Optional preferred login. 0 = let server assign the next free id. > 0 = request this exact id (server rejects collisions via wrapper error code).
group string, nullable
name string, nullable
externalId string, nullable
status string, nullable
country string, nullable
city string, nullable
state string, nullable
zipCode string, nullable
address string, nullable
leadSource string, nullable
phone string, nullable
email string, nullable
comment string, nullable
leverage integer (int32)
agentAccount integer (int32)
interestRate number (double)
taxes number (double)
enableFlags integer (int32)
sendReports integer (int32)
mqid integer (int64)
userColor integer (int32)

MT4UserUpdate

Type 1 mutator input — full-replace shape for UserRecordUpdate. Client submits every non-secret, non-read-only, non-computed field; the handler reads the current record from MT4 server, copies the secrets and read-only fields off it, applies this DTO over the rest, and writes the modified structure back. Read-only fields that do NOT appear here (preserved by the server-side read step): * Login — passed as a path parameter, immutable identity. * RegistrationDate — set once on creation, never updated. * LastDate, LastIP — assigned by MT4 server during login. * PrevMonthBalance, PrevBalance, PrevMonthEquity, PrevEquity — derived server-side at reporting close. Secret fields that do NOT appear here (preserved by the server-side read step; use dedicated endpoints to change them): * Password, PasswordInvestor, PasswordPhone — change via POST UserPasswordSet. * OTPSecret — provisioned via separate admin flow. * APIData — wrapper-internal blob, never client-controlled. Note on Balance/Credit: these fields ARE accepted here because the wrapper UserRecordUpdate writes them directly. However, the audit- trail-preserving way to move money is the dedicated balance operation endpoints (forthcoming) — submitting Balance via this DTO bypasses the audit log on MT4 server side.

PropertyTypeDescription
group string, nullable Group name the account belongs to
name string, nullable Display name of the account holder
externalId string, nullable External customer identifier (CRM/KYC link)
status string, nullable MT4-internal status string
country string, nullable Country
city string, nullable City
state string, nullable State / region
zipCode string, nullable Postal / ZIP code
address string, nullable Street address
leadSource string, nullable Lead source / referral channel tag
phone string, nullable Contact phone
email string, nullable Contact email
comment string, nullable Free-form back-office comment
leverage integer (int32) Account leverage (e.g. 100 means 1:100)
agentAccount integer (int32) IB / agent account number that referred this client
balance number (double) Current balance (prefer dedicated balance ops for audit trail)
credit number (double) Credit on the account
interestRate number (double) Interest rate
taxes number (double) Tax rate
enableFlags integer (int32) Account flag bitfield — see MT4User.EnableFlags for bit semantics
sendReports integer (int32) 0 = no reports, non-zero = nightly email reports enabled
mqid integer (int64) MetaQuotes ID for mobile push notifications
userColor integer (int32) UI tint color in terminal client lists

MT4UsersGroupOp

v2 request body for UsersGroupOp — bulk group-membership / leverage / enable-disable / delete operation across a list of account logins.

PropertyTypeDescription
command string, nullable Bulk operation. One of: Delete, Enable, Disable, Leverage, SetGroup. Case-insensitive; the numeric value is accepted too. Any other value is refused with error code Validation.
newGroup string, nullable Target group name (max 15 chars + NUL). Only used by SetGroup.
leverage integer (int32) New leverage value (e.g. 100, 200, 500). Only used by Leverage.
logins integer (int32)[] List of account logins (account numbers) to apply the operation to. Must be non-empty.

MT4User

v2 DTO describing a trading account. Curated subset of the wrapper's UserRecord — exposes identity, contact, financial and flag fields that callers actually need. Deliberately omitted from v2 (vs v1's full UserRecord shape): * Password / PasswordInvestor / PasswordPhone / OtpSecret / ApiData / SecureReserved — credentials and secrets must never cross the v2 boundary regardless of access level. * Unused / Reserved2 / EnableReserved / TimeStamp — wrapper bookkeeping with no caller-visible semantics. Account flags are exposed as a single CPlugin.SaaSWebApps.WebAPI.DTOs.MT4.v2.MT4User.EnableFlags bitfield (the wrapper's native representation). Bit semantics are documented under that property — splitting it into separate booleans would hide the fact that MetaQuotes occasionally reuses bit positions across builds.

PropertyTypeDescription
login integer (int32) Trading account number (login)
group string, nullable Group name the account belongs to
name string, nullable Display name of the account holder
registrationDate string (date-time) UTC timestamp when the account was created
lastDate string (date-time) UTC timestamp of the last MT4 server interaction
externalId string, nullable External customer identifier (e.g. CRM/KYC link). Wrapper's Id field.
status string, nullable MT4-internal status string (e.g. live/demo state)
country string, nullable Country (free text per broker's enrolment workflow)
city string, nullable City
state string, nullable State / region
zipCode string, nullable Postal / ZIP code
address string, nullable Street address
leadSource string, nullable Lead source / referral channel tag
phone string, nullable Contact phone
email string, nullable Contact email
comment string, nullable Free-form back-office comment
leverage integer (int32) Account leverage (e.g. 100 means 1:100)
agentAccount integer (int32) IB / agent account number that referred this client
lastIP integer (int32) Last connection IP as raw int (use platform helpers to format)
balance number (double) Current balance
credit number (double) Credit on the account
prevMonthBalance number (double) Balance at the start of the previous calendar month
prevBalance number (double) Balance at the previous reporting close
prevMonthEquity number (double) Equity at the start of the previous calendar month
prevEquity number (double) Equity at the previous reporting close
interestRate number (double) Interest rate (broker-defined, often used for swaps)
taxes number (double) Tax rate applied to the account
enableFlags integer (int32) Account flag bitfield (wrapper's EnableFlags). Documented bits: * 0x01 = account enabled (login allowed) * 0x02 = client may change password * 0x04 = account is read-only (no trading) * 0x08 = OTP enrolment required at login Bit positions reflect MT4 build 1455. Verify against the current MT4 Manager docs if pinning behaviour to a specific bit.
sendReports integer (int32) 0 = no reports, non-zero = nightly email reports enabled
mqid integer (int64) MetaQuotes ID for mobile push notifications (0 if not linked). Typed as long in v2 even though current builds store it in 32 bits — the wrapper exposes a wider underlying type and a checked narrowing cast would crash for accounts whose mqid sits above Int32.MaxValue. Future-proofs the contract against MQ widening.
userColor integer (int32) UI tint color in terminal client lists

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.

PropertyTypeDescription
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.

PropertyTypeDescription
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.

MT4BalanceDiff

v2 DTO returned by AdmBalanceCheck. Reports the difference between the account's recorded balance and what the MT4 server recomputes from closed orders + balance operations. Diff = 0 means the integrity check passed; non-zero means the recorded balance has drifted and would be set to recorded + Diff if AdmBalanceFix ran.

PropertyTypeDescription
login integer (int32) Account login
diff number (double) Difference (signed). Zero means balance integrity check passed.