> For the complete documentation index, see [llms.txt](https://3commas.gitbook.io/3commas-official-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://3commas.gitbook.io/3commas-official-api-docs/account/add-exchange-account.md).

# Add exchange account

**Description:** Adds a new exchange account<br>

{% hint style="warning" %}
Please note that connections using manually created API keys are available only to **Expert** plan subscribers and exclusively for *Binance* sub-accounts.
{% endhint %}

<br>

**Permission:** ACCOUNTS\_WRITE\
**Security:** SIGNED\ <br>

***

<mark style="color:green;">**POST**</mark>

<mark style="color:green;">**/ver1/accounts/new**</mark>

***

<br>

## Body Parameters<br>

**type**     `string`     <mark style="color:orange;">required</mark>\
3Commas of exchange code entity

**name**     `string`     <mark style="color:orange;">required</mark>\
Name of this exchange account

**api\_key**     `string`     <mark style="color:orange;">required</mark>\
API-key from this exchange account

**secret**     `string`     <mark style="color:orange;">required</mark>\
Secret-key from this exchange account

**address**     `string`     <mark style="color:orange;">required</mark>\
Address of wallet. This parameter is required when `type` is set to `ethereumwallet`

**customer\_id**     `string`     <mark style="color:orange;">required</mark>\
Unique customer ID provided by the Bitstamp exchange.\
This parameter is required when `type` is set to `Bitstamp`

**passphrase**     `string`     <mark style="color:orange;">required</mark>\
Secret phrase from this exchange account.\
This parameter is required when `type` is set to `Coinbase`

**types\_to\_create**     `` `array[string]` ``     <mark style="color:orange;">required</mark>\
Array of related account types to be created.\
For example: \[`binance_margin`]

\ <br>

## Response Parameters<br>

**id**     `integer`\
ID of the exchange account entity

**name**     `string`\
The name for the exchange account defined by the user

**exchange\_name**     `string`\
Name of this exchange account

**market\_icon**     `string`\
The URL link to the icon for this exchange

**market\_code**     `string`\
3Commas of exchange code entity

**auto\_balance\_period**     `integer`\
The interval, in hours, at which automatic portfolio balancing occurs

**auto\_balance\_portfolio\_id**     `integer`\
ID of the portfolio for which automatic balancing has been initiated

**autobalance\_enabled**     `boolean`\
Indicates whether auto balance mode is enabled for this account (`true`) or not (`false`)

**auto\_balance\_error**     `string` or `null`\
A description comes up to explain why autobalance failed

**last\_auto\_balance**     `string` or `null`\
ISO 8601 datetime of when this Auto balance was last time

**hedge\_mode\_available**     `boolean`\
Indicates whether hedge mode is available for this account (`true`) or not (`false`)

**hedge\_mode\_enabled**     `boolean`\
Indicates whether hedge mode is enabled for this account (`true`) or not (`false`)

**is\_locked**     `boolean`\
Indicates if the account is locked (`true`) or not (`false`)

**lock\_reason**     `string` or `null`\
The reason for locking this account when `is_locked` is `true`

**smart\_trading\_supported**     `boolean`\
Indicates if smart trading is supported (`true`) or not (`false`)

**stats\_supported**     `boolean`\
Indicates whether statistic of profit are supported for this account (`true`) or not (`false`)

**trading\_supported**     `boolean`\
Indicates if trading is supported at 3Commas (`true`) or not (`false`)

**market\_buy\_supported**     `boolean`\
Indicates whether creating a market buy order is supported on the exchange (`true`) or not (`false`)

**market\_sell\_supported**     `boolean`\
Indicates whether creating a market sell order is supported on the exchange (`true`) or not (`false`)

**conditional\_buy\_supported**     `boolean`\
Indicates whether creating a conditional buy order is supported on the exchange (`true`) or not (`false`)

**bots\_allowed**     `boolean`\
Indicates whether DCA Bot is enabled for this account (`true`) or not (`false`)

**bots\_ttp\_allowed**     `boolean`\
Indicates whether the trailing take profit feature is enabled on this account (`true`) or not (`false`)

**bots\_tsl\_allowed**     `boolean`\
Indicates whether the trading stop loss feature is enabled on this account (`true`) or not (`false`)

**multi\_bots\_allowed**     `boolean`\
Indicates whether the Multi-Pair feature is supported for this account (`true`) or not (`false`)

**fast\_convert\_available**     `boolean`\
Indicates whether the \[Sell All to BTC/USD]\(<https://help.3commas.io/en/articles/5898691-rebalance-your-portfolio-with-sell-all-to-usdt-or-sell-all-to-btc>) feature is enabled for this account (`true`) or not (`false`)

**grid\_bots\_allowed**     `boolean`\
Indicates whether Grid Bot is enabled for this account (`true`) or not (`false`)

**api\_key**     `string`\
API key used for the account

**api\_key\_invalid**     `boolean`\
Indicates whether the API key for this account is invalid (`true`) or not (`false`)

**api\_keys\_state**     `string`\
Indicates the state of the API keys

**deposit\_enabled**     `boolean`\
Indicates whether the Deposit feature is enabled for this account (`true`) or not (`false`)

**available\_include\_in\_summary**     `boolean`\
Indicates whether this account is available to be included in the summary (`true`) or not (`false`)

**include\_in\_summary**     `boolean`\
Indicates whether this account included in the summary (`true`) or not (`false`)

**supported\_market\_types**     `array`\
The type of market supported by the connected exchange account

**customer\_id**     `string`\
Unique customer ID provided by the Bitstamp exchange

**btc\_amount**     `string`\
Amount of Bitcoin in the account

**usd\_amount**     `string`\
Amount in USD in the account

**day\_profit\_btc**     `string`\
Daily profit in BTC

**day\_profit\_usd**     `string`\
Daily profit in USD

**day\_profit\_btc\_percentage**     `number`\
Daily profit percentage in BTC

**day\_profit\_usd\_percentage**     `number`\
Daily profit percentage in USD

**btc\_profit**     `number`\
Monthly profit in BTC

**usd\_profit**     `number`\
Monthly profit in USD

**btc\_profit\_percentage**     `number`\
Monthly profit percentage in BTC

**usd\_profit\_percentage**     `number`\
Monthly profit percentage in USD

**total\_btc\_profit**     `number`\
Total profit in BTC

**total\_usd\_profit**     `number`\
Total profit in USD

**created\_at**     `string`\
ISO 8601 datetime of when this Account entity was created

**updated\_at**     `string`\
ISO 8601 datetime of when this SmartTrade entity was updated

\ <br>

## Example Request<br>

```json
POST /ver1/accounts/new
```

```json
Body:
{
    "type": "binance",
    "name": "New account",
    "api_key": "6q4zuONXKixxxxxxx3K46W34w...",
    "secret": "7CfL1slTgxxxxxxxPDfoJSPxxxxIsOFx..."
}
```

\ <br>

## Example Response and errors<br>

<details>

<summary>Status: 200 OK</summary>

<br>

```json
{
    "id": 32849081,
    "auto_balance_period": 12,
    "auto_balance_portfolio_id": null,
    "auto_balance_currency_change_limit": null,
    "autobalance_enabled": false,
    "hedge_mode_available": false,
    "hedge_mode_enabled": false,
    "is_locked": false,
    "smart_trading_supported": true,
    "stats_supported": true,
    "trading_supported": true,
    "market_buy_supported": true,
    "market_sell_supported": true,
    "conditional_buy_supported": true,
    "bots_allowed": true,
    "bots_ttp_allowed": false,
    "bots_tsl_allowed": true,
    "gordon_bots_available": true,
    "multi_bots_allowed": true,
    "created_at": "2024-09-17T23:55:19.607Z",
    "updated_at": "2024-09-17T23:55:19.607Z",
    "last_auto_balance": null,
    "fast_convert_available": true,
    "grid_bots_allowed": true,
    "api_key_invalid": false,
    "market_icon": "https://3commas.io/img/exchanges/okex.png",
    "deposit_enabled": true,
    "include_in_summary": true,
    "supported_market_types": [
        "spot"
    ],
    "primary_display_currency_profit_percentage": {
        "currency": "USD",
        "amount": "-0.0"
    },
    "primary_display_currency_profit": {
        "currency": "USD",
        "amount": "-0.00000000000000000010999999999999999999993138892165683112"
    },
    "day_profit_primary_display_currency_percentage": {
        "currency": "USD",
        "amount": "-0.0"
    },
    "day_profit_primary_display_currency": {
        "currency": "USD",
        "amount": "-0.00000000000000000010999999999999999999993138892165683112"
    },
    "primary_display_currency_amount": {
        "currency": "USD",
        "amount": "0.00048395892787478689000000000000000000006861107834316888"
    },
    "total_primary_display_currency_profit": {
        "currency": "USD",
        "amount": -1.1e-19
    },
    "available_include_in_summary": true,
    "api_key": "4ce4943c-f478-46c3-b50b-70de4d1bc34d",
    "name": "test",
    "auto_balance_method": null,
    "auto_balance_error": null,
    "customer_id": null,
    "subaccount_name": null,
    "lock_reason": null,
    "btc_amount": "0.0000000080232449796548201579586071525673247181448663178",
    "usd_amount": "0.00048395892787478689000000000000000000006861107834316888",
    "day_profit_btc": "0.0000000000000000000000001579586071525673247181448663178",
    "day_profit_usd": "-0.00000000000000000010999999999999999999993138892165683112",
    "day_profit_btc_percentage": "0.0",
    "day_profit_usd_percentage": "-0.0",
    "btc_profit": "0.0000000000000000000000001579586071525673247181448663178",
    "usd_profit": "-0.00000000000000000010999999999999999999993138892165683112",
    "usd_profit_percentage": "-0.0",
    "btc_profit_percentage": "0.0",
    "total_btc_profit": "1.5795860715256732e-25",
    "total_usd_profit": "-1.1e-19",
    "pretty_display_type": "Okex",
    "exchange_name": "OKX Spot",
    "market_code": "okex",
    "api_keys_state": "ok"
}
```

</details>

<details>

<summary>Status: 400 Bad Request</summary>

<br>

```json
{
    "error": "record_invalid",
    "error_description": "Invalid parameters",
    "error_attributes": {
        "api_key": [
            "This account is already connected!"
        ]
    }
}
```

</details>
