Skip to main content
Templates are saved email layouts that can be referenced when sending transactional emails or building campaigns. They support variable substitution using {{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 the subject or body to insert dynamic values at send time:
<p>Hello {{firstName}}, your order {{orderId}} has shipped.</p>
Pass the values in the data field when calling /v1/send:
{
  "template": "clx_tmpl_abc123",
  "to": "[email protected]",
  "data": {
    "firstName": "Jane",
    "orderId": { "value": "ORD-9876", "persistent": false }
  }
}
Fallback values: use {{field ?? default}} when a variable may not always be present:
<p>Hello {{firstName ?? there}}!</p>
System variables are always available without passing them in data:
VariableDescription
{{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
default:"1"
Page number (1-indexed).
pageSize
number
default:"20"
Number of templates per page. Maximum 100.
Filter templates by name.
type
string
Filter by template type. One of TRANSACTIONAL or MARKETING.

Response

templates
array
Array of template objects.
total
integer
Total number of matching templates.
page
integer
Current page number.
pageSize
integer
Items per page.
totalPages
integer
Total number of pages.
Example
curl --request GET \
  --url 'https://next-api.useplunk.com/templates?type=TRANSACTIONAL' \
  --header 'Authorization: Bearer sk_live_yourkey'

Create template

POST /templates Creates a new email template.

Body parameters

name
string
required
Internal name for the template.
subject
string
required
Email subject line. Supports {{variable}} syntax.
body
string
required
HTML email body. Supports {{variable}} syntax.
from
string
required
Sender email address. Must be from a verified domain on your project.
fromName
string
Sender display name.
replyTo
string
Reply-to email address.
description
string
Optional description for internal reference.
type
string
Template type: TRANSACTIONAL or MARKETING. Defaults to TRANSACTIONAL.

Response

Returns the created template object with HTTP 201.
id
string
Template ID.
name
string
Template name.
subject
string
Email subject.
body
string
HTML body.
from
string
Sender address.
fromName
string
Sender display name.
replyTo
string
Reply-to address.
type
string
Template type (TRANSACTIONAL or MARKETING).
createdAt
string
ISO 8601 creation timestamp.
Example
curl --request POST \
  --url https://next-api.useplunk.com/templates \
  --header 'Authorization: Bearer sk_live_yourkey' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Password Reset",
    "subject": "Reset your password",
    "body": "<h1>Reset your password</h1><p>Hi {{firstName ?? there}},</p><p>Click below to reset your password. This link expires in 1 hour.</p><p><a href=\"{{resetLink}}\">Reset Password</a></p><p><a href=\"{{unsubscribeUrl}}\">Unsubscribe</a></p>",
    "from": "[email protected]",
    "fromName": "My App",
    "type": "TRANSACTIONAL"
  }'

Get template

GET /templates/:id Retrieves a single template by ID.

Path parameters

id
string
required
The template ID.
Example
curl --request GET \
  --url https://next-api.useplunk.com/templates/clx_tmpl_abc123 \
  --header 'Authorization: Bearer sk_live_yourkey'

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

id
string
required
The template ID.

Body parameters

name
string
Template name.
description
string
Template description.
subject
string
Email subject line.
body
string
HTML email body.
from
string
Sender email (must be a verified domain).
fromName
string
Sender display name.
replyTo
string
Reply-to email address.
type
string
Template type: TRANSACTIONAL or MARKETING.
Example
curl --request PATCH \
  --url https://next-api.useplunk.com/templates/clx_tmpl_abc123 \
  --header 'Authorization: Bearer sk_live_yourkey' \
  --header 'Content-Type: application/json' \
  --data '{
    "subject": "Reset your Plunk password",
    "fromName": "Plunk Team"
  }'

Delete template

DELETE /templates/:id Permanently deletes a template.
Deleting a template that is actively used by a campaign or workflow will break those references.

Path parameters

id
string
required
The template ID.
Returns 204 No Content on success.
Example
curl --request DELETE \
  --url https://next-api.useplunk.com/templates/clx_tmpl_abc123 \
  --header 'Authorization: Bearer sk_live_yourkey'

Build docs developers (and LLMs) love