The Courier CLI and MCP server both wrap the Notification Templates REST API. The CLI runs as a native binary in your terminal; MCP lets your IDE agent (Cursor, VS Code Copilot, Claude Code, etc.) call Courier tools on your behalf. Both the CLI and MCP server cover the full template lifecycle: create, inspect, update, publish, send, version history, and archive. Every step in this tutorial shows both approaches side by side so you can pick the one that fits your workflow. By the end you will have created a draft template with Elemental content, published it, verified the published body, sent a test message, checked version history, and archived the template when you’re done.Documentation Index
Fetch the complete documentation index at: https://www.courier.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
This tutorial covers workspace-level notification templates (
/notifications). For tenant-scoped templates used with the embeddable Courier Create editor, see How to Use the Courier Create API.Prerequisites
- Courier API key
- CLI path: Install the Courier CLI (
npm i -g @trycourier/cli) - MCP path: Add the Courier MCP server to your IDE
Step 1 - List existing templates
Start by seeing what is already on your workspace.results array of templates and a paging object. Note the id of any template you want to inspect further. Courier template ids look like nt_....
Step 2 - Create a draft template
Create a new notification template with Elemental content. The example builds a shipping-update email with a subject line, a text block, and a call-to-action button.id field. Save this as your TEMPLATE_ID.
Step 3 - Inspect the draft
Verify the draft content before publishing. Useretrieve-content --version draft on the CLI; the MCP server has a dedicated get_notification_draft_content tool.
Step 4 - Update the content (optional)
Need to tweak the draft? Useput-content to replace just the Elemental content without touching the template’s name, routing, or other metadata.
Step 5 - Publish
Make the current draft live. Recipients will see this version the next time you send.Step 6 - Verify the published content
Read back the live version to confirm what recipients will see.retrieve-content defaults to the published version. Add --version draft to see the draft. After a publish they will match, but they can differ if you edit the draft without publishing again.Step 7 - Send a test message
Fire a notification using your template. Thedata fields must match the {{variables}} in your Elemental content.
requestId. Check delivery status in Message Logs or by calling courier messages list.
Step 8 - Check version history
See every published version of the template.created_at timestamp and a version string you can use to inspect or publish a specific historical snapshot.
Step 9 - Archive the template
When a template is no longer needed, archive it. Archived templates stop delivering but are not permanently deleted.CLI and MCP coverage
| Step | CLI | MCP | cURL |
|---|---|---|---|
| List templates | notifications list | list_notifications | GET /notifications |
| Create | notifications create | create_notification | POST /notifications |
| Read draft | notifications retrieve-content --version draft | get_notification_draft_content | GET /notifications/{id}/draft/content |
| Update content | notifications put-content | put_notification_content | PUT /notifications/{id}/draft/content |
| Publish | notifications publish | publish_notification | POST /notifications/{id}/publish |
| Read published | notifications retrieve-content | get_notification_content | GET /notifications/{id}/content |
| Send | send message | send_message_template | POST /send |
| Versions | notifications list-versions | list_notification_versions | GET /notifications/{id}/versions |
| Archive | notifications archive | archive_notification | DELETE /notifications/{id} |
Tips for CI / automation
- Idempotent updates: Use
courier notifications replace --id nt_...(orPUT /notifications/{id}) to overwrite a template by id, making deploys repeatable. - JSON output: Add
--format jsonto any CLI command for machine-parseable output; pipe throughjqfor filtering. - Dry runs with test keys: Use a Test environment API key to iterate without sending real notifications.
- MCP in CI: The MCP server can be called from any MCP-compatible runtime, not just IDEs. Use it in custom automation scripts that support the Model Context Protocol.
What’s Next
CLI reference
Full command list, flags, and recipes
MCP server
All MCP tools and IDE setup
Templates API reference
Endpoint details and content schema
Templates API tutorial
Same workflow with curl, Node.js, and Python SDK examples