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 environmentlogo_url— defaults to{{FRONTEND_BASE_URL}}/piisend-logo.svg; override withBRAND_LOGO_URLsupport_url— defaults to{{FRONTEND_BASE_URL}}/faq; override withSUPPORT_URLuser_name,user_email,email_local_part,dashboard_url,unsubscribe_url— empty until you set them intemplate_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.
Starter templates vs your templates
The dashboard lists starter templates (magic link, welcome, OTP, etc.) from GET /templates/catalog — copy one with POST /templates/catalog/{slug}/copy to create your own editable template. GET /templates returns only templates you own. Piisend platform mail (signup verification, etc.) uses internal templates not exposed in your tenant list.
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.