AI assistant
Generate and improve email templates with AI from the editor or the /ai API.
The AI assistant helps you write and polish emails: it generates subjects and bodies from an instruction, builds a complete HTML template, and rewrites existing HTML to your directions. It lives in the template editor, backed by the /ai API.
What it can do
| Endpoint | What it is for |
|---|---|
POST /ai/generate | Generates text: subjects, a plain-text body or a general answer, depending on task |
POST /ai/generate-template | Builds a full template: subject, preheader and html |
POST /ai/improve | Rewrites existing HTML following an instruction |
All of them accept optional template context (templateId, versionId, locale, description, current subject and variables) so the result fits your design.
Model
By default it uses Gemini 2.0 Flash (google/gemini-2.0-flash-001), a fast, cheap model. You can force another model per request with the model field; an admin can also set the default model globally.
From the editor to production
Generate or improve
From the editor, ask the assistant for a subject, a body or a full template. Or send HTML to
/ai/improvewith an instruction ("make it shorter", "formal tone").Review and edit
The result is a starting point. Refine it in the Monaco/Unlayer editor — see Create and edit templates.
Publish
Save and publish a version. Only
PUBLISHEDversions can be sent — see Publish workflow.
API details
Request bodies, responses, the token hard block (402) and the rate limit are in AI generation API.