Email Templates
Kyqu supports customizable email templates per project with a fallback chain: project-specific → superadmin defaults → built-in defaults.
Template Resolution Order
1. Project-specific custom template
(saved in project_email_templates with project_id)
2. Superadmin platform-wide default
(saved in project_email_templates with project_id = '__default__')
3. Built-in hardcoded template
(defined in platform-service.js)
Template Purposes
| Purpose | Description |
|---|---|
email_verification | Verify email address |
password_reset | Reset forgotten password |
magic_link | Passwordless sign-in link |
force_password_reset | Admin-forced password reset |
Template Variables
| Variable | Description |
|---|---|
{{project_name}} | Project display name |
{{action_url}} | Action link URL (auto-generated) |
{{expires_in}} | Token expiration time (e.g., "15 minutes") |
{{preheader}} | Email preheader text |
Built-in Templates
Default subject lines:
| Purpose | Subject |
|---|---|
email_verification | Verify your {{project_name}} account |
password_reset | Reset your {{project_name}} password |
magic_link | Sign in to {{project_name}} |
force_password_reset | Your {{project_name}} password needs to be reset |
Customizing Templates
Via the Admin Dashboard
- Navigate to the project's Email Templates section
- Select a purpose to edit
- Set the subject line, HTML body, and text body
- Save — the template is immediately active
Via the API
# Save custom template
curl -X PUT /api/admin/projects/{id}/email-templates/email_verification \
-H "Content-Type: application/json" \
-d '{
"subject": "Welcome to {{project_name}}",
"htmlBody": "<h1>Verify your email</h1><a href=\"{{action_url}}\">Click here</a>",
"textBody": "Verify your email: {{action_url}}"
}'
# Reset to default
curl -X DELETE /api/admin/projects/{id}/email-templates/email_verification
# List all templates
curl GET /api/admin/projects/{id}/email-templates
HTML Email Guidelines
Emails are rendered with inline styles (table-based layout, no CSS flex/grid) for maximum email client compatibility:
- Gmail: Supports basic table layouts and inline styles
- Outlook: Requires table-based layout (Word rendering engine)
- Apple Mail: Supports modern CSS
- Yahoo: Similar to Gmail
The built-in template uses:
- Table-based layout
- Inline CSS on every element
- Dark green header with project name and Kyqu badge
- White card body with centered content
- CTA button with inline border-radius
- Dark green footer with Kyqu URL
- Support for dark mode via
<meta name="color-scheme">
Superadmin Default Templates
Superadmins can set platform-wide default templates that apply to all projects unless overridden:
# List platform defaults
curl GET /api/admin/superadmin/default-templates
# Save platform default
curl -X PUT /api/admin/superadmin/default-templates/email_verification \
-H "Content-Type: application/json" \
-d '{
"subject": "Welcome!",
"htmlBody": "...",
"textBody": "..."
}'
# Reset platform default
curl -X DELETE /api/admin/superadmin/default-templates/email_verification