CPlugin

MT4 v2 :: Groups

API v2 (current) · MT4 · 9 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 trading groups (cached)

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

All trading groups configured on the MT4 server from the cached copy.

Cached read. Curated record drops SMTP credentials, template paths, and nested SecGroups/SecMargins arrays (those are read with GroupSecGroupsGet and GroupSecMarginsGet). Typical group counts are small (dozens), so no pagination is needed.

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

Get trading group (cached)

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

Single trading group configuration by name (cached).

Cached lookup. Returns NotFound envelope if no group with the given name exists. Group names are case-sensitive — the platform does an exact dictionary lookup.

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)
group path string yes 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/GroupRecordGet/$GROUP" \
  -H "Authorization: Bearer $TOKEN"

List trading groups (live)

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

Asks the trade server and returns a paged list of all configured groups on the platform. Sort key is the group name (string, ordinal compare) ascending. Cursor is the last returned group name encoded as opaque base64.

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

List trading groups (live configuration)

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

Asks the trade server and returns the group configuration set as stored on the MT4 server — the same data the platform persists for CfgUpdateGroup, unlike the cached GroupsGet.

Curated record: SMTP credentials and template paths are dropped, and the nested security/margin arrays are served by their own endpoints. Order follows the server response. Typical group counts are small, so no pagination is needed.

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

Get group security entries

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

Security-group entries (SecGroups[32]) for one trading group.

Cached read. Returns the full 32-element array; entries whose Trade and Show are both 0 are placeholders (the platform reserves the slot for the symbol-group regardless of whether the group is configured to trade it). Filter on the client side.

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)
group path string yes 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/GroupSecGroupsGet/$GROUP" \
  -H "Authorization: Bearer $TOKEN"

Get group margin overrides

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

Special-securities margin overrides (SecMargins) for one group.

Cached read. Returns the first SecMarginsTotal entries of the platform's 128-element SecMargins array — the trailing slots are always uninitialised padding. SecMarginsTotal itself is part of the parent MT4Group record.

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)
group path string yes 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/GroupSecMarginsGet/$GROUP" \
  -H "Authorization: Bearer $TOKEN"

Update trading group

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

Change a trading group. The group field of the body names the target group and is never changed; the response is a boolean.

Only the fields present in the body are written: the group is read live from the trade server, the body is applied over it, and the merged record is written back. A field that is left out keeps its server value; for the string fields, omitting the key keeps the value while sending "" clears it. Fields the body cannot carry (SMTP credentials, templates, the securities hash, reserved and nested arrays) keep their server values. A body with the group name but no field to change is rejected, and a string that does not fit the platform's fixed buffer is refused with the field name instead of being cut.

Idempotency-Key strongly recommended: the change applies to every account in the group at once.

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

MT4GroupUpdate (application/json) — Group name plus the fields to change; omitted fields keep their server value

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/CfgUpdateGroup" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "group": "", "enable": 0, "timeout": 0, "otpMode": "Disabled", "company": "", "signature": "" }'

Patch trading group

PATCH /api/v2/MT4/{tradePlatform}/GroupRecord/{group}

Partial update of a trading group: only the fields you send change. Same read-merge-write flow as the account patch: a patch must carry at least one known field, unknown keys and values of the wrong type are Validation errors, an explicit null clears a string field (and is refused elsewhere), and string values are checked against the platform's fixed buffers.

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)
group path string yes Group name (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/GroupRecord/$GROUP" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Check group exists

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

Checks whether a trading group exists on the connected MT4 server. Useful as a validation pre-flight before creating users, moving users between groups, or wiring up automated provisioning.

The check enumerates the group catalog and looks the name up; there is no cheaper call for it on the trade-server surface, so it costs the same as listing the groups.

Returns true if the group is configured on the server, false otherwise. Group lookup is case-sensitive (MT4 group names are case-sensitive in the underlying API).

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)
group path string yes Group name to look up (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/EnsureGroupNameExist/$GROUP" \
  -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.

MT4GroupListApiResponse

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 MT4Group[]
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.

MT4GroupApiResponse

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 MT4Group Trading group configuration: margin, leverage, rights and news settings. Server file paths, mail-server credentials and platform-internal arrays are not returned; the security entries of a group are read with GroupSecGroupsGet and GroupSecMarginsGet. Enums are returned as their names, and GroupRights is a flags string holding the names of the set bits.
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.

MT4GroupSecListApiResponse

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 MT4GroupSec[]
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.

MT4GroupMarginListApiResponse

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 MT4GroupMargin[]
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.

MT4GroupUpdate

Input shape for CfgUpdateGroup: the editable part of an MT4 trading group.

PropertyTypeDescription
group string, nullable Group name to update (required identity; never changed by this call)
enable integer (int32), nullable 0 = group disabled, non-zero = enabled
timeout integer (int32), nullable Trade confirmation timeout, seconds
otpMode OTPMode One-time password requirement mode
company string, nullable Company name shown on statements
signature string, nullable Statement signature line
supportPage string, nullable Support page URL
supportEmail string, nullable Support email
copies integer (int32), nullable Statement copy count
reports integer (int32), nullable 0 = statements disabled, non-zero = enabled
defaultLeverage integer (int32), nullable Default leverage when accounts omit their own
defaultDeposit number (double), nullable Default deposit when accounts omit their own balance
maxSecurities integer (int32), nullable Max simultaneously open securities
currency string, nullable Deposit currency
credit number (double), nullable Virtual credit applied to group's accounts
marginCall integer (int32), nullable Margin call threshold (percent)
marginMode MarginMode Margin calculation mode
marginStopout integer (int32), nullable Stop-out threshold
interestRate number (double), nullable Annual interest rate (percent)
useSwap integer (int32), nullable 0 = no rollovers, non-zero = use them
newsMode NewsMode News delivery mode
groupRights GroupRights Permissions bit mask
checkIEPrices integer (int32), nullable 0 = no IE check, non-zero = check IE prices
maxPositions integer (int32), nullable Maximum simultaneous orders and open positions
closeReopen integer (int32), nullable 0 = standard, non-zero = close-and-reopen mode
hedgeProhibited integer (int32), nullable 0 = hedging allowed, non-zero = prohibited
closeFIFO integer (int32), nullable 0 = LIFO, non-zero = FIFO close rule
hedgeLargeLeg integer (int32), nullable 0 = standard, non-zero = treat large hedged leg specially
marginControllingType MarginControllingType Margin controlling unit (percent vs deposit currency)
archivePeriod integer (int32), nullable Inactivity period (days) before account archival
archiveMaxBalance integer (int32), nullable Max balance under which an account becomes archivable
stopoutSkipHedged integer (int32), nullable 0 = include hedged in stop-out checks, non-zero = skip them
archivePendingPeriod integer (int32), nullable Pending orders clean-up period (days)

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.

MT4Group

Trading group configuration: margin, leverage, rights and news settings. Server file paths, mail-server credentials and platform-internal arrays are not returned; the security entries of a group are read with GroupSecGroupsGet and GroupSecMarginsGet. Enums are returned as their names, and GroupRights is a flags string holding the names of the set bits.

PropertyTypeDescription
group string, nullable Group name (unique per platform, max 16 chars)
enable integer (int32) 0 = group disabled, non-zero = enabled (accounts in this group can log in)
timeout integer (int32) Trade confirmation timeout, seconds
otpMode OTPMode One-time password requirement mode
company string, nullable Company name shown on statements
signature string, nullable Statement signature line
supportPage string, nullable Support page URL shown to clients
supportEmail string, nullable Support email shown to clients
copies integer (int32) Number of statement copies sent to support address
reports integer (int32) 0 = statements disabled, non-zero = nightly statements enabled
defaultLeverage integer (int32) Default leverage applied when an account omits its own leverage
defaultDeposit number (double) Default deposit applied when an account omits its own balance
maxSecurities integer (int32) Max simultaneously open securities
secMarginsTotal integer (int32) Count of special securities settings (SecMargins) in use
currency string, nullable Deposit currency (e.g. "USD")
credit number (double) Virtual credit applied to the group's accounts
marginCall integer (int32) Margin call threshold (percent of equity)
marginMode MarginMode Margin calculation mode (don't use / use all / use profit / use loss)
marginStopout integer (int32) Stop-out threshold
interestRate number (double) Annual interest rate (percent)
useSwap integer (int32) 0 = no rollovers, non-zero = use rollovers and interest rate
newsMode NewsMode News delivery mode
groupRights GroupRights Permissions bit mask for this group
checkIEPrices integer (int32) 0 = no IE check, non-zero = check Instant Execution prices
maxPositions integer (int32) Maximum simultaneous orders and open positions
closeReopen integer (int32) 0 = standard close, non-zero = close-and-reopen mode
hedgeProhibited integer (int32) 0 = hedging allowed, non-zero = hedging prohibited
closeFIFO integer (int32) 0 = LIFO, non-zero = FIFO close rule
hedgeLargeLeg integer (int32) 0 = standard hedge, non-zero = treat large hedged leg specially
marginControllingType MarginControllingType Margin controlling unit (percent vs deposit currency)
archivePeriod integer (int32) Inactivity period (days) before account moves to archive
archiveMaxBalance integer (int32) Maximum balance under which an account is eligible for archiving
stopoutSkipHedged integer (int32) 0 = include hedged accounts in stop-out checks, non-zero = skip them
archivePendingPeriod integer (int32) Pending orders clean-up period (days)

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.

MT4GroupSec

v2 record for one entry in a group's SecGroups array (32 elements indexed by symbol-group). Curated from ConGroupSec; drops the Reserved int[3] padding. Enum fields are returned as their names.

PropertyTypeDescription
show integer (int32) 0 = security group hidden from clients, non-zero = visible
trade integer (int32) 0 = trading disabled, non-zero = trading enabled
dealingMode string, nullable Dealing mode (Manual / Auto / Activity)
standardCommission number (double) Standard commission
commissionType string, nullable Commission type (Money / Pips / Percent)
commissionLotsMode string, nullable Commission lots mode (PerLot / PerDeal)
agentCommission number (double) Agent commission
agentCommissionMode string, nullable Agent commission type (Money / Pips)
spreadDiff integer (int32) Spread difference compared to default symbol spread
lotMin integer (int32) Minimum allowed lot size (in 1/100 lot units, e.g. 100 = 1 lot)
lotMax integer (int32) Maximum allowed lot size
lotStep integer (int32) Lot step (10 lot = 1000, 1 lot = 100, 0.1 lot = 10)
ieDeviation integer (int32) Max price deviation in Instant Execution mode
confirmation integer (int32) 0 = no confirmation, non-zero = request mode confirmation
tradeRights string, nullable Clients trade rights bit mask (string-encoded)
ieQuickMode integer (int32) 0 = normal, non-zero = don't resend on deviation in IE
autoCloseOutMode string, nullable Auto close-out method (None / HiHi / LoLo / FIFO / LIFO / ...)
commissionTaxes number (double) Commission taxes
commissionAgentLots string, nullable Agent commission lots mode
freeMarginMode integer (int32) 0 = strict margin check, non-zero = soft check

MT4GroupMargin

v2 record for one of a group's "special securities" margin overrides. Curated from ConGroupMargin — the platform's per-symbol swap/margin overrides stored as a 128-element array on ConGroup.SecMargins. The Reserved int[7] padding is dropped.

PropertyTypeDescription
symbol string, nullable Symbol the override applies to (max 12 chars)
swapLong number (double) Swap charge for long positions
swapShort number (double) Swap charge for short positions
marginDivider number (double) Margin divider override (1.0 = use default)

OTPMode

Values: Disabled, TOTP_SHA256

MarginMode

Values: DontUse, UseAll, UseProfit, UseLoss

NewsMode

Values: No, Topics, Full

GroupRights

Flags: names of the set bits joined by ", " ("Signals, Trailing"), "None" when none is set; a set bit without a name is "Bit<n>" (bit number). Bits: Signals = 0x1, Trailing = 0x2, Advisor = 0x4, Expiration = 0x8, SignalAll = 0x10, SignalsOwn = 0x20, RiskWarning = 0x40, ForcedOTPUsage = 0x80.

MarginControllingType

Values: Percent, Currency