---
title: "Update a campaign"
description: "Edit a campaign while it's still in draft (edits after that return 409; unschedule a scheduled one first with Unschedule a campaign). `PATCH /api/v1/email/campaigns/{id}`"
url: https://www.unitpost.com/docs/email/patch-email-campaigns-id
section: "Email API reference"
updated: 2026-11-17
---
# Update a campaign

`PATCH /api/v1/email/campaigns/{id}`

Edit a campaign while it's still in `draft` (edits after that return `409`; unschedule a scheduled one first with [Unschedule a campaign](https://www.unitpost.com/docs/email/post-email-campaigns-id-unschedule)). Change its `name`, `subject`, `from`, `preview_text`, `template_id` or `segment_id` (a template or segment gets create's checks: this workspace's, published, not archived). A value equal to the draft's is no edit, so you can send back what you read. Beyond content and targeting, you can: send `archived` to archive/restore it; set `variable_fallbacks` (fill-only per-variable defaults) and/or `excluded_contact_ids` to resolve a send blocked by missing variables — the API equivalent of the dashboard's pre-send fix; set `topic_id` to scope it to a subscription topic (or `null` to clear); set `open_tracking`/`click_tracking` (tri-state; `null` inherits the template/domain default); and set or clear (`null`) the saved `scheduled_at` (a misnamed time key is a `422`). Other keys are ignored. See what's blocking a send with [Validate a campaign](https://www.unitpost.com/docs/email/get-email-campaigns-id-validate). Requires the `campaigns:write` capability.

## Parameters

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

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `archived` | boolean | no | — |
| `name` | string | no | — |
| `template_id` | string | no | — |
| `segment_id` | string | no | — |
| `from` | string | no | — |
| `subject` | string \| null | no | — |
| `preview_text` | string \| null | no | — |
| `topic_id` | string \| null | no | — |
| `open_tracking` | boolean \| null | no | — |
| `click_tracking` | boolean \| null | no | — |
| `variable_fallbacks` | object | no | — |
| `excluded_contact_ids` | string[] | no | — |
| `scheduled_at` | string \| null | no | — |

## Response fields (200)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | — |
| `id` | string | yes | — |
| `name` | string | yes | — |
| `template_id` | string | yes | — |
| `segment_id` | string | yes | — |
| `topic_id` | string \| null | yes | — |
| `from` | string | yes | — |
| `subject` | string \| null | yes | — |
| `preview_text` | string \| null | yes | — |
| `open_tracking` | boolean \| null | yes | — |
| `click_tracking` | boolean \| null | yes | — |
| `status` | enum | yes | One of: `draft`, `scheduled`, `sending`, `paused`, `sent`, `canceled`, `failed`. |
| `scheduled_at` | string \| null | yes | — |
| `variable_fallbacks` | object | yes | — |
| `excluded_contact_ids` | string[] | yes | — |
| `total_recipients` | number | yes | Recipients the engine admitted when the campaign started sending. 0 while it is `draft` or `scheduled`: read `projected_recipients`, or `sendable` from validate. |
| `projected_recipients` | object \| null | no | The audience counted when the campaign was sent or scheduled: `total` segment members, `reachable` who will get it, `skipped` (unsubscribed, suppressed, excluded). Null for a draft that was never sent: read validate. Read-only. |
| `sent_count` | number | yes | — |
| `failed_count` | number | yes | — |
| `pause_reason` | object \| null | yes | — |
| `created_at` | string | yes | — |
| `updated_at` | string | yes | — |

## Responses

| Status | Description |
| --- | --- |
| 200 | The updated campaign. |
| 401 | Missing or invalid API key. |
| 403 | A new `from`'s domain isn't added, is blocked, or isn't verified (`domain_not_found`, `domain_blocked`, `domain_not_verified`). |
| 404 | Campaign, template, segment or topic not found (`details[].field` names which). |
| 409 | Only `draft` campaigns can be edited, or the segment or topic is archived. |
| 422 | Validation error (e.g. an invalid `from`, a draft or transactional template, an exclusion that isn't this workspace's contact), a misnamed send-time key, `recipients` (create-only), `archived` combined with an edit, or a `scheduled_at` without a timezone, in the past, or beyond the scheduling window. |

## Example request

```bash
curl -X PATCH 'https://www.unitpost.com/api/v1/email/campaigns/cmp_123' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{ }'
```

## Example response (200)

```json
{
  "object": "campaign",
  "id": "id_123",
  "name": "Example",
  "template_id": "template_123",
  "segment_id": "segment_123",
  "topic_id": "topic_123",
  "from": "you@yourdomain.com",
  "subject": "Welcome to Acme",
  "preview_text": "string",
  "open_tracking": false,
  "click_tracking": false,
  "status": "draft",
  "scheduled_at": "2026-01-01T00:00:00.000Z",
  "variable_fallbacks": {},
  "excluded_contact_ids": [
    "string"
  ],
  "total_recipients": 1,
  "projected_recipients": {
    "total": 1,
    "reachable": 0,
    "skipped": 0
  },
  "sent_count": 1,
  "failed_count": 1,
  "pause_reason": {
    "code": "user",
    "message": "string",
    "metric": "hard_bounce_rate",
    "value": 0,
    "threshold": 0,
    "sample": {
      "events": 0,
      "of": 0
    },
    "window": {
      "since": "string"
    },
    "decided_by": "floor",
    "resume": "self_serve",
    "paused_at": "2026-01-01T00:00:00.000Z"
  },
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_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/email/patch-email-campaigns-id
- OpenAPI 3.1 (full schemas): https://www.unitpost.com/api/v1/openapi.json
