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

# Update Campaign

> Update a draft campaign's content, labels, or reply-to settings

Update a draft campaign. You can change the campaign name, subject, labels, HTML body, Sequenzy block content, campaign data, computed lists, or reply-to profile.

## Request

<ParamField path="campaignId" type="string" required>
  Campaign ID.
</ParamField>

<ParamField body="name" type="string">
  Updated campaign name.
</ParamField>

<ParamField body="subject" type="string">
  Updated email subject line.
</ParamField>

<ParamField body="previewText" type="string">
  Updated inbox preview text. Send `null` to clear it.
</ParamField>

<ParamField body="preheaderText" type="string">
  Alias for `previewText`.
</ParamField>

<ParamField body="trackingCode" type="string">
  Campaign tracking code available to UTM templates as
  `{{campaign.trackingCode}}`. Send an empty string or `null` to clear it.
</ParamField>

<ParamField body="html" type="string">
  Updated HTML body. Sequenzy converts this into email blocks.
</ParamField>

<ParamField body="blocks" type="array">
  Updated Sequenzy email blocks. Use this instead of `html` when you need
  editor-compatible content or conditional blocks. Do not send both `html` and
  `blocks` in the same request. Put block styling under `styles`; top-level
  style keys like `backgroundColor`, `backgroundOpacity`, `borderColor`,
  `borderWidth`, and `borderRadius` are normalized into `styles`.
</ParamField>

<ParamField body="campaignData" type="object">
  Campaign-scoped JSON data for repeat blocks and personalization. Send `null`
  to clear it.
</ParamField>

<ParamField body="computedLists" type="array">
  Computed list definitions derived from `campaignData` at send time.
</ParamField>

<ParamField body="labels" type="array">
  Replacement label names. Send an empty array to clear labels. Missing labels
  are created automatically. The API also accepts `label` as a compatibility
  alias.
</ParamField>

<ParamField body="replyTo" type="string">
  Existing reply profile email address for this company. Use this or
  `replyProfileId`, not both.
</ParamField>

<ParamField body="replyProfileId" type="string">
  Reply profile ID for this company. Use this or `replyTo`, not both.
</ParamField>

<ParamField body="campaignData" type="object">
  Campaign-scoped JSON data. For example, upload an `events` array that this
  campaign can use while rendering repeat blocks. The MVP supports up to 500
  items per top-level array.
</ParamField>

<ParamField body="computedLists" type="array">
  Personalized list definitions that select items from `campaignData` using
  subscriber attributes. Templates can repeat over each list's `key`; keys use
  letters, numbers, underscores, and dots only. Use `maxItems` to cap how many
  items each subscriber can receive in that list.
</ParamField>

```bash theme={null}
curl -X PUT "https://api.sequenzy.com/api/v1/campaigns/camp_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "blocks": [
      {
        "id": "pro-offer",
        "type": "text",
        "content": "<p>Your Pro upgrade is ready.</p>",
        "variant": "paragraph",
        "conditions": [
          { "id": "c1", "field": "variable", "operator": "is", "value": "plan:pro" }
        ]
      }
    ]
  }'
```

```bash theme={null}
curl -X PUT "https://api.sequenzy.com/api/v1/campaigns/camp_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"preheaderText": "A short preview for the inbox"}'
```

```bash theme={null}
curl -X PUT "https://api.sequenzy.com/api/v1/campaigns/camp_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"labels": ["edm", "launch"]}'
```

```bash theme={null}
curl -X PUT "https://api.sequenzy.com/api/v1/campaigns/camp_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "campaignData": {
      "events": [
        {
          "id": "evt_123",
          "title": "Romeo and Juliet",
          "region": "Auckland",
          "genre": "theatre",
          "url": "https://example.com/events/evt_123"
        }
      ]
    },
    "computedLists": [
      {
        "key": "recommendedEvents",
        "source": "events",
        "maxItems": 6,
        "rules": [
          {
            "itemField": "region",
            "operator": "equals",
            "subscriberField": "region"
          },
          {
            "itemField": "genre",
            "operator": "in",
            "subscriberField": "interests"
          }
        ]
      }
    ]
  }'
```

## Responses

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "campaign": {
      "id": "camp_abc123",
      "name": "April Launch",
      "subject": "A quick update",
      "status": "draft",
      "labels": ["edm", "launch"],
      "replyProfileId": "reply_abc123",
      "replyToName": "Support",
      "replyToEmail": "support@example.com",
      "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": "Provide either replyProfileId or replyTo, not both."
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "Provide at least one of name, subject, previewText, preheaderText, html, blocks, replyTo, replyProfileId, trackingCode, campaignData, computedLists, or labels."
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "Provide either previewText or preheaderText, not both."
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "Rule must provide subscriberField or value unless operator is exists"
  }
  ```

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

  ```json 422 theme={null}
  {
    "type": "validation",
    "on": "body",
    "property": "/replyTo",
    "message": "Expected string to match 'email' format",
    "summary": "Property 'replyTo' should be email"
  }
  ```

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

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