# Update hopper

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

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

Updates the name and enabled state of the hopper and merges the config keys you send into its config. Returns the result with API keys masked.

OAuth scope: `manage`

Always send name and enabled: a missing name renames the hopper to "Unnamed bot", and a missing enabled (or any value other than 1) disables it. The api_config object in the request model is not read; put keys in config instead.

## 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 |
|---|---|---|---|
| `name` | string | no |  |
| `enabled` | integer | no |  |
| `api_config` | object | no |  |
| &nbsp;&nbsp;`api_key` | string | no |  |
| &nbsp;&nbsp;`api_secret` | string | no |  |
| &nbsp;&nbsp;`kraken_extra_key` | string | no |  |
| &nbsp;&nbsp;`kraken_private_extra_key` | string | no |  |
| &nbsp;&nbsp;`gdax_api_passphrase` | string | no |  |
| &nbsp;&nbsp;`gdax_post_only` | string | no |  |

## Example request

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

## Response

Example response (illustrative values):

```json
{
    "data": {
        "status": 1,
        "message": "Bot has been updated.",
        "name": "My BTC bot",
        "enabled": "1",
        "config": {
            "name": "My BTC bot",
            "exchange": "binance",
            "collect_currency": "usdt",
            "api_key": "***",
            "api_secret": "***",
            "max_open_positions": 10,
            "stop_loss": 1,
            "stop_loss_percentage": 5
        }
    }
}
```

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.
