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

# Edit Campaign Variation with AI

> Change one variation with AI and save it

Changes one `ready` variation with AI and saves the result over it, like an edit in the editor. Say what should change in `prompt`, in any language. With `sectionIds`, only those top-level blocks change and everything else stays exactly as it is. A whole-variation edit can also give the variation its own `emailTheme` and `fontFamily`, for example when you ask for a darker look.

The request runs synchronously and can take up to a minute. The campaign email does not change; [use the variation](/api-reference/campaigns/variations-use) for that. To compare several alternatives before choosing, use [Generate Section Options](/api-reference/campaigns/variations-section-options) or [Generate Variations](/api-reference/campaigns/variations-generate) instead.

If the variation changes while the AI is working on it (another request updates it), the edit is not saved and you get a `409`: send the request again.

## Request

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

<ParamField path="variationId" type="string" required>
  Variation ID. It must be `ready`.
</ParamField>

<ParamField body="prompt" type="string" required>
  What should change, 1 to 2,000 characters, in any language.
</ParamField>

<ParamField body="sectionIds" type="string[]">
  Only change these top-level blocks (up to 50). Omit to change the whole
  variation.
</ParamField>

```bash theme={null}
curl -X POST "https://api.sequenzy.com/api/v1/campaigns/camp_abc123/variations/var_9xk2/edit" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "prompt": "Make the headline punchier", "sectionIds": ["h1"] }'
```

## Response

<ResponseField name="variation" type="object">
  The variation, changed and saved. See [List
  Variations](/api-reference/campaigns/variations-list) for its fields.
</ResponseField>

<ResponseField name="summary" type="string">
  What the edit changed, in a sentence.
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "variation": {
      "id": "var_9xk2",
      "emailId": "email_abc123",
      "parentId": null,
      "label": "V2",
      "name": "Warm and personal",
      "summary": "Rewrote the opening in a friendlier voice and shortened the body.",
      "prompt": "Three warmer, shorter versions",
      "style": "fresh",
      "status": "ready",
      "error": null,
      "subject": "A quick note about our pricing",
      "previewText": null,
      "blocks": [
        { "id": "h1", "type": "heading", "content": "Pricing, simplified", "level": 1 }
      ],
      "emailTheme": null,
      "fontFamily": null,
      "position": null,
      "inUse": false,
      "usedAt": null,
      "createdAt": "2026-10-14T09:12:00.000Z",
      "updatedAt": "2026-10-15T08:02:13.000Z"
    },
    "summary": "Made the headline shorter and punchier."
  }
  ```

  ```json 400 theme={null}
  {
    "error": "I couldn't make that change without rewriting your copy, so I left the email unchanged."
  }
  ```

  ```json 409 theme={null}
  {
    "error": "This variation changed while the AI was editing it. Try again."
  }
  ```
</ResponseExample>

## Errors

| Status | Meaning |
| - | - |
| `400` | The AI changed nothing (the error says why), a section is not in the variation, or the campaign is not an email campaign. |
| `401` | Missing or invalid API key. |
| `404` | The campaign or variation was not found. |
| `409` | The variation is still generating or failed, or it changed while the AI was editing it. |
| `500` | The edit failed. Send the request again. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.