Misar Docs
MisarMailMisar.BlogMisarReachMisarPostMisar.DevMisar PlatformMisar IdentityMisar Posts API
Api Reference

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

MethodPathDescription
GET/api/v1/templatesList templates (paginated)
POST/api/v1/templatesCreate a template
GET/api/v1/templates/:idGet a single template
PATCH/api/v1/templates/:idUpdate a template
DELETE/api/v1/templates/:idDelete a template
POST/api/v1/templates/renderRender template with merge tag data

List templates

GET/mail/v1/templates

List all templates for the authenticated account.

Query parameters

pagenumberquerydefault: 1

Page number.

limitnumberquerydefault: 20

Results per page (max 100).

categorystringquery

Filter by category.

searchstringquery

Full-text search on name / subject.

Response fields

successboolean

true when the request succeeded.

templatesArray<Template>

The page of templates. Each template includes id, name, subject, category, created_at, and updated_at.

totalnumber

Total number of templates.

pagenumber

Current page number.

limitnumber

Results 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

POST/mail/v1/templates

Create a new reusable template.

Request body

namestringbodyrequired

Internal template name.

subjectstringbodyrequired

Email subject line — supports merge tags.

body_htmlstringbodyrequired

HTML email body — supports merge tags.

body_textstringbody

Plain text fallback — recommended.

categorystringbody

Organizational category (free-form string).

Response fields

successboolean

true when the template was created.

templateobject

The 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

CodeReason
403Template quota reached for your plan (Free: 10 max)
400Missing required fields

Render a template

POST/mail/v1/templates/render

Preview a template rendered with contact or custom merge tag values.

Request body

template_idstringbodyrequired

Template to render.

contactobjectbody

Key-value pairs for merge tag substitution.

Response fields

successboolean

true when the template was rendered.

subjectstring

Rendered subject line with merge tags substituted.

body_htmlstring

Rendered HTML body.

body_textstring

Rendered 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.

TagExample 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.