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

> Create an email campaign

Create a campaign and linked email. Campaigns are created as drafts by default. For migrations, pass `status: "sent"` to archive an already-sent campaign without sending email or creating delivery history. You must have at least one sender profile configured before creating campaigns through the API.

## Request

<ParamField body="name" type="string" required>
  Campaign name.
</ParamField>

<ParamField body="subject" type="string" required>
  Email subject line.
</ParamField>

<ParamField body="trackingCode" type="string">
  Optional campaign tracking code available to UTM templates as
  `{{campaign.trackingCode}}`. Empty strings are stored as `null`.
</ParamField>

<ParamField body="status" type="string">
  Initial status. Use `draft` or `sent`; defaults to `draft`. `sent` is for
  imported/already-sent campaigns only.
</ParamField>

<ParamField body="sentAt" type="string">
  ISO date-time for an imported/already-sent campaign. Only valid with `status:
      "sent"`; defaults to the current time when omitted.
</ParamField>

<ParamField body="html" type="string">
  Raw HTML body. Sequenzy converts this into email blocks. Use this or `blocks`,
  not both.
</ParamField>

<ParamField body="blocks" type="array">
  Sequenzy email blocks. Use this or `html`, not both. Put block styling under
  `styles`; top-level style keys like `backgroundColor`, `backgroundOpacity`,
  `borderColor`, `borderWidth`, and `borderRadius` are normalized into `styles`.
</ParamField>

<ParamField body="labels" type="array">
  Label names to assign to the campaign. Missing labels are created
  automatically. The API also accepts `label` as a compatibility alias.
</ParamField>

<ParamField body="campaignData" type="object">
  Campaign-scoped JSON data available while rendering this campaign.
</ParamField>

<ParamField body="computedLists" type="array">
  Personalized list definitions computed from `campaignData`.
</ParamField>

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/campaigns" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "April Launch",
    "subject": "A quick update",
    "labels": ["edm", "launch"],
    "html": "<p>Hello there!</p>"
  }'
```

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/campaigns" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Imported April Launch",
    "subject": "A quick update",
    "status": "sent",
    "sentAt": "2026-05-01T14:00:00Z",
    "html": "<p>Hello there!</p>"
  }'
```

## Responses

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "campaign": {
      "id": "camp_abc123",
      "name": "April Launch",
      "subject": "A quick update",
      "status": "draft",
      "trackingCode": null,
      "labels": ["edm", "launch"],
      "sentAt": null,
      "url": "https://sequenzy.com/dashboard/company/comp_abc123/campaign/camp_abc123",
      "previewUrl": "https://sequenzy.com/dashboard/company/comp_abc123/campaign/camp_abc123?step=review"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "Campaign content: provide either html or blocks, not both."
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "No sender profile configured. Please set up a sender first."
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "Invalid campaign status. Create supports: draft, sent."
  }
  ```

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

  ```json 500 theme={null}
  {
    "success": false,
    "error": "Failed to create campaign"
  }
  ```
</ResponseExample>
