> ## 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.

# Create Campaign for a Group

> Create a draft from selected contacts, contact filters or an email activity group

Create a blank campaign for a group you have already found. Membership is frozen when the draft is created; new contacts do not join it automatically. Active status, a usable email address and other delivery exclusions are checked again before sending. This endpoint creates no sends and needs no sender setup. It saves contact IDs directly on the draft without creating a list, changing list memberships or enrolling contacts in sequences. The dashboard uses the same selection rules when you choose a campaign template for a filtered group; public clients create a blank draft and then update its content.

You need `campaigns:write` and `subscribers:read`. An `email_activity` selection also needs `analytics:read`. Marketers can select marketing sources; viewers and restricted members cannot create drafts.

## Select contacts

```json theme={null}
{
  "name": "Customer update",
  "selection": {
    "source": "contacts",
    "contacts": { "subscriberIds": ["sub_1", "sub_2"] }
  }
}
```

Omit `subscriberIds` to include **every** matching contact across pages. You can combine `search`, `listId`, `activeOnly` and `excludedSubscriberIds` with either `segmentId`, flat `filters` plus `filterJoinOperator`, or a nested `root`. Do not combine a saved segment with edited filters, or `root` with `filters`. Filters use the same fields and operators as [subscriber filtering](/concepts/subscribers#filtering-subscribers). Search follows contact search semantics. With no filters, the selection includes every contact in the company; email eligibility is reported separately.

## Select an activity group

```json theme={null}
{
  "selection": {
    "source": "email_activity",
    "activity": {
      "campaignId": "camp_original",
      "eventType": "click",
      "period": "7d",
      "includeMachineEngagement": false,
      "mailboxProvider": "google"
    }
  }
}
```

Choose one of `campaignId`, `automationId`, `automationNodeId` or `transactionalId`, or an `audience` of `{ "type": "list" | "segment", "id": "..." }`. An audience can also narrow one email source. Supported events are `send`, `delivery`, `open`, `click`, `bounce` and `unsubscribe`. Periods are `all`, `1h`, `24h`, `7d`, `30d` and `90d`; omitting the period selects all time. The selection also supports `search`, `includeMachineEngagement`, `mailboxProvider`, and bounce-only `bounceType` and `bounceSubType`.

Whole-sequence activity includes regular email steps and A/B email variants. Each contact appears once even if they have multiple matching events. Deleted contacts in historical analytics are omitted. The dashboard additionally honors your global machine-engagement preference; API clients set `includeMachineEngagement` explicitly.

## Response and next steps

`201` returns `campaign`, including the linked blank `email`, and `audience` with `source`, `selectedCount`, `eligibleCount` and `selectedAt`. The saved `targetLists` uses `{ "type": "rules", "include": [], "includedSubscriberIds": [...] }`.

Use [Get Campaign](/api-reference/campaigns/get) or [Get Campaign Audience](/api-reference/campaigns/audience) to review it. [Update Campaign](/api-reference/campaigns/update) edits content, replaces `targetLists`, or clears it with `null`. Clearing removes the saved selection; review the resulting audience before [scheduling](/api-reference/campaigns/schedule). Selected IDs satisfy the include requirement even with an empty `include` array.

Selections are limited to 100,000 matching contacts and 8 MiB of stored audience JSON. Activity selections apply the contact-count limit before removing deleted contacts. Oversized selections are rejected instead of truncated. Use a saved segment for a larger audience.

## Errors

| Status | Meaning                                                                                              |
| ------ | ---------------------------------------------------------------------------------------------------- |
| `400`  | Invalid, ambiguous or incompatible selection, oversized explicit ID arrays, or no matching contacts. |
| `401`  | Missing or invalid API key.                                                                          |
| `403`  | Missing scopes or role permissions. Newly granted scopes are refreshed on retry.                     |
| `404`  | A selected contact or source is missing or outside your company.                                     |
| `413`  | Resolved contact count or stored audience size exceeds the limit.                                    |

Errors return `{ "error": "..." }`. Draft creation is atomic: a failed campaign insert does not leave an orphan email. Repeating a successful creation makes another draft; inspect your campaign list if a response is lost.

Explicit included IDs override exclusions. To remove a contact from a frozen group, remove its ID from `includedSubscriberIds`. Creation-time `selection.contacts.excludedSubscriberIds` removes contacts before the group is frozen.
