# Create strategy

`POST https://api.cryptohopper.com/v1/strategy`

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

Creates a strategy from a list of indicators. When strategy_id is one of the user's strategies, that strategy is overwritten instead.

OAuth scope: `read`, `manage`

Each config item needs id, name, chartperiod, params, type, candle_pattern and keep_signal, and may also have description, necessary, min_buys, min_sells, signal_when, signal_when_value, candle_value and exclusive; any other key makes the config invalid. config may also be sent as a JSON string. image must be a URL that starts with http; otherwise a random default image is used.

## Headers

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

## Example request

```bash
curl -X POST "https://api.cryptohopper.com/v1/strategy" \
  -H "access-token: YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"RSI and SAR","description":"Buys on RSI oversold with a SAR trend filter","image":"https://example.com/strategy.jpg","config":[{"id":"121","name":"RSI with region crossovers (RSI)","type":"buy","params":{"candle_value":{"type":"select","name":"OHLCV Value","options":["open","close","high","low","volume"],"default":"close"},"period":{"type":"number","step":1,"min":1,"max":500,"name":"RSI Period","default":14},"oversold":{"type":"number","step":0.01,"min":0,"max":100,"name":"Oversold threshold","default":30},"overbought":{"type":"number","step":0.01,"min":0,"max":100,"name":"Overbought threshold","default":70},"region_type":{"type":"select","name":"Signal on region","options":["in","out"],"default":"in"}},"chartperiod":"900","candle_pattern":0,"necessary":1,"keep_signal":0}],"min_buys":1,"min_sells":0}'
```

## Response

Example response (illustrative values):

```json
{
    "data": {
        "strategy_id": 369001,
        "message": "Strategy 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.
