> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequenzy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Save Campaign Audience as Segment

> Save a campaign's non-trivial audience rules as a reusable dynamic segment

Turn a campaign's audience filters and include/exclude rules into a saved dynamic segment you can reuse in future campaigns, sequences, and analytics.

Unlike creating a segment on `emailSent` for the campaign (which references the fixed group of contacts who received it), this endpoint copies the campaign's underlying audience rules into a live segment so new matching contacts join automatically.

> [!NOTE]
>
> This endpoint refuses trivial audiences (all active subscribers, a single list, or a single existing segment) and exclusion rules whose operators cannot be inverted losslessly. Manual contact additions and removals are not carried into the segment; `omitsManualAdjustments` is `true` when the campaign had them.

Requires API key scopes `campaigns:read` and `segments:write`.

## Request

**campaignId** `string` *required*

Campaign ID.

**name** `string`

Name for the new segment (unique per company, up to 255 characters). Defaults
to `<campaign name> audience` when the campaign has a title.

**description** `string`

Optional description saved on the segment.

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/campaigns/camp_abc123/save-segment" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Spring Launch Pro Users",
    "description": "Audience rules from the Spring Launch campaign"
  }'
```

## Response fields

**campaignId** `string`

ID of the source campaign.

**segment** `object`

The created segment record (`id`, `name`, `filters`, `filterJoinOperator`, `format`, and `root` when the segment uses nested groups, event filters, or segment references).

**omitsManualAdjustments** `boolean`

True when the campaign had hand-picked manual additions or removals that were not carried into the dynamic segment.

**includesOpenerExclusions** `boolean`

True when the campaign's resend non-opener exclusions were converted into `emailOpened` `is_not` conditions on the segment.

**warnings** `array`

Optional warnings when a custom attribute filter references an attribute name that ClickHouse has not synced yet.

## Responses

```json 200 theme={null}
{
  "success": true,
  "campaignId": "camp_abc123",
  "segment": {
    "id": "seg_def456",
    "name": "Spring Launch Pro Users",
    "filters": [
      {
        "id": "f1",
        "field": "attribute",
        "operator": "is",
        "value": "plan:pro"
      }
    ],
    "filterJoinOperator": "and",
    "format": "v1"
  },
  "omitsManualAdjustments": false,
  "includesOpenerExclusions": false
}
```

```json 400 theme={null}
{
  "success": false,
  "error": "This campaign targets all active subscribers, so there is no custom filter to save as a segment."
}
```

```json 401 theme={null}
{
  "success": false,
  "error": "Unauthorized"
}
```

```json 403 theme={null}
{
  "success": false,
  "error": "API key is missing required scope: segments:write"
}
```

```json 404 theme={null}
{
  "success": false,
  "error": "Campaign not found"
}
```

```json 409 theme={null}
{
  "success": false,
  "code": "SEGMENT_NAME_ALREADY_EXISTS",
  "error": "Segment name already exists"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.