Skip to main content

Templates API

Auth: Clerk session.

List

GET /v1/templates?cursor=&limit=50&channel=email&status=active

Get

GET /v1/templates/:id

{
"data": {
"id": "uuid", "tenant_id": "...", "project_id": "...",
"name": "welcome_match",
"channel": "email",
"status": "active",
"subject": "Welcome, {{first_name}}!",
"preheader": "Your bonus is ready",
"body": "<html>...{{bonus.code}}...</html>",
"data": { ... }, // for push channel
"created_at": "...", "updated_at": "..."
}
}

Create / Update

POST /v1/templates and PATCH /v1/templates/:id — see Templates feature for shape per channel.

Preview

POST /v1/templates/:id/preview

{
"player_id": "uuid" // optional — render against this player's traits
}

Returns rendered subject + body (synthetic player when no player_id).

Send test

POST /v1/templates/:id/send-test

{
"recipient": "test@example.com", // overrides player's email
"player_id": "uuid" // optional context
}

Bypasses frequency caps + quiet hours (admin testing). Provider must be configured for the template's channel.

Delete

DELETE /v1/templates/:id → soft delete. In-flight campaigns + journeys referencing the template error at the next send.