CPlugin

MT5 v2 :: Clients

API v2 (beta) · MT5 · 4 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

Create a client

POST /api/v2/MT5/{tradePlatform}/ClientAdd

Adds a client — the person behind one or more accounts — to the server database. The record is returned as stored by the server, including the identifier it was assigned. A client with the same details is not deduplicated: every call creates a new 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).
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

MT5Client (application/json) — Client record to create.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/ClientAdd" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "personName": "", "recordID": 0, "clientType": "Undefined", "clientStatus": "Unregistered", "assignedManager": 0, "complianceApprovedBy": 0 }'

Attach a trading account to a client

POST /api/v2/MT5/{tradePlatform}/ClientUserAdd/{clientId}/{login}

Binds the account with the given login to the client record, so the account is shown under that client. An account can belong to one client at a time; attaching it again to another client may fail with a platform error. The response carries the platform result code of the operation.

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).
clientId path integer (int64) yes Client identifier.
login path integer (int64) yes Trade account login.
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.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/ClientUserAdd/$CLIENT_ID/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Read a client

GET /api/v2/MT5/{tradePlatform}/ClientRequest/{clientId}

Fetches the client record of the given identifier from the trade server. The call only reads and changes nothing. An identifier that does not exist is answered with a platform error rather than an empty 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 identifier (GUID).
clientId path integer (int64) yes Client identifier.
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/ClientRequest/$CLIENT_ID" \
  -H "Authorization: Bearer $TOKEN"

Delete a client

POST /api/v2/MT5/{tradePlatform}/ClientDelete/{clientId}

Removes the client record with the given identifier from the server database. The operation is not reversible. Accounts attached to the client are not deleted by this call and stay on the server. The response carries the platform result code of the operation.

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).
clientId path integer (int64) yes Client identifier.
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.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/ClientDelete/$CLIENT_ID" \
  -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.

MT5Client

Client record interface

PropertyTypeDescription
recordID integer (int64), nullable record id
clientType ClientTypes client type
clientStatus ClientStatuses client status
assignedManager integer (int64), nullable assigned manager
complianceApprovedBy integer (int64), nullable compliance approved by
complianceClientCategory string, nullable compliance client category
complianceDateApproval string (date-time), nullable compliance date approval
complianceDateTermination string (date-time), nullable compliance date termination
leadCampaign string, nullable lead campaign
leadSource string, nullable lead source
introducer string, nullable introducer
personTitle string, nullable person title
personName * string person name
personMiddleName string, nullable person middle name
personLastName string, nullable person last name
personBirthDate string (date-time), nullable person birth date The date of birth is specified in the FILETIME format: the number of 100-nanosecond intervals that have elapsed since January 1, 1601
personCitizenship string, nullable person citizenship
personGender Genders person gender
personTaxID string, nullable person taxid
personDocumentType string, nullable person document type
personDocumentNumber string, nullable person document number
personDocumentDate string (date-time), nullable issue date of the identification document (of passport, driver's license, etc.). in seconds since 01.01.1970 (UnixTime).
personDocumentExtra string, nullable person document extra
personEmployment Employment person employment
personIndustry EmploymentIndustry person industry
personEducation EducationLevel person education
personWealthSource WealthSource person wealth source
personAnnualIncome number (double), nullable person annual income
personNetWorth number (double), nullable person net worth
personAnnualDeposit number (double), nullable person annual deposit
companyName string, nullable company name
companyRegNumber string, nullable company registration number
companyRegDate string (date-time), nullable Company registration date in seconds that elapsed since 01.01.1970 (UnixTime).
companyRegAuthority string, nullable company registration authority
companyVAT string, nullable company VAT
companyLEI string, nullable company LEI
companyLicenseNumber string, nullable company license number
companyLicenseAuthority string, nullable company license authority
companyCountry string, nullable company country
companyAddress string, nullable company address
companyWebsite string, nullable company website
contactPreferred PreferredCommunication contact preferred
contactLanguage string, nullable contact language
contactEmail string, nullable contact email
contactPhone string, nullable contact phone
contactMessengers string, nullable contact messengers
contactSocialNetworks string, nullable contact social networks
contactLastDate string (date-time), nullable Contact last date
addressCountry string, nullable address country
addressPostcode string, nullable address postcode
addressStreet string, nullable address street
addressState string, nullable address state
addressCity string, nullable address city
experienceFX TradingExperience experience of FX
experienceCFD TradingExperience experience of CFD
experienceFutures TradingExperience experience of Futures
experienceStocks TradingExperience experience of Stocks
tradingGroup string, nullable trading group
clientOrigin ClientOrigins client origin
clientOriginLogin integer (int64), nullable client origin login
clientExternalID string, nullable external ID
personDocumentExpiration string (date-time), nullable person document expiration date
kycStatus KYCStatuses KYC status
dateCreated string (date-time), nullable record creation date
dateModified string (date-time), nullable record modification date

MT5ClientApiResponse

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 MT5Client Client record interface
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 identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT5ResultApiResponse

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 MT5Result
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 identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

ClientTypes

Values: Undefined, Individual, Corporate, Fund

ClientStatuses

Values: Unregistered, Registered, NotInterested, ApplicationIncomplete, ApplicationCompleted, ApplicationInformation, ApplicationRejected, Approved, Funded, Active, Inactive, Suspended, Closed, Terminated

Genders

Values: Unspecified, Male, Female

Employment

Values: Unemployed, Employed, SelfEmployed, Retired, Student, Other

EmploymentIndustry

Values: None, Agriculture, Construction, Management, Communication, Education, Government, Healthcare, Tourism, IT, Security, Manufacturing, Marketing, Science, Engineering, Transport, Other

EducationLevel

Values: None, HighSchool, Bachelor, Master, PHD, Other

WealthSource

Values: Employment, Savings, Inheritance, Other

PreferredCommunication

Values: Undefined, Email, Phone, SMS, Messenger

TradingExperience

Values: LessThanYear, OneToThreeYears, AboveThreeYears

ClientOrigins

Values: Manual, Demo, Contest, Preliminary, Real

KYCStatuses

Values: Undefined, Approved, Declined

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

MT5Result

Values: Ok, OkNone, Error, ErrParams, ErrData, ErrDisk, ErrMem, ErrNetwork, ErrPermissions, ErrTimeout, ErrConnection, ErrNoService, ErrFrequent, ErrNotfound, ErrPartial, ErrShutdown, ErrCancel, ErrDuplicate, AuthClientInvalid, AuthAccountInvalid, AuthAccountDisabled, AuthAdvanced, AuthCertificate, AuthCertificateBad, AuthNotConfirmed, AuthServerInternal, AuthServerBad, AuthUpdateOnly, AuthClientOld, AuthManagerNoConfig, AuthManagerIPBlock, AuthGroupInvalid, AuthCaDisabled, AuthInvalidID, AuthInvalidIp, AuthInvalidType, AuthServerBusy, AuthServerCert, AuthAccountUnknown, AuthServerOld, AuthServerLimit, AuthMobileDisabled, AuthManagerType, AuthDemoDisabled, AuthResetPassword, AuthOTPInvalid, AuthOTPNeedSecret, AuthMigrationMT4, AuthMigrationMT5, AuthInvalidVerify, AuthVerifyBadEmail, AuthVerifyBadPhone, AuthAPIDisabled, CfgLastAdmin, CfgLastAdminGroup, CfgNotEmpty, CfgInvalidRange, CfgNotManagerLogin, CfgBuiltin, CfgDuplicate, CfgLimitReached, CfgNoAccessToMain, CfgDealerIDExist, CfgBindAddressExist, CfgWorkingTrade, CfgGatewayNameExist, CfgSwitchToBackup, CfgNoBackupModule, CfgNoTradeModule, CfgNoHistoryModule, CfgAnotherSwitch, CfgNoLicenseFile, CfgGatewayLoginExist, CfgInvalidCompany, UsrLastAdmin, UsrLoginExhausted, UsrLoginProhibited, UsrLoginExist, UsrSuicide, UsrInvalidPassword, UsrLimitReached, UsrHasTrades, UsrDifferentServers, UsrDifferentCurrency, UsrImportBalance, UsrImportGroup, UsrAccountExist, UsrImportAccount, UsrImportPositions, UsrImportOrders, UsrImportDeals, UsrImportHistory, UsrAPILimitReached, TradeLimitReached, TradeOrderExist, TradeOrderExhausted, TradeDealExhausted, TradeMaxMoney, TradeDealExist, TradeOrderProhibited, TradeDealProhibited, TradeSplitVolume, ReportSnapshot, ReportNotSupported, ReportNodata, ReportTemplateBad, ReportTemplateEnd, ReportInvalidRow, ReportLimitRepeat, ReportLimitReport, HstSymbolNotfound, RequestInWay, RequestAccepted, RequestProcess, RequestRequote, RequestPrices, RequestReject, RequestCancel, RequestPlaced, RequestDone, RequestDonePartial, RequestError, RequestTimeout, RequestInvalid, RequestInvalidVolume, RequestInvalidPrice, RequestInvalidStops, RequestTradeDisabled, RequestMarketClosed, RequestNoMoney, RequestPriceChanged, RequestPriceOff, RequestInvalidExp, RequestOrderChanged, RequestTooMany, RequestNoChanges, RequestAtDisabledServer, RequestAtDisabledClient, RequestLocked, RequestFrozen, RequestInvalidFill, RequestConnection, RequestOnlyReal, RequestLimitOrders, RequestLimitVolume, RequestInvalidOrder, RequestPositionClosed, RequestExecutionSkipped, RequestInvalidCloseVolume, RequestCloseOrderExist, RequestLimitPositions, RequestRejectCancel, RequestLongOnly, RequestShortOnly, RequestCloseOnly, RequestProhibitedByFifo, RequestHedgeProhibited, RequestReturn, RequestDoneCancel, RequestRequoteReturn, ErrNotImplement, ErrNotMain, ErrNotSupported, ErrDeadlock, ErrLocked, MessengerInvalidPhone, MessengerNotMobile, SubsNotFound, SubsNotFoundCfg, SubsNotFoundUser, SubsDisabled, SubsPermissionUser, SubsPermissionSubscribe, SubsPermissionUnsubscribe, SubsRealOnly, SubsPaymentMethod, PayRealOnly, PayInvalidAmount, PayNotAllowedDeposit, PayNotAllowedWithdrawal, PayNotAllowedGroup, PayNotAllowedCountry, PayDeclineByRules, PayDeclineByAml, PayLimitDepositMin, PayLimitDepositMax, PayLimitWithdrawalMin, PayLimitWithdrawalMax, PayProviderPayment, PayProviderStatus, PayConversion, PayNotWaiting, PayVerification, PayInvoice, PayInvalidCurrency, PayLimitReached, PayProviderRefund, PayDeclineByCardholderName