---
title: "Generate sequence email variations"
method: POST
path: "/sequences/{sequenceId}/emails/{emailId}/variations/generate"
tags: ["Sequences"]
---

# Generate sequence email variations

`POST /sequences/{sequenceId}/emails/{emailId}/variations/generate`

## Request

- Base URL: `https://api.sequenzy.com/api/v1`
- URL: `https://api.sequenzy.com/api/v1/sequences/{sequenceId}/emails/{emailId}/variations/generate`
- Auth: HTTP bearer

Starts designing 1 to 4 variations of one email of a sequence with AI, like "I like email 1, make a few variations" in the sequence editor's Emails view, and returns them at once with status generating. The source is the email's saved content. Generation runs in the background, usually under a minute; poll List Sequence Email Variations until each is ready or failed. The email does not change until you use one. An email can have up to 8 variations generating at once.

## Path parameters

- `sequenceId` string, required
- `emailId` string, required

## Request body

- object
  - `prompt` string, required: The direction for the new versions, in any language.
  - `count` integer
  - `style` 'close' | 'fresh' | 'bold': How far the new versions move from the email. close edits it, keeping its style and structure; fresh writes each version anew with its own structure in the brand's colors and fonts; bold also gives each its own look. Defaults to fresh.

## Response `202`

Generation started

- object
  - `success` boolean
  - `email` object: The email the variations are of.
    - `emailId` string
    - `nodeId` string: Its step, for rendering a variation with Render Sequence Step.
    - `label` string
  - `variations` EmailVariation[]
    - `id` string
    - `emailId` string
    - `parentId` string, nullable: The nearest variation this one descends from that has not been discarded. Null when derived from the email.
    - `label` string: Canvas label. V1, V2, ... for versions of the email; V2.1, V2.2, ... for branches of V2.
    - `name` string
    - `summary` string, nullable: What changed, in a sentence.
    - `prompt` string, nullable: The request that generated this variation.
    - `style` 'close' | 'fresh' | 'bold' | 'null', nullable: How far it was asked to move from its source, when AI generated it.
    - `status` 'generating' | 'ready' | 'failed'
    - `error` string, nullable: Why generation failed.
    - `subject` string, nullable: Subject this variation uses. Null keeps the email's subject.
    - `previewText` string, nullable
    - `blocks` EmailBlock[], nullable: Null while generating or after a failure.
      - `id` string
      - `type` 'text' | 'html' | 'heading' | 'list' | 'button' | 'spacer' | 'divider' | 'image' | 'columns' | 'group' | 'conditional-group' | 'repeat' | 'card' | 'cta' | 'social' | 'logo' | 'header' | 'footer' | 'video' | 'product' | 'discount-code' | 'code' | 'countdown' | 'hero' | 'testimonial' | 'gallery' | 'badge' | 'table' | 'features' | 'image-card' | 'pricing' | 'author' | 'article' | 'rating' | 'stats' | 'steps' | 'product-grid' | 'poll', required
      - `content` string: Content for text, html, and heading-like blocks.
      - `label` string: Editor label for a structural group block.
      - `layout` 'stack' | 'row' | 'grid' | 'overlay': Direct-child layout for a structural group block.
      - `columns` integer: Number of columns used by a group with grid layout.
      - `gap` integer: Gap in pixels between direct group children.
      - `stackOnMobile` boolean: Columns block only. Multi-column rows stack into a single column on screens 480px wide or narrower. Set to false to keep the columns side by side on mobile. Omit or set to true for the default stacking.
      - `padding` integer: Uniform group padding in pixels; per-side styles.padding* fields override it.
      - `overlayColor` string: Opaque fallback and shade color for an overlay group.
      - `overlayShade` integer: Overlay shade intensity as a percentage.
      - `overlayPosition` 'top' | 'center' | 'bottom': Vertical position of overlay foreground content.
      - `children` EmailBlock[]: Recursive child blocks for group and repeat containers.
      - `styles` object: Per-block visual styles. For compatibility, style fields such as backgroundColor, backgroundOpacity, borderColor, borderWidth, and borderRadius can also be supplied at the block top level and are normalized into this object.
        - `paddingTop` number
        - `paddingBottom` number
        - `paddingLeft` number
        - `paddingRight` number
        - `backgroundColor` string
        - `backgroundOpacity` number: Background opacity percentage from 0 to 100.
        - `textColor` string
        - `textAlign` 'left' | 'center' | 'right'
        - `keepAlign` boolean: Keep a centered button, logo or footer centered when the email is left-aligned (layout.contentAlign left). Without it a left email moves these blocks left; right always stays.
        - `borderRadius` number
        - `borderColor` string
        - `borderWidth` number
        - `bleed` boolean: Stretch the block edge-to-edge across the email container. Top-level blocks only.
      - `conditions` object[]: Optional per-block display rules. The block renders only when every rule matches. The same shape is used for a conditional-group block's top-level `conditions`.
        - `id` string, required
        - `field` 'variable' | 'attribute' | 'email' | 'firstName' | 'lastName', required: `variable` resolves a merge-tag path from the transactional send `variables` or an automation `event` payload (nested paths like `order.total` or `event.plan` work). `attribute` reads a stored subscriber attribute. `email`, `firstName`, and `lastName` read core subscriber fields.
        - `operator` 'is' | 'is_not' | 'contains' | 'not_contains' | 'gt' | 'gte' | 'lt' | 'lte' | 'is_empty' | 'is_not_empty', required
        - `value` string, required: For `variable` and `attribute`, use `name:value` - the part before the colon is the variable path or attribute name, and the part after it is the comparison value. For `email`, `firstName`, and `lastName`, provide the plain comparison string.
    - `emailTheme` object, nullable: The variation's own email theme. Null means it uses the email's theme.
    - `fontFamily` string, nullable: The variation's own body font stack. Null means it uses the email's font.
    - `position` object, nullable: Where the user placed it on the editor canvas, in canvas pixels. Null means the canvas places it automatically.
      - `x` integer
      - `y` integer
    - `inUse` boolean: Whether using this variation would leave the campaign email unchanged (same blocks, and its own subject, preview text, theme and font when it has them). When several match, only the one used most recently is in use.
    - `usedAt` string, date-time, nullable: When this variation was last put in the campaign email.
    - `createdAt` string, date-time
    - `updatedAt` string, date-time

## Other responses

- `400`: Empty prompt, an email that is a single raw HTML block (variations need Sequenzy blocks), or the step can't have variations (an A/B test step, a step without an email, or one that sends the same email as an earlier step)
- `401`: Unauthorized
- `403`: API key is missing the required sequences scope
- `404`: Sequence not found, or the email is not one of its steps
- `409`: This email already has 8 variations generating (the limit; wait for some to finish)
- `422`: Request body failed validation
- `503`: Generation could not be started (for example the queue is unavailable). Any variations it created are marked failed; retry the request.

## Changes

- **2026-10-26** `e2e7d27d7804`: 1 info
  - added the optional property `variations/items/blocks/items/styles/keepAlign` to the response with the `202` status
- **2026-10-16** `db3873ca3d4d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/sequenzy/apis/sequenzy-api/changes/sequences/:sequenceId/emails/:emailId/variations/generate/post.md)

---

[API](https://skmtc.dev/sequenzy/apis/sequenzy-api.md) - [All operations](https://skmtc.dev/sequenzy/apis/sequenzy-api/llms.txt) - [OpenAPI document](https://skmtc.dev/sequenzy/apis/sequenzy-api/revisions/3d816357b738?raw)
