/notifications API. A template holds Elemental content for one or more channels plus reusable routing, the same assets you edit in Design Studio. Every template has a draft and a published version: writes land on the draft, sends use the published version.
Endpoints
All paths are rooted athttps://api.courier.com. Authenticate every request with your workspace API key as a Bearer token: Authorization: Bearer <token>.
Create a template
SendPOST /notifications with a notification object and an optional state flag (defaults to DRAFT). Set COURIER_API_KEY in your environment first.
notification object has a few parts you’ll set most often:
name(required) andtags(required, an array; pass[]if you have none). Includebrandandsubscriptionas well: they may benull, but the keys must be present or the request is rejected.routing: which channels and providers to use. Passnullto skip it for now, or{ "strategy_id": "rs_..." }to attach an existing strategy.content: the template body in Elemental, aversionplus anelementsarray ofchannelelements, one per channel. Each channel element holds that channel’s blocks, so one template carries email, SMS, push, and more. Courier renders the matching channel for each delivery (see Author content that stays editable).
Idempotency-Key header. Courier returns the stored response instead of creating a second template.
Edit the draft
PUT /notifications/{id}/content writes the draft body. Send the Elemental document nested under a content key, which differs from POST /notifications, where content sits inside notification.
Publish, read, and archive
Publishing promotes the draft to what recipients see. Until you publish, a template created withstate: "DRAFT" is invisible to sends.
- Publish:
POST /notifications/{id}/publishpromotes the current draft to live and returns204with no body. Pass aversionto publish a specific earlier version instead. - Read:
GET /notifications/{id}/contentreturns the published body. Pass?version=draftfor the draft, or?version=v001for a specific version. Compare draft against published to see what is unpublished. - History:
GET /notifications/{id}/versionslists published versions, most recent first, for auditing or rollback. - Replace:
PUT /notifications/{id}replaces the whole template, includingname,routing, and settings, not just the body. - Archive:
DELETE /notifications/{id}archives the template so it drops out of the normal catalog. Check what still references it before you archive.
Author content that stays editable
Give each channel its ownchannel element at the top level, as in the example above. This is how Design Studio stores templates, so a template you create through the API stays editable there.
For colored or bold runs within a paragraph, use a text element’s inline elements array (string/link nodes) or Markdown (**bold**) in content. To set a color across a whole template, use a brand.
Fill variables at send time
Variables in your template resolve against thedata object on the send call. The {{order_id}}, {{name}}, and {{tracking_url}} placeholders in the examples above come from here:
cURL
profile., tenant., and brand. prefixes against the recipient’s stored profile, their tenant, and the brand. A name with no prefix is looked up in data, so {{order_id}} and {{data.order_id}} reach the same value.
Elemental content uses double braces, as in the examples above. The single-brace form (
{order_id}) is what you type into block fields in Design Studio. Same data either way, different authoring surface.Add raw HTML (email only)
Raw HTML applies to the email channel only; other channels use blocks or their ownraw payload. To author an email as HTML instead of blocks, for example when porting a legacy template, put a complete HTML document on the email channel node’s raw.html with the handlebars transformer. Keep a meta block for the subject, since raw.html has none.
Response codes
Approval submissions
When a workspace uses the template approval workflow, review state attaches to a submission rather than the template. The operations live on/notifications/{id}/{submissionId}/checks: read the checks, replace them, or cancel the submission.
Workspace templates vs tenant templates
Everything on this page is scoped to your workspace: one template list per Courier account, matching what you see in Studio, on untenanted/notifications/... paths.
If you manage a separate set of templates per tenant, those live on /tenants/{tenant_id}/templates/... instead. See the Courier Create API.