# Set take profit

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

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

Sets the take profit percentage on the given open positions, and optionally their layered take profit levels.

OAuth scope: `read`, `manage`

Send percentage_profit, take_profit_levels or both. take_profit_levels is a list of up to 10 levels: profit is the profit percentage at which the level sells, share the percentage of the original position sold; shares may add up to at most 100. It also accepts a JSON string or the shorthand "2:50,4:50". Send [] for no levels, or "inherit" to go back to the hopper's levels. Levels are not saved for positions that have an open sell order. Layered take profit is not supported for margin/futures bots. Not available for exchange arbitrage, market maker, copy and grid 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 |  |
| `percentage_profit` | number | yes | Minimum 0. |

## Example request

```bash
curl -X POST "https://api.cryptohopper.com/v1/hopper/HOPPER_ID/position/settakeprofit" \
  -H "access-token: YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"position_ids":[123456,123457],"percentage_profit":3.5,"take_profit_levels":[{"profit":2,"share":50},{"profit":4,"share":50}]}'
```

## Response

Example response (illustrative values):

```json
{
    "data": "Position percentage profit has been set."
}
```

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.
