---
title: "Edit sequence emails with AI"
method: POST
path: "/sequences/{sequenceId}/emails/edit"
tags: ["Sequences"]
---

# Edit sequence emails with AI

`POST /sequences/{sequenceId}/emails/edit`

## Request

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

Changes a sequence's emails with AI in one request, like the Emails view in the sequence editor. The prompt says what to change, in any language. Without emailIds the prompt decides which emails change, every email unless it names some. A look change is made identical across the emails it restyles, down to each kind of block's style. A prompt asking to make emails look like one of them copies that email's style exactly, without AI. A request for design variations ("make a few variations of email 1") returns 400; use Generate Sequence Email Variations instead. Each email succeeds or fails on its own; changed emails are saved unless dryRun is true. An email written in HTML is edited as HTML. A/B test steps and steps without an email are skipped. Runs synchronously; one request edits up to 12 emails. An email saved elsewhere while the AI worked is not overwritten (saved false with an error).

## Path parameters

- `sequenceId` string, required

## Request body

- object
  - `prompt` string, required: What should change, in any language.
  - `emailIds` string[]: Only change these emails (emailId from Get Sequence). Omit to let the prompt decide.
  - `sectionIds` string[]: Only change these top-level blocks. Needs exactly one emailIds entry.
  - `dryRun` boolean: Return the new content without saving it.

## Response `200`

Each email's result, in sending order

- object
  - `success` boolean
  - `dryRun` boolean: Whether the changes were only returned, not saved.
  - `emails` object[]
    - `emailId` string
    - `nodeId` string
    - `label` string: How the editor names the step, e.g. Email 2 or Email 3a.
    - `status` 'changed' | 'unchanged' | 'failed'
    - `saved` boolean: Whether the change was saved. False on a dry run and for unchanged or failed emails.
    - `summary` string, nullable: What changed, or why nothing did.
    - `error` string, nullable: Why the email failed, or why a change couldn't be saved.
    - `subject` string, nullable
    - `previewText` string, nullable
    - `blocks` object[], nullable
    - `emailTheme` object, nullable: The email's theme after the change; null when it uses the company's.
    - `fontFamily` string, nullable
  - `skipped` object[]: Email steps the AI can't edit here.
    - `nodeId` string
    - `label` string
    - `emailId` string, nullable
    - `reason` 'ab_test' | 'no_email' | 'shared_email'

## Other responses

- `400`: Empty prompt, unknown emailIds, sectionIds without exactly one email, a prompt naming only emails the sequence doesn't have, a prompt asking for design variations (use Generate Sequence Email Variations), a match whose emailIds list only the email to copy, more than 12 emails, or nothing the AI can edit
- `401`: Unauthorized
- `403`: The API key lacks the sequences:write scope
- `404`: Sequence not found
- `422`: Invalid request body
- `500`: The request failed before any email was changed (retry)
- `503`: The AI couldn't tell which emails the request is about; nothing changed. Retry, or pass emailIds

## Changes

- **2026-10-16** `db3873ca3d4d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/sequenzy/apis/sequenzy-api/changes/sequences/:sequenceId/emails/edit/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/8156dc12d8b4?raw)
