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:
export COURIER_API_KEY="your-api-key"
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

npm install -g @trycourier/cli
This downloads a platform-specific binary via a postinstall step. No Node.js runtime is needed after installation.
Verify the installation:
courier --version

Command Structure

The CLI uses a resource-based pattern:
courier [resource] <command> [flags...]
Use --help on any command to see available flags:
courier send --help
courier messages list --help

Common Commands

Send a message

courier send message \
  --message.to.user_id "user-123" \
  --message.template "order-confirmation" \
  --message.data '{"orderId": "ORD-456"}'

List recent messages

courier messages list

Inspect a message

courier messages retrieve --message-id "1-abc123"

View delivery history

courier messages history --message-id "1-abc123"

Get a user profile

courier profiles retrieve --user-id "user-123"

List notification templates

courier notifications list

Output Formats

Every command supports structured output via the --format flag:
FormatDescription
autoDefault; human-readable for terminals, JSON for pipes
jsonJSON output
yamlYAML output
prettyColorized, indented JSON
rawRaw response body
jsonlNewline-delimited JSON (for streaming)
Filter output with GJSON syntax using --transform:
courier messages list --format json --transform "results.#.id"

Global Flags

FlagDescription
--api-keyOverride COURIER_API_KEY for this command
--base-urlUse a custom API URL
--formatOutput format (auto, json, yaml, pretty, raw, jsonl)
--transformFilter output with GJSON syntax
--debugShow HTTP request/response details
--version, -vPrint CLI version
--helpShow command usage

CI/CD Integration

Use the CLI in automated pipelines to validate sends or run smoke tests during deployment.
export COURIER_API_KEY="$COURIER_TEST_KEY"

courier send message \
  --message.to.user_id "smoke-test-user" \
  --message.template "welcome"
Store API keys as secrets in your CI provider (GitHub Actions secrets, GitLab CI variables, etc.) rather than hardcoding them.

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.
Source code: trycourier/courier-cli