# Move contacts between segments

> POST /segments/:id/move — move one contact, or every contact, from this segment to another.

`POST /segments/:id/move`

Takes contacts out of segment `:id` and puts them in `destination_id`, in one step. Both segments must be on the same domain. The contacts themselves, their opt-outs and their other segments are not changed. If the destination has rules (subscription status, properties or engagement), every moved contact must match them, or nothing is moved. Needs a full-access API key. A sending-only key gets `401 restricted_api_key`.

**Body parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `destination_id` | string | Yes | The segment to move the contacts to. |
| `contact_id` | string | No | Move this one contact. Send either `contact_id` or `all: true`. |
| `all` | boolean | No | `true` moves every contact currently in the segment. |
| `preview` | boolean | No | `true` checks the move and returns the count without moving anything. |
| `expected_count` | integer | No | The count from a preview. If the segment no longer holds exactly that many, nothing is moved (409). |

**Request**

```bash
curl -X POST 'https://www.senddart.com/api/segments/SEGMENT_ID/move' \
  -H 'Authorization: Bearer mb_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{ "destination_id": "DESTINATION_SEGMENT_ID", "all": true, "expected_count": 120 }'
```

**Response**

```json
{
  "source_id": "c0a8012e-…",
  "destination_id": "5d1e7f20-…",
  "source_name": "Trial users",
  "destination_name": "Customers",
  "count": 120,
  "preview": false,
  "moved": 120
}
```

Errors: `validation_error` (422) for a bad body, the same segment twice, segments on different domains, or contacts that do not match the destination’s rules; `validation_error` with status `409` when the contact left the segment or the count changed; `not_found` when either segment is not yours; `application_error` (503) when the segment is busy — retry.
