v1 · API reference

Templates

Reusable email designs in the canonical block-based JSON format the dashboard editor produces, with per-recipient `{{variables}}` filled at send time.

Base URL: https://www.unitpost.com/api/v1/api/v1

Templates

List templates

GET/api/v1/api/v1/templates

GET /templates
curl -X GET 'https://www.unitpost.com/api/v1/api/v1/templates' \
  -H 'Authorization: Bearer YOUR_API_KEY'
Response · 200
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "template",
      "id": "id_123",
      "name": "Example",
      "subject": "Welcome to Acme",
      "mode": "code",
      "status": "draft",
      "design": "string",
      "created_at": "2026-01-01T00:00:00.000Z",
      "updated_at": "2026-01-01T00:00:00.000Z"
    }
  ]
}

Retrieve a list of your email templates, cursor-paginated. List rows omit the full design document to keep responses small — fetch a single template with Retrieve a template to get it. Reference a template's id when sending with Send or schedule an email or when creating a campaign. Requires the templates:read capability.

Parameters3 fields
FieldTypeDescription
limitinteger · queryMax rows to return (default 20, max 100).
afterstring · queryReturn rows after this id (forward paging).
beforestring · queryReturn rows before this id (backward paging).
Response · 200 fields9 fields
FieldTypeDescription
objectrequiredstring
idrequiredstring
namerequiredstring
subjectrequiredobject
moderequiredenumcode | visual
statusrequiredenumdraft | published
designobject
created_atrequiredstring
updated_atrequiredstring
200401422

Create a template

POST/api/v1/api/v1/templates

POST /templates
curl -X POST 'https://www.unitpost.com/api/v1/api/v1/templates' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Welcome",
    "subject": "Welcome!",
    "html": "<h1>Hi {{first_name}}</h1>"
  }'
Response · 201
{
  "object": "template",
  "id": "id_123",
  "name": "Example",
  "subject": "Welcome to Acme",
  "mode": "code",
  "status": "draft",
  "design": "string",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}

Create a reusable email template from a canonical design document — the same block-based format the dashboard editor produces. Templates support {{variables}} that are filled per-recipient at send time. Once created, preview it in the dashboard, send with it via Send or schedule an email, and iterate with Update a template. Requires the templates:write capability.

Request body5 fields
FieldTypeDescription
namerequiredstring
subjectstring
modeenumcode | visual
categoryenumtransactional | marketing
designobject
Response · 201 fields9 fields
FieldTypeDescription
objectrequiredstring
idrequiredstring
namerequiredstring
subjectrequiredobject
moderequiredenumcode | visual
statusrequiredenumdraft | published
designobject
created_atrequiredstring
updated_atrequiredstring
201401422

Retrieve a template

GET/api/v1/api/v1/templates/{id}

GET /templates/{id}
curl -X GET 'https://www.unitpost.com/api/v1/api/v1/templates/tmpl_123' \
  -H 'Authorization: Bearer YOUR_API_KEY'
Response · 200
{
  "object": "template",
  "id": "id_123",
  "name": "Example",
  "subject": "Welcome to Acme",
  "mode": "code",
  "status": "draft",
  "design": "string",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}

Retrieve a single template by id, including the full canonical design document (which List templates omits). Use this to read a design for editing, then save changes with Update a template. Requires the templates:read capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path
Response · 200 fields9 fields
FieldTypeDescription
objectrequiredstring
idrequiredstring
namerequiredstring
subjectrequiredobject
moderequiredenumcode | visual
statusrequiredenumdraft | published
designobject
created_atrequiredstring
updated_atrequiredstring
200401404

Update a template

PATCH/api/v1/api/v1/templates/{id}

PATCH /templates/{id}
curl -X PATCH 'https://www.unitpost.com/api/v1/api/v1/templates/tmpl_123' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "subject": "Welcome aboard!"
  }'
Response · 200
{
  "object": "template",
  "id": "id_123",
  "name": "Example",
  "subject": "Welcome to Acme",
  "mode": "code",
  "status": "draft",
  "design": "string",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}

Update a template's metadata and/or its design document. Changes take effect for future sends only — emails already sent or queued keep the design they were rendered with. Preview the result in the dashboard before sending; read the current design first with Retrieve a template. Requires the templates:write capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path
Request body5 fields
FieldTypeDescription
namestring
subjectobject
modeenumcode | visual
statusenumdraft | published
designobject
Response · 200 fields9 fields
FieldTypeDescription
objectrequiredstring
idrequiredstring
namerequiredstring
subjectrequiredobject
moderequiredenumcode | visual
statusrequiredenumdraft | published
designobject
created_atrequiredstring
updated_atrequiredstring
200401404422

Delete a template

DELETE/api/v1/api/v1/templates/{id}

DELETE /templates/{id}
curl -X DELETE 'https://www.unitpost.com/api/v1/api/v1/templates/tmpl_123' \
  -H 'Authorization: Bearer YOUR_API_KEY'

Permanently delete a template. Emails already sent with it are unaffected, but future sends that reference its id will fail — update any code or campaigns that still point at it first (see List campaigns). Requires the templates:write capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path
204401404