API reference
Templates
Create and read reusable email templates, and browse the shared gallery.
Templates store a subject and design you can send by id. Send one by passing template to the send endpoint.
The template object#
json
{
"id": "tmpl_123",
"name": "Welcome",
"category": "Onboarding",
"subject": "Welcome, {{first_name}}",
"source": "<html>…</html>",
"format": "html",
"is_system": false,
"created_at": "2026-07-10T10:30:00.000Z",
"updated_at": "2026-07-10T10:30:00.000Z"
}is_system is true for shared gallery templates, which are read-only.
List templates#
GET
/v1/templatesQuery parameters
limitintegerOptionalItems per page. Default
50, max 100.cursorstringOptionalPagination cursor.
scopestringOptionalPass
all to include the shared system gallery alongside your templates.categorystringOptionalFilter by category, e.g.
Onboarding or Transactional.ts
const { data } = await deckle.templates.list({ scope: "all" });Create a template#
POST
/v1/templatesBody parameters
namestringRequiredTemplate name.
subjectstringOptionalSubject line. Defaults to the
name if omitted.categorystringOptionalCategory label. Defaults to the first valid category.
sourcestringOptionalThe template body — HTML or serialized blocks.
format"html" | "blocks"OptionalHow
source is interpreted. Defaults to blocks.const tmpl = await deckle.templates.create({
name: "Welcome",
subject: "Welcome, {{first_name}}",
category: "Onboarding",
source: "<h1>Welcome aboard!</h1>",
});Retrieve a template#
GET
/v1/templates/:idWorks for both your templates and read-only system gallery templates.
ts
const tmpl = await deckle.templates.get("tmpl_123");Update a template#
PATCH
/v1/templates/:idUpdate name, category, subject, source, or format.
bash
curl -X PATCH https://app.getdeckle.com/api/v1/templates/tmpl_123 \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{ "subject": "Welcome to Acme, {{first_name}}" }'Gallery templates are read-only
System templates (is_system: true) can’t be edited — a PATCH to one returns 404. Duplicate it into your project first from the dashboard.