---
title: "Generate Email (Async)"
method: POST
path: "/v1/projects/emails/generate"
tags: ["Emails"]
---

# Generate Email (Async)

`POST /v1/projects/emails/generate`

Generate one email or a multi-email series for a project using its brand context and optional images. Requires API key with email:write. Provide count (1-12) to request a specific series length, or omit it to infer from the prompt. Returns immediately with a conversationId and pending status. Use GET /v1/projects/emails/{conversationId}/status to retrieve production HTML, screenshots, and per-email IDs.

## Request body

- GenerateEmailRequest
  - `projectId` string, required
  - `prompt` string, required
  - `images` EmailImage[]
    - `source` EmailImageSource, required
      - `type` 'url', required
      - `url` string, uri, required
  - `model` string
  - `webMode` boolean — Allow MigmaAI to do research, use connectors, mcp and more. It may take longer to generate the email. Use only if the prompt is unclear or requires additional information.
  - `languages` string[] — The languages to generate the email in. If not provided, the email will be generated as instructed by the prompt.
  - `visibility` 'private' | 'unlisted' | 'public' — Set the visibility of the generated conversation. Private conversations are only visible to the user, unlisted conversations are accessible via direct link but not listed publicly, and public conversations are visible in the public gallery.
  - `referenceId` string — Optional conversation ID to remix so you can create personalized variants from an existing conversation.
  - `count` integer — Optional target number of emails to generate for a series. Omit to let Migma infer single email vs series from the prompt.

## Response `200`

Email generation started

- ApiResponseGenerateEmail
  - `success` boolean, required
  - `data` object, nullable
    - `conversationId` string, required — The conversation ID to check status and retrieve results
    - `status` 'pending', required — Initial status is always pending
    - `message` string, required — Information message about the generation process
    - `link` string, uri, required — Direct link to view the generated email. Unlisted and public generations return https://migma.ai/share/{conversationId}; private generations return https://migma.ai/chat?c={conversationId}.
    - `count` integer — Requested email count, when provided.
    - `referenceId` string — Reference conversation used for remixing, when provided.
  - `error` string, nullable

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `404` — Resource not found

---

[API](https://skmtc.net/migma/apis/migma-ai-api-v1.md) · [All operations](https://skmtc.net/migma/apis/migma-ai-api-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/migma/migma-ai-api-v1/revisions/3f3dba69574b/schema)
