Accounts

Use these methods to manage client accounts (such as trading accounts and wallets) and view information about them.

GET[host]/api/v2/my/accounts

Get a list of client accounts

GET[host]/api/v2/accounts/{accountId}

Get client account details

POST[host]/api/v2/my/accounts

Create a new account

PUT[host]/api/v2/my/accounts/{accountId}

PATCH[host]/api/v2/my/accounts/{accountId}

Update an account

Use this method to archive client trading accounts.

POST[host]/api/v2/my/accounts/{accountId}/archive

Archive an account

Get a list of client accounts

Use this method to obtain a list of accounts created for the current client.

Request

Header parameters:

  • Authorization: Bearer <access_token>

Query parameters:

The following filter parameters are available for this method:

alphabeticCurrencyCode

The alphabetic code of a currency in which client accounts are denominated (such as BTC).

permissions

The client permissions. Possible values:

  • deposit

  • exchange

  • trade

  • transferDeposit

  • transferWithdrawal

  • withdrawal

platformId

The identifier of a trading platform on which client accounts are opened.

The following sorting parameter is available for this method:

createTime

The date and time when a client account was created.

Refer to the Query parameters section in the API Overview for details on applying filter and sorting parameters.

GET[host]/api/v2/my/accounts

curl --location -g --request GET 'https://host.name/api/v2/my/accounts?limit=10&offset=0&sort_order=desc&sort_by=createTime&filter[alphabeticCurrencyCode]=BTC&filter[permissions]=nisi amet sint id&filter[platformId]=1' \
--header 'Authorization: Bearer <token>'

Response

A response includes an array of Account objects providing information about the accounts matching the request parameters.

Get client account details

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

Request

Header parameters:

  • Authorization: Bearer <access_token>

Path parameters:

accountId required

The identifier of a client account.

GET[host]/api/v2/accounts/{accountId}

curl --location --request GET 'https://host.name/api/v2/my/accounts/1' \
--header 'Authorization: Bearer <token>'

Response

A response includes an Account object providing information about the specified client account.

Create a new account

Use this method to create new wallets as well as cTrader, MT4 and MT5 trading accounts for the currently authenticated client.

Request

Header parameters:

  • Authorization: Bearer <access_token>

Body:

Specify the following parameters for a wallet or trading account:

productCurrencyId integer required

The identifier of a product currency.

The product currency is a specific currency added to a product for which you want to create a wallet or trading account. A new wallet or account is denominated in a selected currency and created for the product to which the currency refers.

To obtain product currency identifiers, use the method to get a list of product currencies.

leverage integer

The leverage ratio specified for a trading account.

startAmount number

Applicable only for demo accounts.

The initial amount to be deposited to a newly created demo account.

POST[host]/api/v2/my/accounts

curl --location --request POST 'https://host.name/api/v2/my/accounts' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "productCurrencyId": 1,
  "leverage": 0,
  "startAmount": 100,
  "options": {}
}'

Response

A response includes an Account object providing information about the created wallet or trading account.

Update an account

Use this method to change the name of a specified account, which is displayed in the B2Core UI.

Note

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

Request

Header parameters:

  • Authorization: Bearer <access_token>

Path parameters:

accountId required

The account identifier.

Body:

The following field value can be updated for a specified account:

caption string

The account name displayed in the B2Core UI.

PUT[host]/api/v2/my/accounts/{accountId}

curl --location --request PUT 'https://host.name/api/v2/my/accounts/1' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "caption": "Bitcoin"
}'

Response

A response includes an Account object providing information about the account that was updated.

Archive an account

Use this method to archive cTrader, MT4 and MT5 trading accounts. Only the accounts with zero balances can be archived.

If there are available funds on an account, they are transferred to a fallback account before archiving. The fallback account is an account of the personal type, denominated in the same currency as an archived account.

Request

Header parameters:

  • Authorization: Bearer <access_token>

Path parameters:

accountId required

The identifier of an account that you want to archive.

Body:

Specify the following parameter:

fallbackId integer

The identifier of an account to which funds from an archived account are to be transferred.

By default, if this parameter is not specified, funds are transferred to a client account of the personal type, denominated in the same currency as an archived account.

POST[host]/api/v2/my/accounts/{accountId}/archive

curl --location --request POST 'https://host.name/api/v2/my/accounts/1228/archive' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "fallbackId": 2260
}'

Response

In case of success, no response body is returned.