Skip to content
Docs · Templates

Templates with variables.

Define subject, text and html once; on send you pass template_id and a variables map. String substitution only — no logic, no loops.

  1. 01syntax

    {{name}} placeholders

    Placeholders look like {{identifier}} with optional spaces. Identifiers accept letters, digits, _, . and -.

    {{nombre}}{{order.id}}no loops

    There is no automatic HTML escaping of variables: control what you inject.

  2. 02POST /v1/templates

    Create the template

    name, subject and optional text/html. mailack extracts the variable list from the content.

    POST /v1/templates
    curl -s -X POST "$MAILACK_API_URL/v1/templates" \
      -H "Authorization: Bearer $MAILACK_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "bienvenida",
        "subject": "Hola {{nombre}}",
        "text": "Bienvenido, {{nombre}}.",
        "html": "<p>Bienvenido, <strong>{{nombre}}</strong>.</p>"
      }' | jq .
  3. 03POST /v1/messages

    Send with template_id

    Instead of subject/text/html, send template_id and variables. Idempotency-Key and an authorized From are still required.

    template_not_foundtemplate_render_error
    POST /v1/messages + template_id
    curl -s -X POST "$MAILACK_API_URL/v1/messages" \
      -H "Authorization: Bearer $MAILACK_API_KEY" \
      -H "Idempotency-Key: $(uuidgen)" \
      -H "Content-Type: application/json" \
      -d '{
        "from": "hola@acme.mx",
        "to": "cliente@ejemplo.com",
        "template_id": "'"$TEMPLATE_ID"'",
        "variables": { "nombre": "Ada" }
      }' | jq .
  4. 04portal & scopes

    Where to manage it

    CRUD is also available in the portal. Machine API: messages:send for mutations, evidence:read to list. Routes: /v1/templates and /v1/templates/{id}.

Batch and rates

Bulk ingest and tenant deliverability metrics.