Skip to main content
Templates can be managed programmatically via Courier’s Templates API. This page focuses on Design Studio assets: Elemental bodies, reusable routing, and HTML inside Elemental.
See the Templates API tutorial for a fast walkthrough: setup, requests, and working code for creating, updating, publishing, and managing templates.

Notification template endpoints

Templates API requests are authenticated by passing your workspace API key as a Bearer token in the Authorization header: Authorization: Bearer <token>. Requests without this header are rejected.
EndpointPurpose
GET /notificationsList templates (paginated).
POST /notificationsCreate a template.
GET /notifications/{id}Get one template (metadata and settings).
PUT /notifications/{id}Replace a template in full.
GET /notifications/{id}/draft/contentRead draft Elemental content.
GET /notifications/{id}/contentRead published Elemental content.
POST /notifications/{id}/publishPublish a draft (or a specific version).
GET /notifications/{id}/versionsList template versions.
DELETE /notifications/{id}Archive a template.

Design Studio alignment: routing and Elemental

Design Studio stores Elemental notification content and attaches reusable routing (which channels/providers to use). When you create or replace a template over the wire, the notification object must include routing: use null if you are not attaching a strategy yet, or { "strategy_id": "rs_..." } with a strategy that already exists in your workspace (for example from GET /notifications/{id} or Studio). notification.content follows Elemental: a version (for example 2022-01-01) and an elements array using element types such as meta, text, action, channel, etc. See Elemental overview and routing configuration.

Example: create a template (POST /notifications)

POST /notifications takes published and notification. Set COURIER_API_KEY in your environment. The Templates API tutorial walks through create, publish, and send end-to-end with the same REST API.
cURL
curl -sS -X POST "https://api.courier.com/notifications" \
  -H "Authorization: Bearer $COURIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$(jq -n '{
      "published": false,
      "notification": {
        "name": "Order shipped",
        "tags": [],
        "brand": null,
        "subscription": null,
        "routing": null,
        "content": {
          "version": "2022-01-01",
          "elements": [
            { "type": "meta", "title": "Your order {{order_id}} shipped" },
            { "type": "text", "content": "Hi {{name}}, tracking: {{tracking_url}}." },
            { "type": "action", "content": "Track", "href": "{{tracking_url}}" }
          ]
        }
      }
    }')"

HTML elements in Elemental content

In addition to Courier’s predefined Elemental blocks (meta, text, action, and the rest), you can supply your own HTML in Elemental: use "type": "html" and put the markup in content. That HTML path is email-only; other message formats (for example push or SMS) don’t render HTML, so this block isn’t available there. See the HTML element reference for structure and options like locales.
{
  "version": "2022-01-01",
  "elements": [
    {
      "type": "html",
      "content": "<table role=\"presentation\"><tr><td>{{label}}</td><td>{{value}}</td></tr></table>"
    }
  ]
}

Publish and read content

What’s Next

Templates API

Full /notifications endpoint guide and API Reference links

Templates API tutorial

End-to-end curl and send example

Elemental overview

Structure of Elemental documents

Design Studio overview

Editing templates in the UI