# Sell positions

`POST https://api.cryptohopper.com/v1/hopper/{id}/position/sell`

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

Places sell orders for the given open positions at the current bid, or at the price you send. Without position_id it sells all open positions of the given currency that are not on hold.

OAuth scope: `trade`

Uses the order rate limit bucket: 1 request per 8 seconds. Optional fields: price (limit price) and market_order (1 for a market order). When selling by currency instead of position_id, data is "Sell order will be placed at the exchange.". If a selected position already has an open order, the call stops there and returns "Order already placed". Requires an active subscription for the hopper.

## 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_id` | array of integer | no |  |

## Example request

```bash
curl -X POST "https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/sell" \
  -H "access-token: YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"position_id":[123456,123457],"market_order":0}'
```

## Response

Example response (illustrative values):

```json
{
    "data": "Sell order for position placed."
}
```

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.
