Skip to main content

API Calls

All API calls here are made by the broker's backend to the cTrader backend.

Register a User

HTTP MethodURL
POST/ctid/create

Creates a new user entity.

Parameters

No parameters.

Request Body

KeyRequired?Data TypeDescription
brokerNameNostringA unique name denoting a specific broker (including White Labels).
emailYesstringThe email address assigned to the new user.
preferredLanguageNostringAn Alpha-2 code denoting the preferred language of the new user.

Output

info

Note that there are two possible outputs depending on whether you specify a unique email in the request body (an email that is not used by any of the users registered on your server). If email is unique, the response will include all parameters from the below table. If the specified email is already assigned to an existing user, the output will only include the userId parameter.

KeyData TypeDescription
userIdintegerThe unique identifier of the user entity.
nicknamestringThe nickname of the user entity. By default, nickname=ctid{userId}.
emailstringThe email assigned to the user entity.
preferredLanguagestringAn Alpha-2 code denoting the preferred language of the user entity.
utcCreateTimestampintegerThe epoch unix timestamp of the creation of the user entity.
statusenumThe status of the new user entity. Possible values:
- "CTID_NEW". The default status for any new user.
- "CTID_ACTIVE". The status denoting an existing active user who has confirmed their email address in the cTrader ecosystem. Note that only users with "CTID_ACTIVE" as their status receive trading notifications in their email inbox.
- "CTID_DELETED". The status denoting a deleted user entity.
Note that receiving "CTID_ACTIVE" or "CTID_DELETED" in the response body would constitute unexpected behavior.

For a JSON schema of the output, click here.

Request Example

curl -X POST 'https://HOST:PORT/cid/ctid/create?token=1dd4ef40-c5b3-61c0-0689-b1b40c97fadc' -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{"brokerName": "BESTBROKER", "email": "president@bestbroker.com", "preferredLanguage": "EN"}' 

Response Examples

{
"userId": 10333,
"nickname": "ctid10333",
"email": "president@bestbroker.com",
"utcCreateTimestamp": 1679898064783,
"preferredLanguage": "en",
"status": "CTID_NEW"
}

Expected Status Code

200

Get One-Time Code for User

MethodURL
POST/v1/users/{userId}/authcode

Generates the one-time code required for the SSO.

Parameters

ParameterParameter TypeRequired?Data TypeDescription
userIdpathYesintegerThe unique ID of the user.

Headers

HeaderDescriptionRequired?Notes
Authentication headerAuthentication token for WebServices API. E.g. 1a1fc081-f8d9-81a4-6b43-f9e42ed0c1d7YesThe manager whose token is used to send the request must have permission to authenticate users.

Request Body

KeyRequired?Data TypeDescription
brokerNamesYesstring arrayBroker names (white labels) for which access is requested.

Output

KeyData TypeDescription
сodestringOne-time code which can be exchanged for an authentication token. Valid for 60 seconds.

Request Example

curl -X POST 'https://HOST:PORT/cid/v1/users/{userId}/authcode' 'Authorization: Bearer 7f1fc081-f8d9-81a4-4b43-f9e42ed0c7d8' 'Content-Type: application/json' 'Accept: application/json' '{"brokerNames": ["BESTBROKER"]}' 

Expected Response Status Code

200

Response Example

{
"сode": "3b8aa6ff-ec5b-460e-a149-346e7ec2b9ff"
}