Skip to main content
The Courier CLI is a native binary that covers the full Courier REST API. It works on macOS, Linux, and Windows with no runtime dependencies.

Prerequisite: Create an API Key

You need a Courier API key to authenticate CLI commands. Create one in your Courier Settings, then set it in your shell:
If you pass --api-key on a command, it takes priority over the environment variable. This is useful for testing against a different workspace without changing your shell config. See Global Flags for all available flags.

Installation

This downloads a platform-specific binary via a postinstall step. No Node.js runtime is needed after installation.
Verify the installation:

Command Structure

The CLI uses a resource-based pattern:
Use --help on any command to see available flags:

Send Your First Notification

You don’t need a template to send your first notification. Pass the content inline and Courier handles the rest. Send an email directly
Send across multiple channels Route a notification to email first, then fall back to SMS if email can’t be delivered. See channel priority for how Courier evaluates routing order.
Send using a template Once you’ve built a template in the Courier dashboard, reference it by ID or alias.

Manage User Profiles

Courier needs to know where to reach your users. Create profiles with their contact info so you can send by user_id instead of passing email and phone every time. Create a user profile
Add custom attributes Custom data on the profile is available in all templates for that user.
This merges with the existing profile, so you won’t overwrite the email or phone number you set earlier. Look up a user’s profile

Check on a Notification

Every notification gets a message ID. Use it to check delivery status, inspect rendered content, or trace the full delivery timeline. Get the status of a sent notification
View the full delivery timeline See every step a notification went through (queued, sent, delivered, opened, clicked) with timestamps.
See what was actually rendered Check the final content Courier sent to the provider, after all template variables and routing logic were applied.

Debug a Delivery Issue

When a user reports they didn’t get a notification, run these in sequence to narrow it down. Find the notification Pull recent notifications for a specific user.
Inspect the notification Check the status. Look for DELIVERED, SENT, UNDELIVERABLE, or UNROUTABLE.
Trace the delivery steps The history shows exactly where things went wrong: did the provider reject it? Did routing skip a channel? Did a preference rule block it?
Verify the user’s profile If the notification is UNROUTABLE, the user’s profile is probably missing channel data.

Send to Groups

Create a list and add subscribers
Send to the whole list
Send to multiple lists with a pattern If your list IDs follow a hierarchy (like eng.frontend, eng.backend), target all of them at once.

Send in Bulk

For large sends (product launches, monthly digests, migration emails), use the bulk API to send to thousands of users in a single job.

Manage Templates

Notification templates let you define reusable content and routing in Courier’s designer, then send by template ID. The V2 workflow is: create → add content → create a routing strategy → publish → send. Create a draft template
The response includes the template ID (nt_...). Use that ID in all subsequent commands. Add content to the template
Create a routing strategy A routing strategy controls which channels to use and in what order. You can reuse one strategy across multiple templates.
Copy the strategy ID (rs_...) from the response, then link it to your template:
Publish the template
This returns 204 when successful. The template is now live and referenceable by alias (password-reset) or ID. Send using the template
List and inspect templates

Work with Tenants

If you’re building a B2B product, tenants let you scope branding, preferences, and notification behavior per customer organization. Create a tenant
Add a user to a tenant
Send with tenant context This applies the tenant’s brand and preferences automatically.

Trigger Automations

Automations let you orchestrate multi-step notification sequences (delays, conditions, batching) without writing that logic in your app. Invoke a saved automation
List available automations

Manage Preferences

Let users control what they receive. Preferences are enforced at send time; Courier won’t deliver a notification if the user has opted out of that topic. Check a user’s current preferences
View preferences for a specific topic

Output Formats

Every command supports structured output via the --format flag: Filter output with GJSON syntax using --transform:

Global Flags

Scripting and CI/CD

Smoke-test a notification after deploy Run this in your CI pipeline to verify notifications still work after a deploy.
Store API keys as secrets in your CI provider (GitHub Actions secrets, GitLab CI variables, etc.) rather than hardcoding them.
Export recent notifications as JSON Useful for auditing or syncing with external systems.
Count notifications by status

AI Agent Usage

The CLI works as a zero-config tool for AI agents in Cursor, Claude Code, Codex, and similar environments. Install once, set COURIER_API_KEY, and agents can run Courier operations directly via shell commands. Every command supports --format json for machine-readable output.

What’s Next

Manage Templates (CLI & MCP)

Step-by-step tutorial: create, publish, send, and archive templates from the CLI

MCP Server

Structured AI tool access for sending messages, managing users, and more

API Reference

Full REST API documentation

Source code: trycourier/courier-cli