---
title: "Remove flagged addresses from the audience"
description: "While a campaign is paused for its delivery quality: take every hard-bounced and complained contact out of its static segment. `POST /api/v1/email/campaigns/{id}/quality/remove-affected`"
url: https://www.unitpost.com/docs/email/post-email-campaigns-id-quality-remove-affected
section: "Email API reference"
updated: 2026-10-13
---
# Remove flagged addresses from the audience

`POST /api/v1/email/campaigns/{id}/quality/remove-affected`

While a campaign is paused for its delivery quality: take every hard-bounced and complained contact out of its static segment. It edits a reusable segment for good. Each removal records its activity and fires `segment.left` (the first at once, the rest within a few minutes); a repeat removes nothing. A campaign that isn't paused for quality, or a filter (dynamic) segment, is a `409` (a filter's matches can't be removed one by one, and they're suppressed anyway). It doesn't resume the campaign. No body. Requires the `segments:write` capability.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | — |

## Response fields (200)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | enum | yes | One of: `campaign_quality_removal`. |
| `removed` | integer | yes | — |

## Responses

| Status | Description |
| --- | --- |
| 200 | How many contacts left the segment. |
| 400 | The body isn't JSON. |
| 401 | Missing or invalid API key. |
| 403 | Insufficient scope. |
| 404 | Campaign not found. |
| 409 | The campaign isn't paused for its delivery quality, or its segment is a filter (dynamic) segment. |
| 422 | A body key (this operation takes none). |
| 503 | `operation_timed_out`: nothing was removed; retry after `Retry-After`. |

## Example request

```bash
curl -X POST 'https://www.unitpost.com/api/v1/email/campaigns/cmp_123/quality/remove-affected' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
```

## Example response (200)

```json
{
  "object": "campaign_quality_removal",
  "removed": 0
}
```

## Links

- HTML reference (with Node.js, Python, Ruby, PHP, Laravel, Go, Java, Rust, .NET and CLI examples): https://www.unitpost.com/docs/email/post-email-campaigns-id-quality-remove-affected
- OpenAPI 3.1 (full schemas): https://www.unitpost.com/api/v1/openapi.json
