# Update short position

`POST https://api.cryptohopper.com/v1/hopper/{id}/short/{short_id}/update`

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

Updates the take profit, stop-loss and trailing stop-loss settings of a short position.

OAuth scope: `read`, `manage`

take_profit is applied when above 0. The stop-loss fields are applied only when stop_loss_percentage is above 0: stop_loss 1 turns stop-loss on, 0 or missing turns it off. The trailing fields are applied only when trailing_stop_loss_percentage is above 0, with trailing_stop_loss 1 or 0 in the same way. If the body contains short_ids, those shorts are updated instead of the path short. auto_close, auto_close_time, auto_remove and auto_remove_time are read but not applied as auto close or auto remove settings: use Change settings of short positions for those. Not available for exchange arbitrage, market maker, copy, grid and AI bots.

## Headers

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

## Path parameters

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

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `take_profit` | number | no | Minimum 0. |
| `stop_loss` | number | no | Minimum 0. |
| `stop_loss_percentage` | number | no | Minimum 0. |
| `stop_loss_timeout_count` | integer | no | Minimum 0. |
| `stop_loss_timeout_val` | string | no | One of: minutes, hours, days. |
| `trailing_stop_loss` | number | no | Minimum 0. |
| `trailing_stop_loss_percentage` | number | no | Minimum 0. |
| `trailing_stop_loss_arm` | number | no | Minimum 0. |
| `auto_close` | number | no | Minimum 0. |
| `auto_close_time` | number | no | Minimum 0. |
| `auto_remove` | number | no | Minimum 0. |
| `auto_remove_time` | number | no | Minimum 0. |

## Example request

```bash
curl -X POST "https://api.cryptohopper.com/v1/hopper/HOPPER_ID/short/SHORT_ID/update" \
  -H "access-token: YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"take_profit":2.5,"stop_loss":1,"stop_loss_percentage":3,"trailing_stop_loss":1,"trailing_stop_loss_percentage":1,"trailing_stop_loss_arm":1.5}'
```

## Response

Example response (illustrative values):

```json
{
    "data": "Short position(s) config settings updated."
}
```

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.
