{{variableName}} syntax.
All template endpoints require a secret key (
sk_*). The from address must belong to a verified domain on your project.Variable substitution
Use double-curly-brace syntax in thesubject or body to insert dynamic values at send time:
data field when calling /v1/send:
{{field ?? default}} when a variable may not always be present:
data:
| Variable | Description |
|---|---|
{{id}} | Contact ID |
{{email}} | Contact email |
{{unsubscribeUrl}} | One-click unsubscribe link |
{{subscribeUrl}} | Re-subscribe link |
{{manageUrl}} | Subscription preferences page |
List templates
GET /templates
Returns a paginated list of templates for the authenticated project.
Query parameters
Page number (1-indexed).
Number of templates per page. Maximum
100.Filter templates by name.
Filter by template type. One of
TRANSACTIONAL or MARKETING.Response
Array of template objects.
Total number of matching templates.
Current page number.
Items per page.
Total number of pages.
Example
Create template
POST /templates
Creates a new email template.
Body parameters
Internal name for the template.
Email subject line. Supports
{{variable}} syntax.HTML email body. Supports
{{variable}} syntax.Sender email address. Must be from a verified domain on your project.
Sender display name.
Reply-to email address.
Optional description for internal reference.
Template type:
TRANSACTIONAL or MARKETING. Defaults to TRANSACTIONAL.Response
Returns the created template object with HTTP201.
Template ID.
Template name.
Email subject.
HTML body.
Sender address.
Sender display name.
Reply-to address.
Template type (
TRANSACTIONAL or MARKETING).ISO 8601 creation timestamp.
Example
Get template
GET /templates/:id
Retrieves a single template by ID.
Path parameters
The template ID.
Example
Update template
PATCH /templates/:id
Updates one or more fields on an existing template. All fields are optional; only provided fields are changed.
Path parameters
The template ID.
Body parameters
Template name.
Template description.
Email subject line.
HTML email body.
Sender email (must be a verified domain).
Sender display name.
Reply-to email address.
Template type:
TRANSACTIONAL or MARKETING.Example
Delete template
DELETE /templates/:id
Permanently deletes a template.
Path parameters
The template ID.
204 No Content on success.
Example