POST /templates
Create a new email template with variable placeholders.
Authentication
JWT Bearer token (dashboard auth)
Request Body
| Field | Type | Required | Description |
|---|
name | string | Yes | Template name (unique per user) |
subject | string | No | Email subject with {{variables}} |
html_content | string | No | HTML body with {{variables}} |
text_content | string | No | Plain text body with {{variables}} |
Either html_content or text_content (or both) must be provided.
Response
{
"success": true,
"data": {
"template": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Welcome Email",
"subject": "Welcome to {{company_name}}, {{name}}!",
"html_content": "<h1>Welcome {{name}}!</h1>",
"text_content": null,
"variables": ["company_name", "name"],
"created_at": "2026-03-07T12:00:00Z",
"updated_at": "2026-03-07T12:00:00Z"
}
}
}
Example
curl -X POST https://app.usesendi.com/api/templates \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome Email",
"subject": "Welcome to {{company_name}}, {{name}}!",
"html_content": "<h1>Welcome {{name}}!</h1><p>Thanks for joining {{company_name}}.</p>"
}'
Errors
| Status | Error | Cause |
|---|
400 | Invalid request data | Missing required fields |
409 | Duplicate name | A template with this name already exists |