---
title: "Opt a member in or out"
description: "Opt a member out of this segment's sends without removing it (subscribed: false), or back in, as the members table's toggle and the preference page do. `PATCH /api/v1/segments/{id}/contacts/{contact}`"
url: https://www.unitpost.com/docs/platform/patch-segments-id-contacts-contact
section: "Platform API reference"
updated: 2026-10-13
---
# Opt a member in or out

`PATCH /api/v1/segments/{id}/contacts/{contact}`

Opt a member out of this segment's sends without removing it (`subscribed: false`), or back in, as the members table's toggle and the preference page do. It stays a member. A dynamic segment has no per-segment opt-out (`422`). Requires the `segments:write` capability.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | — |
| `contact` | path | string | yes | A contact id or email. |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `subscribed` | boolean | yes | `false` opts the contact out of this segment's sends without removing it; `true` opts it back in. |

## Response fields (200)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | — |
| `contact_id` | string | yes | — |
| `subscribed` | boolean | yes | — |
| `unsubscribed_at` | string \| null | yes | — |

## Responses

| Status | Description |
| --- | --- |
| 200 | The membership. |
| 400 | The body isn't JSON. |
| 401 | Missing or invalid API key. |
| 403 | Insufficient scope. |
| 404 | Segment or contact not found, or the contact isn't a member. |
| 422 | A dynamic segment, a bad `subscribed`, or an unknown key. |

## Example request

```bash
curl -X PATCH 'https://www.unitpost.com/api/v1/segments/seg_123/contacts/con_456' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "subscribed": false
  }'
```

## Example response (200)

```json
{
  "object": "segment_member",
  "contact_id": "contact_123",
  "subscribed": false,
  "unsubscribed_at": "2026-01-01T00:00:00.000Z"
}
```

## Links

- HTML reference (with Node.js, Python, Ruby, PHP, Laravel, Go, Java, Rust, .NET and CLI examples): https://www.unitpost.com/docs/platform/patch-segments-id-contacts-contact
- OpenAPI 3.1 (full schemas): https://www.unitpost.com/api/v1/openapi.json
