CPlugin

MT5 v2 :: Users

API v2 (beta) · MT5 · 2 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 a user by login

GET /api/v2/MT5/{tradePlatform}/UserGet/{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 identifier (GUID).
login path integer (int64) yes User login (account 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/MT5/$TRADE_PLATFORM_ID/UserGet/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Partially update a user

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

Send only the fields you want to change (JSON Merge Patch, RFC 7386); omitted fields keep their current values. Returns the updated record.

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 identifier (GUID).
login path integer (int64) yes User login (account number).
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/MT5/$TRADE_PLATFORM_ID/UserRecord/$LOGIN" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

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.

MT5UserApiResponse

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 MT5User MT5 user, v2 read DTO — full field set (A4 expansion). Includes all editable fields mirrored from MT5UserUpdate plus read-only financial/metadata fields. Rights is a flags string: the names of the set bits, "Enabled, Password".
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.

MT5User

MT5 user, v2 read DTO — full field set (A4 expansion). Includes all editable fields mirrored from MT5UserUpdate plus read-only financial/metadata fields. Rights is a flags string: the names of the set bits, "Enabled, Password".

PropertyTypeDescription
login integer (int64) User login (identity, read-only).
group string, nullable User group name.
name string, nullable Full display name of the account holder.
company string, nullable Company or organisation name.
country string, nullable Client country.
city string, nullable Client city.
state string, nullable Client state or province.
zipCode string, nullable Client postal code.
phone string, nullable Client phone number.
eMail string, nullable Client email address.
comment string, nullable Internal comment on the account.
color integer (int32) Colour tag assigned to the account in MT5 Manager (ARGB uint).
leverage integer (int32) Account leverage (e.g. 100 = 1:100).
account string, nullable Account ID string (external account identifier).
language integer (int32) Client language code (MT5 locale uint).
address string, nullable Client postal/physical address.
id string, nullable Client document ID (passport, national ID, etc.).
status string, nullable Client KYC / account status label.
agent integer (int64) Introducing agent login.
leadCampaign string, nullable Marketing lead campaign name.
leadSource string, nullable Marketing lead source name.
clientID integer (int64) External CRM client ID.
firstName string, nullable Given name (first name).
lastName string, nullable Family name (last name).
middleName string, nullable Patronymic / middle name.
rights UsersRights Account permission flags: names of the set bits, "Enabled, Password" (the UsersRights schema).
certSerialNumber integer (int64) SSL certificate serial number (read-only).
registration string (date-time), nullable Account registration timestamp (UTC). Null when not set (unix 0).
lastAccess string (date-time), nullable Last login timestamp (UTC). Null when not set.
lastPassChange string (date-time), nullable Last password change timestamp (UTC). Null when not set.
lastIP string, nullable Last known client IP address.
balance number (double) Current account balance.
credit number (double) Current credit facility amount.
interestRate number (double) Annual interest rate on credit.
commissionDaily number (double) Accumulated commission for the current day.
commissionMonthly number (double) Accumulated commission for the current month.
commissionAgentDaily number (double) Agent commission accrued today.
commissionAgentMonthly number (double) Agent commission accrued this month.
balancePrevDay number (double) Balance at end of previous trading day.
balancePrevMonth number (double) Balance at end of previous calendar month.
equityPrevDay number (double) Equity at end of previous trading day.
equityPrevMonth number (double) Equity at end of previous calendar month.

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.