# Update baseconfig

`PATCH https://api.cryptohopper.com/v1/hopper/{id}/config`

Part of [Bot config](https://www.cryptohopper.com/api-documentation/api-reference/bot-config.md) in the Cryptohopper API reference.

Merges the config keys you send into the hopper config, validates the result and saves it. Returns the full saved config.

OAuth scope: `read`, `manage`

Keys you sent that are unknown or fail validation are dropped and listed in ignored_settings; the field is left out when nothing was dropped. For trading bots the number of allowed_coins is limited by the subscription (15, 50 or 75). Set config.load_api_from to the ID of another of your hoppers on the same exchange to copy its API keys. Not available for AI Bots.

## Headers

| Name | Type | Required | Description |
|---|---|---|---|
| `access-token` | string | yes | The OAuth access token of the user. |

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Hopper ID. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `config` | object | no |  |
| &nbsp;&nbsp;`exchange` | string | no |  |
| &nbsp;&nbsp;`base_currency` | string | no |  |
| &nbsp;&nbsp;`allowed_coins` | array of string | no |  |
| &nbsp;&nbsp;`strategy` | string | no |  |
| &nbsp;&nbsp;`num_targets_per_buy` | string | no |  |
| &nbsp;&nbsp;`advanced_settings` | object | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`candle_size` | string | no | One of: 5_min, 15_min, 30_min, 1_hour, 2_hours, 4_hours, 1_day. |
| &nbsp;&nbsp;&nbsp;&nbsp;`stochastic` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stochastic_RSI` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`RSI` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`MACD` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`EMA` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`KAMA` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`SMA` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`bollinger_bands` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_fast_K period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_slow_K_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_slow_KMA_type` | string | no | One of: sma, ema, wma, dema, tema, trima, kama, mama, t3. |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_slow_D_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_slow_DMA_type` | string | no | One of: sma, ema, wma, dema, tema, trima, kama, mama, t3. |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_oversold_threshold` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_overbought_threshold` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_req_for_buy_signal` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_RSI_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_RSI_fast_K_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_RSI_fast_D_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_RSI_fast_DMA_type` | string | no | One of: sma, ema, wma, dema, tema, trima, kama, mama, t3. |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_RSI_oversold_threshold` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_RSI_overbought_threshold` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`stoch_RSI_req_for_buy_signal` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`RSI_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`RSI_oversold_threshold` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`RSI_overbought_threshold` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`RSI_needed_for_buy_signal` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`MACD_fast_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`MACD_slow_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`MACD_signal_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`MACD_req_for_buy_signal` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`EMA_short_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`EMA_long_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`EMA_req_for_buy_signal` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`SMA_short_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`SMA_long_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`SMA_req_for_buy_signal` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`KAMA_short_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`KAMA_long_period` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`KAMA_req_for_buy_signal` | integer | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`bollinger_bands_period` | number | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`bollinger_bands_deviation_upper_band` | number | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`bollinger_bands_deviation_lower_band` | number | no |  |
| &nbsp;&nbsp;&nbsp;&nbsp;`bollinger_bands_MA_type` | string | no | One of: sma, ema, wma, dema, tema, trima, kama, mama, t3. |
| &nbsp;&nbsp;&nbsp;&nbsp;`bollinger_bands_req_for_buy_signal` | integer | no |  |
| &nbsp;&nbsp;`targets_to_buy` | integer | no |  |
| &nbsp;&nbsp;`sell_with_strategy` | integer | no |  |
| &nbsp;&nbsp;`pct_profit` | integer | no |  |
| &nbsp;&nbsp;`ticker_rate` | string | no | One of: highest_bid_lowest_ask, last_tick_if_higher_lower, always_last_tick. |
| &nbsp;&nbsp;`cool_down` | integer | no |  |
| &nbsp;&nbsp;`one_open_order_coin` | integer | no |  |
| &nbsp;&nbsp;`pct_lower_bid` | number | no |  |
| &nbsp;&nbsp;`pct_higher_ask` | number | no |  |
| &nbsp;&nbsp;`stop_loss_pct` | number | no |  |
| &nbsp;&nbsp;`trailing_stop_loss` | integer | no |  |
| &nbsp;&nbsp;`trailing_stop_loss_pct` | number | no |  |
| &nbsp;&nbsp;`trailing_stop_arm_pct` | number | no |  |
| &nbsp;&nbsp;`trailing_stop_buy_pct` | number | no |  |
| &nbsp;&nbsp;`hold_target_is_same` | integer | no |  |
| &nbsp;&nbsp;`only_buy_positive_pairs` | integer | no |  |
| &nbsp;&nbsp;`autoclose_position` | integer | no |  |
| &nbsp;&nbsp;`DCA` | integer | no |  |
| &nbsp;&nbsp;`DCA_after_time` | integer | no |  |
| &nbsp;&nbsp;`DCA_max_retries` | integer | no |  |
| &nbsp;&nbsp;`DCA_pct_trigger` | integer | no |  |
| &nbsp;&nbsp;`DCA_buy_immediately` | integer | no |  |
| &nbsp;&nbsp;`DCA_order_size` | string | no | One of: double_down, triple_down. |
| &nbsp;&nbsp;`sell_order_max_open_time` | integer | no |  |
| &nbsp;&nbsp;`buy_order_max_open_time` | integer | no |  |
| &nbsp;&nbsp;`max_open_positions` | integer | no |  |
| &nbsp;&nbsp;`coin_max_open_pos` | integer | no |  |
| &nbsp;&nbsp;`coin_max_open_pos_pct` | number | no |  |
| &nbsp;&nbsp;`buy_order_amount_pct` | number | no |  |
| &nbsp;&nbsp;`buy_order_min_amount` | number | no |  |
| &nbsp;&nbsp;`max_amount_allocated` | string | no |  |
| &nbsp;&nbsp;`min_buy_amount` | string | no |  |
| &nbsp;&nbsp;`perc_buy_amount` | string | no |  |
| &nbsp;&nbsp;`min_buy_amount_force` | string | no |  |
| &nbsp;&nbsp;`min_buy_score` | string | no |  |
| &nbsp;&nbsp;`min_sell_score` | string | no |  |
| &nbsp;&nbsp;`sell_score_corrected` | string | no |  |
| &nbsp;&nbsp;`buy_score_corrected` | string | no |  |

## Example request

```bash
curl -X PATCH "https://api.cryptohopper.com/v1/hopper/HOPPER_ID/config" \
  -H "access-token: YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"config":{"allowed_coins":["BTC","ETH","SOL"],"max_open_positions":10,"stop_loss":1,"stop_loss_percentage":5}}'
```

## Response

Example response (illustrative values):

```json
{
    "data": {
        "config": {
            "name": "My BTC bot",
            "exchange": "binance",
            "collect_currency": "usdt",
            "api_key": "***",
            "api_secret": "***",
            "allowed_coins": [
                "BTC",
                "ETH",
                "SOL"
            ],
            "max_open_positions": "10",
            "stop_loss": "1",
            "stop_loss_percentage": "5"
        },
        "message": "Config saved.",
        "ignored_settings": [
            "unknown_setting"
        ]
    }
}
```

Status codes: 200. Errors return JSON with `status`, `error` and `message`, plus a numeric `code` when the error comes from the API itself rather than the gateway.
