> 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/grid-bot/create-grid-bot.md).

# Create Grid Bot

<br>

**Description:** Creates a new Grid Bot<br>

**Permission:** BOTS\_WRITEE\
**Security:** SIGNED\ <br>

> <mark style="color:green;">**`POST`**</mark>
>
> `/ver1/grid_bots/manual`

<br>

## Body parameters<br>

**name**     `integer`\
Grid bot name specified by the user\
If not specified, the system will generate a default name automatically\
Characters: `[1 ... 40]`

**account\_id**     `integer`     <mark style="color:orange;">required</mark>\
ID of the exchange account entity where the Grid Bot is created

**pair**     `string`     <mark style="color:orange;">required</mark>\
Trading pair in 3Commas format

Use the [All market pairs](https://github.com/3commas-io/3commas-official-api-docs/blob/gitbook/docs/Grid%20Bot/Market%20data/All%20market%20pairs.md) endpoint to retrieve the list of supported pairs and their format

**upper\_price**     `number`     <mark style="color:orange;">required</mark>\
The maximum price of the trading range, above which the bot will not place sell orders

**lower\_price**     `number`     <mark style="color:orange;">required</mark>\
The minimum price of the trading range, below which the bot will not place buy orders

**grids\_quantity**     `integer`     <mark style="color:orange;">required</mark>\
The number of grid levels between the upper and lower price boundaries

**grid\_type**     `string`\
Type of Grid Bot configuration: `geometric` or `arithmetic` Default: `arithmetic`

**quantity\_per\_grid**     `number`     <mark style="color:orange;">required</mark>\
Quantity allocated for each Grid Bot level order

**order\_currency\_type**     `string`\
The currency type used for placing orders: `base` or `quote`\
Default: `quote`

**profit\_currency\_type**     `string`\
The currency in which the bot will generate profit: `base` or `quote`\
Default: `quote`

**upper\_stop\_loss\_enabled**     `boolean`\
Indicates if upper stop-loss settings are enabled. Use `true` to activate the settings group

**upper\_stop\_loss\_action**     `string`\
The action to perform if the asset price reaches or exceeds the set upper stop-loss level: `stop_bot`, `stop_bot_and_sell`, `stop_bot_and_close_position`

**upper\_stop\_loss\_price**     `number`\
The price level that triggers the upper stop-loss action

**lower\_stop\_loss\_enabled**     `boolean`\
Indicates if lower stop-loss settings are enabled. Use `true` to activate the settings group

**lower\_stop\_loss\_action**     `string`\
The action to perform if the asset price reaches or falls below the set lower stop-loss level: `stop_bot`, `stop_bot_and_sell`, `stop_bot_and_close_position`\
Default: `stop_bot`

**lower\_stop\_loss\_price**     `number`\
The price level that triggers the lower stop-loss action

**leverage\_type**     `string`\
Type of leverage used for the futures account: `cross`,`isolated` Default: `not_specified`,

**leverage\_custom\_value**     `number`\
Custom leverage value set for the Grid Bot

**mode**     `string`\
Type of strategy used by the bot: `reversal`, `long`, `short`

**max\_active\_sell\_lines**     `integer`\
Maximum number of active sell orders that can be placed simultaneously

**trailing\_up\_enabled**     `boolean`\
Indicates if the trailing-up feature is enabled (`true` or not (`false`)

**trailing\_down\_enabled**     `boolean`\
Indicates if the trailing-down feature is enabled (`true` or not (`false`)

**expansion\_down\_enabled**     `boolean`\
Indicates if the grid expansion downwards is enabled (`true` or not (`false`)

**expansion\_down\_stop\_price**     `number`     <mark style="color:orange;">required</mark>\
The price at which the downward grid expansion should stop\
This parameter is required when `expansion_down_enabled` is set to `true`

**expansion\_up\_enabled**     `boolean`\
Indicates if the grid expansion upwards is enabled (`true` or not (`false`)

**expansion\_up\_stop\_price**     `number`     <mark style="color:orange;">required</mark>\
The price at which the upward grid expansion should stop. This parameter is required when `expansion_up_enabled` is set to `true`.

**ignore\_warnings**     `boolean`\
Ignores warnings and forces the creation of the Grid Bot (`true`) or not (`false`)

**note**     `integer`\
Optional user-defined note for the Grid Bot.\
`[1 ... 300]` characters

<br>

## Parameters response<br>

If successful, the response includes a copy of [Grid Bot](/3commas-official-api-docs/grid-bot.md) entity.<br>

## Example Request<br>

```json
{
   "account_id": 12345678,
   "pair": "USDT_ETH",
   "name": "Test GRID",
   "upper_price": 1.1,
   "lower_price": 0.56,
   "quantity_per_grid": 40,
   "grids_quantity": 28,
   "max_active_buy_lines": 28,
   "max_active_sell_lines": 28,
   "order_currency_type": "base",
   "profit_currency_type": "base",
   "ignore_warnings": false,
   "trailing_up_enabled": false,
   "trailing_down_enabled": true,
   "grid_type": "arithmetic",
   "expansion_down_enabled": false,
   "expansion_up_enabled": true,
   "expansion_up_stop_price": 1.57
}
```

## Example Response and errors<br>

<details>

<summary>Status: 201 Created</summary>

<br>

```json
{
   "id": 2291723,
   "account_id": 73223,
   "account_name": "binance",
   "is_enabled": false,
   "grids_quantity": "50",
   "created_at": "2024-07-17T14:46:46.414Z",
   "updated_at": "2024-07-17T14:46:46.505Z",
   "strategy_type": "manual",
   "upper_stop_loss_enabled": true,
   "lower_stop_loss_enabled": true,
   "note": "Example bot",
   "editable": true,
   "lower_price": "56000.0",
   "lower_stop_loss_price": "50000.0",
   "lower_stop_loss_action": "stop_bot_and_sell",
   "upper_price": "72000.0",
   "upper_stop_loss_price": "75000.0",
   "upper_stop_loss_action": "stop_bot",
   "quantity_per_grid": "15.0",
   "leverage_type": "not_specified",
   "leverage_custom_value": null,
   "name": "USDT_BTC EXAMPLE",
   "pair": "USDT_BTC",
   "start_price": null,
   "grid_price_step": "326.530612244897959183673469387755102041",
   "current_profit": "0.0",
   "current_profit_usd": "0.0",
   "total_profits_count": "0",
   "bought_volume": "0.0",
   "sold_volume": "0.0",
   "profit_percentage": "0.0",
   "current_price": "65229.37",
   "max_active_buy_lines": "50",
   "max_active_sell_lines": "50",
   "order_currency_type": "quote",
   "profit_currency_type": "quote",
   "trailing_up_enabled": "true",
   "grid_type": "arithmetic",
   "investment_base_currency": "0.0",
   "investment_quote_currency": "0.0",
   "unrealized_profit_loss": "0",
   "current_profit_loss": null,
   "current_profit_loss_percent": null,
   "orderbook_price_currency": "USDT",
   "expansion_down_enabled": "true",
   "expansion_down_stop_price": "54000.0",
   "grid_lines": [
      {
         "id": 253750214,
         "price": "65142.86",
         "side": null,
         "order_placed": false
      },
      {
         "id": 253750235,
         "price": "72000.0",
         "side": "sell",
         "order_placed": false
      },
      ...
      
      {
         "id": 253750213,
         "price": "64816.33",
         "side": "buy",
         "order_placed": false
      }
   ]
}
```

</details>

<details>

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

<br>

```json
{
    "error": "record_invalid",
    "error_description": "Invalid parameters",
    "error_attributes": {
        "quantity_per_grid": [
            "is missing",
            "is empty"
        ]
    }
}

```

</details>

<details>

<summary>Status: 404 Not Found</summary>

\
{ "error": "not\_found", "error\_description": "Not Found" }

</details>
