Templates

Templates live on the server, versioned by you, rendered by the API. Store subject, HTML and text once, then send with a model.

Endpoints

GET    /api/v2/server/templates                        # list
POST   /api/v2/server/templates                        # create
GET    /api/v2/server/templates/{permalink}
PATCH  /api/v2/server/templates/{permalink}
POST   /api/v2/server/templates/{permalink}/archive
POST   /api/v2/server/templates/{permalink}/render  # preview without sending

Create a template

POST /api/v2/server/templates
{
  "name": "Welcome",
  "permalink": "welcome",
  "subject": "Welcome to {{ product }}",
  "html_body": "<h1>Hi {{ name }}…",
  "text_body": "Hi {{ name }} …"
}

Preview a render

POST /api/v2/server/templates/welcome/render
{ "template_model": { "name": "Ada", "product": "Acme" } }

Returns the rendered subject, HTML and text without sending anything, ideal for a preview pane in your own admin UI.

The ready-made library

20 production-ready transactional templates (welcome, receipts, resets, 2FA codes, dunning, …) ship with the repository and import with one command:

terminal
git clone https://github.com/camelmailer/camelmailer
cd camelmailer
./templates/import.sh https://mail.yourdomain.com $SERVER_API_KEY
The import script is ~20 lines of curl against exactly these endpoints. Read it, then trust it. Browse the full library in Templates.