Templated

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

FieldTypeRequiredDescription
modeenumNoprompt (default) or guided
promptstringPrompt modeDescription of the email, max 5000 chars
briefobjectGuided modeStructured brief — see below
emailTypeenumNonewsletter, announcement, welcome, promotion, event, update, re-engagement, or transactional
referenceContentstringNoExisting copy or content to base the email on, max 10000 chars
conversationIdstring (uuid)NoContinue an existing generation conversation for iterative refinement
parentGenerationIdstring (uuid)NoThe 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

FieldTypeRequiredDescription
purposestringYesWhat the email is for, max 200 chars
contentstringYesWhat it should say, max 5000 chars
vibestringNoTone/mood, max 200 chars
layoutenumNosingle-column, hero-two-col, zigzag, grid, or ai-decide
backgroundenumNowhite-clean, soft-tint, bold-color, or photo-forward
imagesenumNoown, stock, or none
followUpobjectNo{ 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 logoPlacement setting
  • 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

On this page