---
title: "Preview Emails Draft"
method: POST
path: "/api/app-auto-gtm/segments/{segment_id}/preview-emails/draft"
tags: ["AppAutoGtm"]
---

# Preview Emails Draft

`POST /api/app-auto-gtm/segments/{segment_id}/preview-emails/draft`

Render a preview against UNSAVED template instructions.

Companion to GET /preview-emails. The GET reads from
``segment.email_templates`` (saved state). This POST takes the
instructions inline so the editor can validate (preview + moderate)
BEFORE persisting — template only lands in the DB after the user
confirms a clean preview, then PATCH /segments fires Save.

No cache writes. Each call regenerates against the supplied
instructions; the saved-state cache (``generated_email``) is keyed
by ``email_templates_version`` and updates only via the GET path
after Save commits the new version.

Touches generate sequentially so each follow-up receives the prior
touch's body as ``prev_email`` (mirrors the production sender exactly).
``touches`` scopes the render to one editor's touches; a follow-up-only
request anchors on the cached saved-state touch 1.

## Path parameters

- `segment_id` integer, required

## Cookies

- `ex_access` string, nullable
- `ex_org` string, nullable

## Request body

- DraftPreviewRequest — Body for POST /segments/{id}/preview-emails/draft. Renders a preview against UNSAVED template instructions so the user can validate (preview + moderation) before persisting. Template fields are passed inline; the segment's persisted ``email_templates`` is intentionally NOT consulted — this endpoint exists so the user can iterate without writing to the DB until validation passes. ``lead_id`` follows the same semantics as GET /preview-emails: a real lead (any segment in the same project) or one of the 3 synthetic standard-persona sentinel ids (``is_example_lead_id``) when the project has no leads yet. Results are NOT cached. Cache writes belong to the saved-state path (Save → bumped version → GET fetches and caches by version).
  - `lead_id` string, required
  - `instructions` string
  - `followup_instructions` string
  - `language` string
  - `touches` integer[], nullable
  - `prev_email` DraftPrevEmail
    - `subject` string
    - `body` string

## Response `200`

Successful Response

- GeneratedEmailPayload[]
  - `id` string, required
  - `segment_id` integer, required
  - `lead_id` string, required
  - `touch_number` integer, required
  - `email_templates_version` integer, required
  - `subject` string, required
  - `body` string, required
  - `lead_first_name` string
  - `lead_last_name` string
  - `lead_company_name` string
  - `language_used` string
  - `language_reason` string
  - `highlights` EmailHighlight[]
    - `text` string, required
    - `kind` 'research' | 'ab_test' | 'instructions' | 'playbook', required
    - `title` string, required
    - `explanation` string, required
    - `sources` string[]
  - `cache_hit` boolean

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/explee/apis/explee-api.md) · [All operations](https://skmtc.dev/explee/apis/explee-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/explee/explee-api/revisions/f169bc6e9447/schema)
