# Merge positions

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

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

Merges the given open positions into one position per coin, with the combined amount at the average rate. Positions on hold, already sold or with an open order are left out.

OAuth scope: `read`

position_id must be an array with at least 2 position IDs. The response is the same when none of the positions could be merged. Not available for copy bots, exchange arbitrage, market maker 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_id` | array of integer | yes |  |

## Example request

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

## Response

Example response (illustrative values):

```json
{
    "data": "Positions have been merged."
}
```

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.
