Endpoints
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 two parts you’ll set most often:
routing: which channels and providers to use. Passnullto skip it for now, or{ "strategy_id": "rs_..." }to attach an existing strategy.content: the notification body, written in Elemental, Courier’s JSON templating format. Aversionplus anelementsarray of blocks likemeta,text,action, andchannel.
Update, publish, and read
- Update:
PUT /notifications/{id}/contentupdates the draft body.PUT /notifications/{id}replaces the whole template. - Publish:
POST /notifications/{id}/publishpromotes the current draft (or a specific version) to live. - Read:
GET /notifications/{id}/draft/contentreturns the draft body, andGET /notifications/{id}/contentreturns the published body.
Add HTML to a template
To author HTML through the API, for example when porting a legacy email, put a complete HTML document on the email channel node’sraw.html with the handlebars transformer. The meta title sets the subject.
Next steps
Templates API tutorial
Create, publish, and send end-to-end.
Elemental overview
How Elemental documents are structured.
HTML blocks
Inline and whole-email HTML in email.
Routing configuration
Attach channels and providers to a template.