---
title: "Generate email"
method: POST
path: "/generate/email"
tags: ["Generation"]
---

# Generate email

`POST /generate/email`

Generates a draft email from scratch as structured editor-compatible blocks. By default, the generated content is wrapped with the company's logo and footer.

## Request body

- object
  - `prompt` string, required — What you want the email to say or accomplish.
  - `style` string — Optional style guidance.
  - `tone` string — Optional tone guidance.
  - `applyBranding` boolean — Whether to wrap generated content with the company logo and footer. Set to false to return raw generated content blocks.
  - `emailType` 'marketing' | 'transactional' — Email type. Transactional emails include a footer without an unsubscribe link.

## Response `200`

Email generated successfully

- object
  - `success` boolean
  - `subject` string
  - `previewText` string
  - `blocks` EmailBlock[] — Generated editor-compatible blocks, including company logo and footer branding unless applyBranding is false.
    - `id` string
    - `type` 'text' | 'html' | 'heading' | 'list' | 'button' | 'spacer' | 'divider' | 'image' | 'columns' | '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.
    - `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'
      - `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.
  - `message` string

## Other responses

- `400` — Validation error
- `401` — Unauthorized
- `403` — No company selected
- `500` — Generation failed

---

[API](https://skmtc.net/sequenzy/apis/sequenzy-api.md) · [All operations](https://skmtc.net/sequenzy/apis/sequenzy-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sequenzy/sequenzy-api/versions/af1cf9620482/schema)
