Templates

Reusable subjects and bodies with merge variables. The API merges your template_vars with sensible defaults; any placeholder without a value becomes an empty string.

Placeholders

Use double braces, e.g. {{user_name}} or {{otp_code}}. Only letters, numbers, and underscores are matched inside the braces. If you omit a variable in template_vars, it is replaced with nothing—so lines like "Hi {{user_name}}" become "Hi " unless you pass user_name or use {{email_local_part}} instead (derived from the recipient email in platform mail).

Default merge fields (API sends)

When you send with template_id, the server always starts from these defaults, then applies your template_vars on top (your keys override defaults).

  • year — current UTC year (e.g. 2026)
  • app_name — product name from the API environment
  • logo_url — defaults to {{FRONTEND_BASE_URL}}/piisend-logo.svg; override with BRAND_LOGO_URL
  • support_url — defaults to {{FRONTEND_BASE_URL}}/faq; override with SUPPORT_URL
  • user_name, user_email, email_local_part, dashboard_url, unsubscribe_url — empty until you set them in template_vars

Send with a template

curl -sS -X POST "https://api.piisend.com/api/v1/emails" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["user@example.com"],
    "template_id": "YOUR_TEMPLATE_OBJECT_ID",
    "template_vars": {
      "user_name": "Alex",
      "otp_code": "482193",
      "user_email": "user@example.com"
    }
  }'

Do not send subject, html, or text in the same request as template_id.

System templates vs your templates

User-facing system templates (seeded in the database, usable by all projects) are marked is_system. Piisend-hosted signup and verification emails use separate admin-configured templates and merge fields such as verification_url, logo_url, and support_url. Your application emails always use template_id + template_vars on POST /api/v1/emails as shown above.

Create and edit

In the dashboard, create a template with subject, HTML body, and optional plain text. Save to obtain a template ID. List IDs via the API or the Templates screen.

More

Full REST details: API reference.

Documentation

Integrate with the REST API

Quickstart, API reference, and webhooks—everything you need to send from your app.