AI Template Generation
Generate complete email templates from natural language prompts or a guided brief.
AI Template Generation
Templated's AI generation endpoint lets you describe an email in plain English and receive a complete, styled template. The AI uses your brand kit (colors, logos, fonts) to create on-brand designs.
Generation has two modes:
- Prompt mode (default) — one free-text prompt.
- Guided mode — a structured brief (purpose, content, vibe, layout, background, image preferences) collected through a short interview.
Generate a template (prompt mode)
curl -b cookies.txt -X POST \
https://app.templated.email/api/accounts/{slug}/ai/generate \
-H "Content-Type: application/json" \
-d '{
"prompt": "Create a welcome email for new users of a project management tool. Include a hero section, 3 feature highlights, and a CTA to start a free trial.",
"emailType": "welcome"
}'Request body
| Field | Type | Required | Description |
|---|---|---|---|
mode | enum | No | prompt (default) or guided |
prompt | string | Prompt mode | Description of the email, max 5000 chars |
brief | object | Guided mode | Structured brief — see below |
emailType | enum | No | newsletter, announcement, welcome, promotion, event, update, re-engagement, or transactional |
referenceContent | string | No | Existing copy or content to base the email on, max 10000 chars |
conversationId | string (uuid) | No | Continue an existing generation conversation for iterative refinement |
parentGenerationId | string (uuid) | No | The generation you're refining |
Response
{
"generationId": "9a8b7c6d-...",
"conversationId": "1f2e3d4c-...",
"status": "completed",
"result": {
"craftState": { "ROOT": { "...": "..." } },
"subjectLine": "Welcome aboard — let's get you set up",
"previewText": "Three things to try in your first five minutes."
},
"usage": {
"generationsUsedToday": 3,
"generationsRemainingToday": 7,
"planLimit": 10
},
"warnings": []
}result.craftState is a block-based document — see the Template Document Reference. Serialize it to a string and save it via the create template endpoint with source: "ai".
Guided mode
Send mode: "guided" with a brief instead of a prompt:
curl -b cookies.txt -X POST \
https://app.templated.email/api/accounts/{slug}/ai/generate \
-H "Content-Type: application/json" \
-d '{
"mode": "guided",
"brief": {
"purpose": "Announce our summer sale",
"content": "30% off all plans through August 15. Code SUMMER30. Emphasize urgency without being pushy.",
"vibe": "bright, energetic",
"layout": "hero-two-col",
"background": "soft-tint",
"images": "stock"
}
}'Brief fields
| Field | Type | Required | Description |
|---|---|---|---|
purpose | string | Yes | What the email is for, max 200 chars |
content | string | Yes | What it should say, max 5000 chars |
vibe | string | No | Tone/mood, max 200 chars |
layout | enum | No | single-column, hero-two-col, zigzag, grid, or ai-decide |
background | enum | No | white-clean, soft-tint, bold-color, or photo-forward |
images | enum | No | own, stock, or none |
followUp | object | No | { question, answer } from the follow-up endpoint below |
Follow-up question
Given a brief, the AI can ask one clarifying question before generating:
curl -b cookies.txt -X POST \
https://app.templated.email/api/accounts/{slug}/ai/follow-up \
-H "Content-Type: application/json" \
-d '{ "brief": { "purpose": "...", "content": "..." } }'Pass the returned question and the user's answer back in brief.followUp when calling generate.
Tips for better prompts
Be specific about structure
Good: "Create a product launch email with a hero image area, 3 feature cards in a row, customer testimonial, and a CTA button"
Vague: "Make a marketing email"
Mention your audience
Good: "Write a re-engagement email for users who haven't logged in for 30 days. Tone should be friendly and helpful, not pushy."
Brand kit integration
The AI automatically pulls from your account's brand kit:
- Logo — placed per your
logoPlacementsetting - Brand colors — applied to buttons, headings, accents
- Typography — heading and body font selections
- Voice — tone, industry, and company description shape the copy
Make sure your brand kit is configured before generating for the best results.
Rate limits
AI generations are metered per day by plan — the usage object in every response tells you where you stand. A 429 means today's allowance is exhausted. Request bursts are additionally limited to 10 per minute; see Rate Limits for retry strategies.
Next steps
- Set up your brand kit for on-brand AI generation
- Template Document Reference — what the generated
craftStatecontains - Save the result as a template