Accounts

On this page:

THE ACCOUNT OBJECT

A detailed description of the JSON object

GET[base]/accounts

Get an accounts list

GET[base]/accounts/{accountId}

Get account details

POST[base]/accounts

Add a new account

PUT[base]/accounts/{accountId}

Update an account

DELETE[base]/accounts/{accountId}

Delete an account

GET[base]/accounts/{accountId}/metrics

Get account metrics


The Account object

This object provides the following data about a trading account:

accountId string

The account identifier.

platformId string

The trading platform identifier.

platformName string

The trading platform name.

platformGroupId string

The identifier of a platform group.

platformGroupName string

The name of a platform group.

profileId string

The identifier of a user profile.

number string

The account number on a trading platform.

type integer

The account type. Possible values:

  • 0 — default

  • 1 — payment

  • 2 — investment

  • 3 — master

  • 4 — B2Copy investment

  • 5 — B2Copy master

  • 6 — PAMM investment

  • 7 — PAMM master

  • 8 — MAM investment

  • 9 — MAM master

archived boolean

If true, this account was archived on the trading platform; otherwise, false.

enabled boolean

The account status. If true, data synchronization and reward payment are enabled for an account; otherwise false. By default, all accounts are enabled.

environment string

The working environment. Possible values:

  • production

  • demo

currency string

The alphabetic code of an account currency.

balance string

The current account balance.

credit string

The credit amount.

equity string

The account equity.

commission string

The total amount of paid commissions.

swap string

The total amount of swaps.

profit string

The account profit before commissions.

pnl string

The profit-loss value calculated for an account.

deposits string

The total amount of deposits.

withdrawals string

The total amount of withdrawals.

uuid string

The universally unique identifier of the object (if provided). Refer to Integrations for more information.

createTime string

The date and time when the object has been created.

updateTime string

The date and time when the object has been last updated.

THE ACCOUNT OBJECT
{
  "accountId": "6006dda272f002519c3eb505",
  "platformId": "6006dda272f002519c3eb505",
  "platformName": "MetaTrader 5",
  "platformGroupId": "6006dda272f002519c3eb505",
  "platformGroupName": "B2BUSD",
  "profileId": "6006dda272f002519c3eb505",
  "number": "12345",
  "type": 2,
  "archived": false,
  "enabled": true,
  "currency": "BTC",
  "balance": "3.000000000000000000",
  "credit": "0.000000000000000000",
  "equity": "3.000000000000000000",
  "commission": "0.000000000000000000",
  "swap": "0.000000000000000000",
  "profit": "0.000000000000000000",
  "pnl": "0.000000000000000000",
  "deposits": "6.000000000000000000",
  "withdrawals": "-3000.000000000000000000",
  "uuid": null,
  "createTime": "2021-01-01T00:00:00+00:00",
  "updateTime": "2021-01-01T00:00:00+00:00"
}

Get an accounts list

Use this method to obtain a list of trading accounts of your clients.

To obtain detailed information about a specific trading account, use a separate method to get account details.

Request

Header parameters:

  • Authorization: Bearer <token>

Query parameters:

This method supports pagination, sorting, filtering, and query. For details on applying the parameters, refer to the Query parameters section. Possible parameters for filtering, sorting, and query are listed below. For values description, refer to the Account object.

Possible values for the filter parameter:

  • archived

  • startTime

  • endTime

  • currency

  • number

  • enabled

  • platformId

  • platformGroupId

  • platformGroupName

  • profileId

  • userId

  • type

  • uuid

  • platform

  • metrics

  • profile

  • contacts

Possible values for the sort_by parameter:

  • accountId

  • archived

  • createTime (default)

  • enabled

  • number

  • trades

Possible values for the query parameter:

  • platform — trading platform information

  • profile — user profile information

  • contacts — user contact details

  • metrics — the number of trades on the account (see also: Get account metrics)

GET[base]/accounts

curl --location -g --request GET 'https://your.base-url.here/accounts?limit=10&offset=0&sort_by=createTime&sort_order=desc&filter[archived]=<boolean>&filter[endTime]=2021-01-31T23:59:59+00:00&filter[startTime]=2021-01-01T00:00:00+00:00&filter[currency]=BTC&filter[number]=12345&filter[enabled]=1&filter[platformId]=6006dda272f002519c3eb505&filter[platformGroupId]=6006dda272f002519c3eb505&filter[platformGroupName]=B2BUSD&filter[profileId]=6006dda272f002519c3eb505&filter[userId]=6006dda272f002519c3eb505&type=2&filter[uuid]=9&query[platform]=1&query[metrics]=1&query[profile]=1&query[contacts]=1' \
--header 'Authorization: Bearer <token>'

Response

Body:

In case of success, the response body contains an array of Account objects providing information about all trading accounts that correspond to the query parameters specified in the request.

Additionally, the response body may contain the following information if any of these were specified in the query parameters of the request:


Get account details

Use this method to obtain detailed information about a specified trading account.

To obtain a list of trading accounts, use a separate method to get a list of accounts.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

accountId required

The account identifier.

Query parameters:

This method supports query. For details on applying the parameters, refer to the Query parameters section.

Possible values for the query parameter:

  • platform — trading platform information

  • profile — user profile information

  • contacts — user contact details

  • metrics — the number of trades on the account (see also: Get account metrics)

GET[base]/accounts/{accountId}

curl --location -g --request GET 'https://your.base-url.here/accounts/60ba407d15951453e60e49f8?query[platform]=1&query[metrics]=1&query[profile]=1&query[contacts]=1' \
--header 'Authorization: Bearer <token>'

Response

Body:

In case of success, the response body contains an Account object providing information about the specified account.

Additionally, the response body may contain the following information if any of these were specified in the query parameters of the request:


Add a new account

Use this method to add an entity representing a client trading account in IB.

Request

Header parameters:

  • Authorization: Bearer <token>

  • Content-Type: application/json

Body:

number string required

The account number on the trading platform.

platformId string required

The identifier of a trading platform.

profileId string required

The identifier of a user profile.

enabled boolean

The account status. If true, data synchronization and reward payment are enabled for an account; otherwise false.

uuid string

The universally unique identifier of the account. Refer to Integrations for more information.

POST[base]/accounts

curl --location -g --request POST 'https://your.base-url.here/accounts' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "number": "12345",
  "platformId": "6006dda272f002519c3eb505",
  "profileId": "6006dda272f002519c3eb505",
  "enabled": true,
  "uuid": null
}'

Response

Body:

In case of success, the response body contains an Account object providing information about the newly created trading account.


Update an account

Use this method to update a specified trading account.

Note

Instead of the method described below, you can use a similar method that uses the HTTP verb PATCH.

Request

Header parameters:

  • Authorization: Bearer <token>

  • Content-Type: application/json

Path parameters:

accountId required

The account identifier.

Body:

Values of the following fields can be updated:

number string required

The account number on a trading platform.

enabled boolean

The account status. If true, data synchronization and reward payment are enabled for an account; otherwise false.

uuid string

The UUID of the account. Refer to Integrations for more information.

PUT[base]/accounts/{accountId}

curl --location -g --request PUT 'https://your.base-url.here/accounts/60ba407d15951453e60e49f8' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "enabled": "false",
  "number": "12345"
}'

Response

Body:

In case of success, the response body contains an Account object providing information about the updated trading account.


Delete an account

Use this method to delete a specified trading account.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

accountId required

The account identifier.

DELETE[base]/accounts/{accountId}

curl --location --request DELETE 'https://your.base-url.here/accounts/60ba407d15951453e60e49f8' \
--header 'Authorization: Bearer <token>'

Response

Body:

In case of success, no response body is returned.


Get account metrics

Use this method to obtain information about number of trades on a specified trading account.

Request

Header parameters:

  • Authorization: Bearer <token>

Path parameters:

accountId required

The account identifier.

GET[base]/accounts/{accountId}/metrics

curl --location --request GET 'https://your.base-url.here/accounts/60ba407d15951453e60e49f8/metrics' \
--header 'Authorization: Bearer <token>'

Response

Body:

In case of success, the response body contains a key-value pair providing information about number of trades on the specified trading account.

RESPONSE BODY EXAMPLE
{
  "total": 1,
  "metrics": [
    {
      "key": "trades",
      "value": 101
    }
  ]
}