---
title: "Generate section options"
method: POST
path: "/campaigns/{campaignId}/variations/section-options"
tags: ["Campaigns"]
---

# Generate section options

`POST /campaigns/{campaignId}/variations/section-options`

## Request

- Base URL: `https://api.sequenzy.com/api/v1`
- URL: `https://api.sequenzy.com/api/v1/campaigns/{campaignId}/variations/section-options`
- Auth: HTTP bearer

Generates 1 to 4 alternative versions of selected sections (top-level blocks) of the email or of one variation, and returns them without saving anything. Each option holds replacement blocks that keep the selected blocks' ids; apply one by swapping those blocks into the variation's blocks and calling Update variation. Changes the AI makes outside the selected sections are dropped. Runs synchronously and can take up to a minute.

## Path parameters

- `campaignId` string, required

## Request body

- object
  - `variationId` string: Vary this variation's sections. Omit to vary the email's saved content.
  - `sectionIds` string[], required: Ids of top-level blocks to vary.
  - `prompt` string, required
  - `count` integer
  - `style` 'close' | 'fresh' | 'bold': How far the options move from the selected sections. close stays near them; fresh and bold try clearly different takes. Defaults to fresh.

## Response `200`

Options. Options that changed nothing are left out, so there can be fewer than count.

- object
  - `success` boolean
  - `options` EmailSectionOption[]
    - `name` string
    - `summary` string
    - `replacements` EmailBlock[]: New versions of the selected blocks, keeping their ids.
      - `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.

## Other responses

- `400`: A sectionId is not a top-level block of the source, the email is a single raw HTML block, the AI produced no changes for these sections, or not an email campaign
- `401`: Unauthorized
- `404`: Campaign or variation not found
- `409`: The variation is still generating or failed
- `500`: Generating the options failed. Retry the request.

## Changes

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

[Operation history](https://skmtc.dev/sequenzy/apis/sequenzy-api/changes/campaigns/:campaignId/variations/section-options/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)
