> ## 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`, the default import of the v7 Node SDK. 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.
> 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 CLI, learn its resource and verb command structure, and read JSON output.

export const AppLink = ({href, children, name, bare}) => {
  const label = children || name || "Open in Courier";
  if (bare) {
    return <a href={href} target="_blank" rel="noreferrer">{label}</a>;
  }
  return <a className="cx-endpoint" data-kind="app" href={href} target="_blank" rel="noreferrer">
      <span className="cx-endpoint-label">{label}</span>
      <span className="cx-endpoint-method" aria-hidden="true">↗</span>
    </a>;
};

export const Doc = ({href, children, name, bare}) => {
  const label = children || name || href;
  if (bare) {
    return <a href={href}>{label}</a>;
  }
  return <a className="cx-endpoint" data-kind="doc" href={href}>
      <span className="cx-endpoint-label">{label}</span>
      <span className="cx-endpoint-method">DOC</span>
    </a>;
};

A native binary covering the full <Doc href="/docs/reference/api-overview">Courier REST API</Doc>. Runs on macOS, Linux, and Windows with no runtime dependencies.

## Install

<Tabs>
  <Tab title="npm">
    ```bash theme={null}
    npm install -g @trycourier/cli
    ```

    A postinstall step downloads the binary for your platform. Node.js is not needed afterwards.
  </Tab>

  <Tab title="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`.
  </Tab>
</Tabs>

Then set your key from <AppLink href="https://app.courier.com/settings/api-keys">Settings → API Keys</AppLink>:

```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

| Resource        | Commands                                           |
| --------------- | -------------------------------------------------- |
| `send`          | `message`                                          |
| `messages`      | `list`, `retrieve`, `history`, `output`            |
| `profiles`      | `create`, `retrieve`, `replace`, `patch`, `delete` |
| `lists`         | `list`, `update`, `subscribe`, `unsubscribe`       |
| `notifications` | `list`, `create`, `retrieve-content`, `publish`    |
| `tenants`       | `create`, `list`, `retrieve`                       |
| `user-tenants`  | `add`, `remove`, `list`                            |
| `preferences`   | `retrieve`, `retrieve-topic`, `update-topic`       |
| `automations`   | `invoke`, `list`                                   |
| `bulk`          | `create`, `add-users`, `run`, `retrieve`           |

## Output

`--format` sets the shape: `auto` (default), `json`, `yaml`, `pretty`, `raw`, 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

<Doc href="/docs/resources/cli/recipes">Recipes</Doc> carries one command block per task: sending, profiles, debugging a delivery, bulk jobs, templates, tenants, preferences, and CI.
