# Save template

`POST https://api.cryptohopper.com/v1/hopper/{id}/template/save`

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

Saves the current config of the hopper as a new template, or overwrites one of your templates when save_as is set.

OAuth scope: `read`, `manage`

save_as is the ID of your template to overwrite; leave it out or send 0 for a new template. name and description may be at most 255 characters.

## 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 |
|---|---|---|---|
| `save_as` | number | no | Minimum 0. |
| `name` | string | no |  |
| `description` | string | no |  |

## Example request

```bash
curl -X POST "https://api.cryptohopper.com/v1/hopper/HOPPER_ID/template/save" \
  -H "access-token: YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"BTC scalper","description":"Short trades on BTC and ETH","save_as":0}'
```

## Response

Example response (illustrative values):

```json
{
    "data": {
        "template_id": 7890,
        "message": "A new template has been saved."
    }
}
```

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.
