Email Generation API
Two endpoints handle AI-powered email generation, each suited for different use cases.
POST /api/generate
The primary email generation endpoint. Uses the full RAG pipeline for context-aware, high-quality kinetic email output.
Request
curl -X POST https://kinetic.email/api/generate \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Create a product showcase email with tabbed navigation for a shoe brand",
"conversationHistory": []
}'
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Email generation prompt |
conversationHistory | array | No | Previous messages for multi-turn context |
Response
{
"success": true,
"html": "<!DOCTYPE html>...",
"usage": {
"input_tokens": 15234,
"output_tokens": 4521
},
"ragContext": {
"codeExamples": 4,
"knowledgeArticles": 3
}
}
How It Works
- Auth & tokens — Verifies user JWT, deducts
ai_generationtokens - Technique extraction — Parses
**Kinetic Features:**from structured prompts - Dual RAG queries (parallel):
- Query A: Technique-filtered Pinecone search (topK=10)
- Query B: Broad unfiltered search (topK=15)
- Merge & deduplicate — Combines results, removes duplicates
- Re-rank — Claude Haiku selects best 7 results for diversity
- Generate — Claude Sonnet generates HTML using RAG context
- QA check — Validates output against kinetic email rules
Supported Techniques
| Technique | Description |
|---|---|
tabs | Radio button tabbed interfaces |
accordion | Checkbox expand/collapse sections |
carousel | Radio button image/content carousels |
survey | Progressive disclosure survey forms |
quiz | Interactive quizzes with reveal states |
menu | Hamburger menu overlays |
stepper | Multi-step wizard flows |
toggle | Simple on/off switches |
amp4email | AMP-powered interactive emails |
POST /api/generate-email
A simpler generation endpoint that calls Claude directly without the RAG pipeline. Faster but less context-aware.
Request
curl -X POST https://kinetic.email/api/generate-email \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Create a simple tabbed email for a newsletter"
}'
Response
{
"success": true,
"html": "<!DOCTYPE html>...",
"usage": {
"input_tokens": 2100,
"output_tokens": 3800
}
}
When to Use Which
| Scenario | Endpoint |
|---|---|
| Production email generation | /api/generate (RAG pipeline) |
| Quick prototyping | /api/generate-email (direct Claude) |
| Complex kinetic techniques | /api/generate (has technique examples) |
| Simple static emails | /api/generate-email (faster) |