API Reference
Templates
Create and manage reusable email templates with merge tag support
Templates
Templates are reusable email designs that support merge tags for personalization. Use them in campaigns, automations, and direct API sends.
Auth scope: templates
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/v1/templates | List templates (paginated) |
POST | /api/v1/templates | Create a template |
GET | /api/v1/templates/:id | Get a single template |
PATCH | /api/v1/templates/:id | Update a template |
DELETE | /api/v1/templates/:id | Delete a template |
POST | /api/v1/templates/render | Render template with merge tag data |
GET /api/v1/templates
List all templates for the authenticated account.
curl "https://mail.misar.io/api/v1/templates?page=1&limit=20&category=marketing" \
-H "Authorization: Bearer msk_YOUR_API_KEY"Query Parameters
| Param | Type | Default | Notes |
|---|---|---|---|
page | number | 1 | Page number |
limit | number | 20 | Results per page (max 100) |
category | string | — | Filter by category |
search | string | — | Full-text search on name / subject |
Response
{
"success": true,
"templates": [
{
"id": "tpl_abc123",
"name": "Welcome Email",
"subject": "Welcome to {{company_name}}, {{first_name}}!",
"category": "onboarding",
"created_at": "2026-03-01T10:00:00Z",
"updated_at": "2026-03-15T14:30:00Z"
}
],
"total": 45,
"page": 1,
"limit": 20
}POST /api/v1/templates
Create a new reusable template.
curl -X POST https://mail.misar.io/api/v1/templates \
-H "Authorization: Bearer msk_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome Email",
"subject": "Welcome to {{company_name}}, {{first_name}}!",
"body_html": "<h1>Hi {{first_name}},</h1><p>Welcome aboard!</p>",
"body_text": "Hi {{first_name}}, Welcome aboard!",
"category": "onboarding"
}'Request Fields
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | ✓ | Internal template name |
subject | string | ✓ | Email subject line — supports merge tags |
body_html | string | ✓ | HTML email body — supports merge tags |
body_text | string | — | Plain text fallback — recommended |
category | string | — | Organizational category (free-form string) |
Response
{
"success": true,
"template": {
"id": "tpl_abc123",
"name": "Welcome Email",
"subject": "Welcome to {{company_name}}, {{first_name}}!",
"category": "onboarding",
"created_at": "2026-04-06T12:00:00Z"
}
}Errors
| Code | Reason |
|---|---|
403 | Template quota reached for your plan (Free: 10 max) |
400 | Missing required fields |
POST /api/v1/templates/render
Preview a template rendered with contact or custom merge tag values.
curl -X POST https://mail.misar.io/api/v1/templates/render \
-H "Authorization: Bearer msk_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template_id": "tpl_abc123",
"contact": {
"first_name": "Gulshan",
"last_name": "Yadav",
"email": "gulshan@example.com",
"company_name": "G1 Technologies"
}
}'Request Fields
| Field | Type | Required | Notes |
|---|---|---|---|
template_id | string | ✓ | Template to render |
contact | object | — | Key-value pairs for merge tag substitution |
Response
{
"success": true,
"subject": "Welcome to G1 Technologies, Gulshan!",
"body_html": "<h1>Hi Gulshan,</h1><p>Welcome aboard!</p>",
"body_text": "Hi Gulshan, Welcome aboard!"
}Merge Tag Syntax
Use {{variable_name}} in subject and body fields. Unresolved tags are replaced with an empty string.
| Tag | Example Output |
|---|---|
{{first_name}} | Gulshan |
{{last_name}} | Yadav |
{{email}} | gulshan@example.com |
{{company_name}} | G1 Technologies |
{{unsubscribe_url}} | Auto-injected footer link |
{{unsubscribe_url}} is automatically appended to all marketing emails as required by CAN-SPAM. It cannot be removed from outbound campaigns.