POST
https://api.cryptohopper.com/v1/hopper/{id}/template/save
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 About scopes
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.
Example request
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}'
const response = await fetch('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/template/save', {
method: 'POST',
headers: {
"access-token": "YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "BTC scalper",
"description": "Short trades on BTC and ETH",
"save_as": 0
})
});
const data = await response.json();
import requests
response = requests.post(
"https://api.cryptohopper.com/v1/hopper/HOPPER_ID/template/save",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
json={
"name": "BTC scalper",
"description": "Short trades on BTC and ETH",
"save_as": 0
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/hopper/HOPPER_ID/template/save');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'access-token: YOUR_ACCESS_TOKEN',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'BTC scalper',
'description' => 'Short trades on BTC and ETH',
'save_as' => 0,
]),
]);
$data = json_decode(curl_exec($ch), true);
Parameters
Headers
| Name | Type | Required | Description |
|---|---|---|---|
access-token |
string | Required | The OAuth access token of the user. |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string | Required | Hopper ID. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
save_as | number | Optional | Minimum 0. |
name | string | Optional | |
description | string | Optional |
Response
{
"data": {
"template_id": 7890,
"message": "A new template has been saved."
}
}