Balances
Broker → cTrader endpoint for changing a trading account's balance. Authenticated with the Manager Token (see Authentication of API calls).
Change a trader's balance
The broker calls this endpoint after a successful payment to update the trader's balance in cTrader.
| Method | URL |
|---|---|
POST | /webserv/traders/{login}/changebalance |
Path parameters
| Parameter | Required? | Data type | Description |
|---|---|---|---|
login | Yes | integer | The number of a specific trading account. |
Request body
| Key | Required? | Data type | Description |
|---|---|---|---|
comment | No | string | Internal note attached to the balance change. Not shown to retail clients. |
externalId | No | string | External identifier of the broker's choosing (a bank transfer order number, for instance). |
externalNote | No | string | Brief comment displayed to retail clients. |
login | Yes | integer | The number of a specific trading account. |
preciseAmount | Yes | double | Amount to deposit or withdraw. Must be a positive decimal number. |
source | No | string | Designated source of the deposit or withdrawal. |
type | Yes | string | Type of balance change: "DEPOSIT", "WITHDRAW", "DEPOSIT_NONWITHDRAWABLE_BONUS" or "WITHDRAW_NONWITHDRAWABLE_BONUS". |
info
Only positive values are accepted for preciseAmount. The direction of the balance change is regulated entirely by the type parameter.
Output
| Key | Data type | Description |
|---|---|---|
balanceHistoryId | integer | Identifier of the balance history entity containing all balance-related transactions for the specified trader. Bonus and credit are not included in balanceHistoryId. |
Expected status code
200
Errors
See Error codes.
Request example
curl -X POST 'https://HOST:PORT/v2/webserv/traders/8673590/changebalance?token=1dd4ef40-c5b3-61c0-0689-b1b40c97fadc' -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"comment": "Test deposit", "externalId": "082123301", "externalNote": "New deposit!", "login": 8673590, "preciseAmount": 123.45, "source": "Source One", "type": "DEPOSIT"}'
Response example
{
"balanceHistoryId": 6340680
}