# Close short positions

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

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

Closes the given short positions by placing buy orders at the current ask, or at market.

OAuth scope: `read`, `manage`, `trade`

position_ids are short position IDs; market_order 1 places market orders. Shorts that already have an open order, or for which the quote currency balance is too low, are not closed. When only some shorts could be closed, the call still succeeds with a message saying so. 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 |
|---|---|---|---|
| `id` | string | yes | Hopper ID. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `position_ids` | array of integer | yes |  |

## Example request

```bash
curl -X POST "https://api.cryptohopper.com/v1/hopper/HOPPER_ID/short/close" \
  -H "access-token: YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"position_ids":[223344,223345],"market_order":0}'
```

## Response

Example response (illustrative values):

```json
{
    "data": "Buy orders (2) have been placed for the selected short position(s)."
}
```

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.
