Templates
Create and manage reusable email templates with merge tag support
Templates are reusable email designs that support merge tags for personalization. Use them in campaigns, automations, and direct API sends.
Authentication
All template endpoints require an API key with the templates scope. Base URL: https://api.misar.io/mail.
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 |
List templates
/mail/v1/templatesList all templates for the authenticated account.
Query parameters
pagenumberquerydefault: 1Page number.
limitnumberquerydefault: 20Results per page (max 100).
categorystringqueryFilter by category.
searchstringqueryFull-text search on name / subject.
Response fields
successbooleantrue when the request succeeded.
templatesArray<Template>The page of templates. Each template includes id, name, subject, category, created_at, and updated_at.
totalnumberTotal number of templates.
pagenumberCurrent page number.
limitnumberResults per page.
curl "https://api.misar.io/mail/v1/templates?page=1&limit=20&category=marketing" \
-H "Authorization: Bearer msk_YOUR_API_KEY"{
"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
}Create a template
/mail/v1/templatesCreate a new reusable template.
Request body
namestringbodyrequiredInternal template name.
subjectstringbodyrequiredEmail subject line — supports merge tags.
body_htmlstringbodyrequiredHTML email body — supports merge tags.
body_textstringbodyPlain text fallback — recommended.
categorystringbodyOrganizational category (free-form string).
Response fields
successbooleantrue when the template was created.
templateobjectThe created template, including id, name, subject, category, and created_at.
curl -X POST https://api.misar.io/mail/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"
}'{
"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 |
Render a template
/mail/v1/templates/renderPreview a template rendered with contact or custom merge tag values.
Request body
template_idstringbodyrequiredTemplate to render.
contactobjectbodyKey-value pairs for merge tag substitution.
Response fields
successbooleantrue when the template was rendered.
subjectstringRendered subject line with merge tags substituted.
body_htmlstringRendered HTML body.
body_textstringRendered plain-text body.
curl -X POST https://api.misar.io/mail/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": "[email protected]",
"company_name": "G1 Technologies"
}
}'{
"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}} | [email protected] |
{{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.