> ## 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.

> ## Agent Instructions
> Install the Courier skill before writing code: `npx skills add trycourier/courier-skills`. It carries the verified SDK shapes and the rules you cannot get wrong.
> Authenticate every request with `Authorization: Bearer <API_KEY>`. A workspace has several environments and each has its own keys, which are plain `pk_` strings with no environment prefix. Start with Test.
> Send with `client.send.message` from the Node SDK (`@trycourier/courier` v7 and later, where the client is the default import). Reference a template by its `nt_` id or its alias.
> A send accepts a bare Elemental element list, but storing content on a template requires the top-level elements wrapped in a channel element.
> To translate a template, write one locale at a time with `PUT /notifications/{id}/locales/{localeId}`, which merges into the existing translations. `PUT /notifications/{id}/content` and `PUT /notifications/{id}/elements/{elementId}` overwrite translations along with the content, so send each element's `id` and `locales` back, and first remove every `checksum` and any `locales` key that starts with an underscore.
> Templates and journeys can be built in the Courier app or created through the API. Either way they live in the workspace and are referenced by ID when you send.
> The hosted MCP server is https://mcp.courier.com. For a briefing on what Courier is and when to use it, read https://www.courier.com/llms.txt.
> Prefer the Guides tab for how-do-I questions and the Docs tab for how-does-it-behave questions. The API reference lives under /api-reference.

# Courier CLI

> Install the Courier CLI with npm or as a binary for macOS, Linux, or Windows, then learn its resource and verb command structure and read JSON output.

A native binary covering the full [Courier REST API](https://www.courier.com/docs/reference/api-overview.md). Runs on macOS, Linux, and Windows with no runtime dependencies.

## Install

> [tab] npm
>
> ```bash theme={null}
> npm install -g @trycourier/cli
> ```
>
> A postinstall step downloads the binary for your platform. Node.js isn't needed afterwards.

> [tab] Direct download
>
> Download the binary for your platform from [GitHub Releases](https://github.com/trycourier/courier-cli/releases), extract it, and add it to your `PATH`.

Then set your key from [Platform → API Keys](https://app.courier.com/settings/api-keys):

```bash theme={null}
export COURIER_API_KEY="YOUR_COURIER_API_KEY"
courier --version
```

## Command structure

```bash theme={null}
courier [resource] <command> [flags...]
```

Add `--help` to any command for its flags. Send a notification:

```bash theme={null}
courier send message \
  --message.to '{"user_id": "user_123"}' \
  --message.template "nt_01kx4h2jdafq8bk9aftxak4b40" \
  --message.data '{"commenter": "Sara", "file": "Homepage Redesign"}'
```

## Resources

A colon joins a resource to its sub-resource, so a user's push tokens live under `users:tokens`. Run `courier --help` for the full list.

| Resource | Commands |
| - | - |
| `send` | `message` |
| `messages` | `list`, `retrieve`, `history`, `content`, `cancel`, `resend` |
| `profiles` | `create`, `retrieve`, `update`, `replace`, `delete` |
| `profiles:lists` | `retrieve`, `subscribe`, `delete` |
| `users:tokens` | `list`, `retrieve`, `add-single`, `add-multiple`, `update`, `delete` |
| `users:preferences` | `retrieve`, `retrieve-topic`, `update-or-create-topic`, `bulk-update`, `bulk-replace`, `delete-topic` |
| `users:tenants` | `list`, `add-single`, `add-multiple`, `remove-single`, `remove-all` |
| `lists` | `list`, `retrieve`, `update`, `delete`, `restore` |
| `lists:subscriptions` | `list`, `add`, `subscribe`, `subscribe-user`, `unsubscribe-user` |
| `audiences` | `list`, `retrieve`, `update`, `delete`, `list-members` |
| `notifications` | `list`, `create`, `retrieve`, `retrieve-content`, `put-content`, `put-element`, `put-locale`, `replace`, `publish`, `list-versions`, `get-metrics`, `archive` |
| `brands` | `list`, `create`, `retrieve`, `update`, `delete` |
| `tenants` | `list`, `retrieve`, `update`, `delete`, `list-users` |
| `tenants:templates` | `list`, `retrieve`, `replace`, `publish`, `delete` |
| `journeys` | `list`, `create`, `retrieve`, `replace`, `publish`, `invoke`, `cancel`, `list-versions`, `archive` |
| `journeys:runs` | `list`, `retrieve`, `list-steps` |
| `journeys:templates` | `list`, `create`, `retrieve`, `retrieve-content`, `put-content`, `put-locale`, `replace`, `publish`, `list-versions`, `archive` |
| `broadcasts` | `list`, `create`, `retrieve`, `update`, `put-content`, `retrieve-content`, `send`, `schedule`, `cancel`, `duplicate`, `archive` |
| `bulk` | `create-job`, `add-users`, `run-job`, `retrieve-job`, `list-users` |
| `digests:schedules` | `list-instances`, `release` |
| `providers` | `list`, `create`, `retrieve`, `update`, `delete` |
| `routing-strategies` | `list`, `create`, `retrieve`, `replace`, `list-notifications`, `archive` |
| `workspace-preferences` | `list`, `create`, `retrieve`, `replace`, `publish`, `archive` |
| `auth` | `issue-token` |

## Output

`--format` sets the shape: `auto` (default), `json`, `yaml`, `pretty`, `raw`, `explore`, or `jsonl` for streaming. `auto` is human-readable in terminals and JSON in pipes.

`--transform` filters output with [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md):

```bash theme={null}
courier messages list --format json --transform "results.#.id"
courier messages list --format json --transform "results.#(status=UNDELIVERABLE)"
```

Other global flags:

* `--api-key` overrides `COURIER_API_KEY` for one command.
* `--base-url` points at a custom API URL.
* `--debug` prints the HTTP request and response.

## Recipes

[Recipes](https://www.courier.com/docs/resources/cli/recipes.md) carries one command block per task: sending, debugging a delivery, profiles and push tokens, templates, journeys, broadcasts, bulk jobs, pagination, and CI.
