Accounts

Use these methods to manage client trading accounts and wallets.

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

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

Archive an account

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

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

Update an account

Use these methods to change or restore passwords for client trading accounts opened on the MT4, MT5, and cTrader platforms.

GET[host]/api/v2/my/accounts/{accountId}/password/wizard

Initialize the wizard for changing a trading account password

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

Confirm a procedure of changing a trading account password

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

Change a trading account password

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

Restore a trading account password

Get a list of client accounts

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

Request

Header parameters:

  • accept-language: <string>

  • Accept: application/json

  • Authorization: Bearer <access_token>

Query parameters:

The following filter parameters are available for this method:

alphabeticCurrencyCode

The alphabetic code of a currency in which a client account is denominated, such as BTC.

permissions

The permissions assigned to a client account. Possible values:

  • deposit

  • exchange

  • trade

  • transferDeposit

  • transferWithdrawal

  • withdrawal

  • enabled

  • visible

platformId

The identifier of a trading platform on which a client account is 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 --request GET 'https://host.name/api/v2/my/accounts?limit=10&offset=0&sort_order=desc&sort_by=createTime&filter[alphabeticCurrencyCode]=BTC&filter[permissions]=deposit&filter[platformId]=1' \
--header 'accept-language: <string>' \
--header 'Accept: application/json' \
--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 specific client account.

Request

Header parameters:

  • accept-language: <string>

  • Accept: application/json

  • Authorization: Bearer <access_token>

Path parameters:

accountId required

The account identifier.

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

curl --location --request GET 'https://host.name/api/v2/my/accounts/1' \
--header 'accept-language: <string>' \
--header 'Accept: application/json' \
--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 MT4, MT5, and cTrader trading accounts for the currently authenticated client.

Request

Header parameters:

  • accept-language: <string>

  • Content-Type: application/json

  • Accept: application/json

  • Authorization: Bearer <access_token>

Body:

productCurrencyId integer required

The identifier of a product currency.

The product currency is a specific currency added for a product that was configured in the Back Office. A new wallet or trading account is denominated in a selected currency and created based on the product to which the currency refers.

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

leverage number

Applicable only for trading accounts.

The leverage ratio assigned to a trading account.

startAmount number required

Applicable only for demo accounts.

The initial amount 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 'accept-language: <string>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "productCurrencyId": 1,
  "leverage": 100,
  "startAmount": 100,
  "options": {}
}'

Response

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

Archive an account

Use this method to archive MT4, MT5, and cTrader 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:

  • accept-language: <string>

  • Content-Type: application/json

  • Authorization: Bearer <access_token>

Path parameters:

accountId required

The identifier of an account that you want to archive.

Body:

fallbackId integer required

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

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

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

Response

In case of success, no response body is returned.

Update an account

Use this method to change the account name displayed in the B2Core UI, as well as mark or unmark an account as favorite.

Note

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

Request

Header parameters:

  • accept-language: <string>

  • Content-Type: application/json

  • Accept: application/json

  • Authorization: Bearer <access_token>

Path parameters:

accountId required

The identifier of an account that you want to update.

Body:

caption string required

The account name displayed in the B2Core UI.

favorite boolean

If true, an account is marked as favorite; otherwise, false.

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

curl --location --request PUT 'https://host.name/api/v2/my/accounts/1' \
--header 'accept-language: <string>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "caption": "Bitcoin",
  "favorite": true
}'

Response

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

Initialize the wizard for changing a trading account password

Use this method to initialize the wizard for changing a trading account password.

Passwords can be changed for MT4, MT5, and cTrader trading accounts.

Request

Header parameters:

  • Accept: application/json

  • Authorization: Bearer <access_token>

Path parameters:

accountId required

The identifier of a trading account for which you want to change a password.

passwordType required

The type of a trading account for which you want to change a password. Possible values:

  • investor — a trading account registered as an investment account in B2Core

  • master — a trading account registered as a master account in B2Core

  • main — a trading account that hasn’t been registered as an investment or master account in B2Core

GET[host]/api/v2/my/accounts/{accountId}/password/wizard

curl --location --request GET 'https://host.name/api/v2/my/accounts/1/password/wizard?passwordType=main' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>'

Response

code integer

An HTTP code specifying the current step of a procedure of changing a trading account password:

  • HTTP code 200 for an intermediary step after which another page of a form used to change a trading account password is displayed to a client

  • HTTP code 202 for a final wizard step signaling that a trading account password was successfully changed

data object or null

The details about a verification code required to confirm a password change for a trading account.

Show object fields
expiredAt string

The date and time when a verification code sent to a client email address is due to expire.

sentAt string

The date and time when a verification code was sent to a client email address.

recipient object

The details about a verification code recipient.

Show object fields
template string

The name of an email template used to deliver a verification code.

email string

The client email address to which a verification code was sent.

name string

The client’s name.

url object

The URL of a webpage for entering a verification code.

method string

The method used to deliver a verification code.

done boolean

If true, a trading account password was successfully changed; otherwise, false.

Always false at this step, indicating that confirmation with a verification code is required to change a trading account password.

uuid string

The universally unique identifier (UUID) assigned to a procedure of changing a trading account password.

workflow string

A string value indicating the next step of a procedure of changing a trading account password.

RESPONSE EXAMPLE
{
  "code": 200,
  "data": {
    "status": 0,
    "sent": 1,
    "expiredAt": "2022-01-01T00:00:00+00:00",
    "sentAt": "2022-01-01T00:00:00+00:00",
    "recipient": {
      "template": "changeAccountPassword",
      "email": "jdow@example.com",
      "name": "John Dow",
      "url": {
        "example": "url/e57d34c6-4e64-4998-909b-b649294fbd04/44353"
      },
      "method": "email"
    }
  },
  "done": false,
  "uuid": "36f59381-5b54-48bd-a0c7-3b908c476732",
  "workflow": "login"
}

Confirm a procedure of changing a trading account password

After initializing the wizard for changing a trading account password, confirm a procedure of password change with a verification code delivered to a client email address.

Request

Header parameters:

  • Content-Type: application/json

  • Accept: application/json

  • Authorization: Bearer <access_token>

Path parameters:

accountId required

The identifier of a trading account for which you want to change a password.

Body:

code integer required

The verification code delivered to a client email address.

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

curl --location --request POST 'https://host.name/api/v2/my/accounts/1/password/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "code": 78563
}'

Response

code integer

An HTTP code specifying the current step of a procedure of changing a trading account password:

  • HTTP code 200 for an intermediary step after which another page of a form used to change a trading account password is displayed to a client

  • HTTP code 202 for a final wizard step signaling that a trading account password was successfully changed

done boolean

If true, a trading account password was successfully changed; otherwise, false.

Always false at this step, indicating that confirmation has succeeded, and a trading account password can be changed to a new one.

uuid string

The universally unique identifier (UUID) assigned to a procedure of changing a trading account password.

workflow string

A string value indicating the next step of a procedure of changing a trading account password.

RESPONSE EXAMPLE
{
  "code": 200,
  "data": {},
  "done": false,
  "uuid": "36f59381-5b54-48bd-a0c7-3b908c476732",
  "workflow": "account_password_change"
}

Change a trading account password

After confirming a procedure of changing a trading account password with a verification code, specify a new password for the trading account.

Request

Header parameters:

  • Content-Type: application/json

  • Accept: application/json

  • Authorization: Bearer <access_token>

Path parameters:

accountId required

The identifier of a trading account for which you want to change a password.

Body:

password string required

A new password specified for a trading account.

passwordConfirmation string required

The repeatedly specified new password.

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

curl --location --request PUT 'https://host.name/api/v2/my/accounts/1/password' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "password": "1234567As",
  "passwordConfirmation": "1234567As"
}'

Response

code integer

An HTTP code specifying the current step of a procedure of changing a trading account password:

  • HTTP code 200 for an intermediary step after which another page of a form used to change a trading account password is displayed to a client

  • HTTP code 202 for a final wizard step signaling that a trading account password was successfully changed

done boolean

If true, a trading account password was successfully changed; otherwise, false.

uuid string

The universally unique identifier (UUID) assigned to a procedure of changing a trading account password.

workflow string

A string value indicating the next step of a procedure of changing a trading account password.

RESPONSE EXAMPLE
{
  "code": 202,
  "data": {},
  "done": true,
  "uuid": "6f59381-5b54-48bd-a0c7-3b908c476732",
  "workflow": "terminated"
}

Restore a trading account password

Use this method to restore a trading account password if it was forgotten by a client.

Passwords can be restored for MT4, MT5, and cTrader trading accounts.

Request

Header parameters:

  • Authorization: Bearer <access_token>

Path parameters:

accountId required

The identifier of a trading account for which you want to restore a password.

Body:

passwordType string required

The type of a trading account for which you want to restore a password. Possible values:

  • investor — a trading account registered as an investment account in B2Core

  • master — a trading account registered as a master account in B2Core

  • main — a trading account that hasn’t been registered as an investment or master account in B2Core

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

curl --location --request POST 'https://host.name/api/v2/my/accounts/1/password/restore' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "passwordType": "main"
}'

Response

In case of success, no response body is returned.

The email containing a new password for a specified trading account has been sent to a client who owns the account.