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

# Lists

> Hand-picked groups of users, like beta testers, addressed with list_id. Covers dotted list IDs, wildcard patterns across many lists, and tenant scoping.

A list is a group of users you curate. Membership changes only when you change it, and a member is in the list the moment you add them.

Use a list for hand-picked groups: beta testers, a VIP cohort, an internal team. When membership should follow from profile data, use an [audience](https://www.courier.com/docs/recipients/lists-and-audiences/audiences.md).

Browse lists and their members under [Directory → Lists](https://app.courier.com/directory/lists), or manage them over the API as below.

## How it works

Each list has a dotted-namespace `list_id` such as `acme-corp.beta-testers`. Target one on a send with `list_id`:

```json theme={null}
{
  "to": { "list_id": "acme-corp.beta-testers" }
}
```

The [Lists API](https://www.courier.com/docs/api-reference/lists/get-a-list.md) manages lists and their members. [`PUT /lists/{list_id}`](https://www.courier.com/docs/api-reference/lists/update-a-list) is an upsert, so it also creates one. The `/lists/{list_id}/subscriptions` endpoints add, replace, read, and remove members. [`PUT /lists/{list_id}/subscriptions/{user_id}`](https://www.courier.com/docs/api-reference/lists/subscribe-a-user-profile-to-a-list) subscribes one user.

### List patterns

Because `list_id` is a dotted namespace, one pattern can target many lists at once. Set `list_pattern` on the recipient. `*` matches any single part. `**` is a trailing wildcard:

```json theme={null}
{
  "to": { "list_pattern": "acme-corp.*.beta-testers" }
}
```

The same pattern syntax filters lists on [`GET /lists`](https://www.courier.com/docs/api-reference/lists/list-lists) through its `pattern` parameter.

Naming a list after an entity, such as `document.doc_a1b2.watchers`, turns this into per-entity subscriptions. [Notify everyone watching](https://www.courier.com/docs/guides/notify-everyone-watching.md) walks that pattern end to end.

#### Valid ids and patterns

A `list_id` holds up to six dot-separated segments. It can't be empty, include `*`, `#`, or a space, start or end with a period, or hold two periods in a row.

A wildcard replaces one whole segment, never part of one, so every `*` follows a period. Courier rejects these patterns:

| Pattern | Why |
| - | - |
| `*`, `**` | Matches every list. At least one segment has to be literal. |
| `*.*` | Same reason: nothing but wildcards and periods. |
| `news*` | A wildcard can't match part of a segment. Use `news.*`. |
| `news.*.**` | A `*` can't be followed later by `**`. |
| `news.***` | At most two consecutive asterisks. |
| `news.**.weekly` | `**` is trailing only. |
| `.news`, `news.` | Can't start or end with a period. |
| `news..weekly` | No consecutive periods. |
| `news weekly` | No spaces. |

### Scoping a list send to a tenant

`context.tenant_id` controls branding, preferences, and template variables. It does **not** restrict which list members receive the message. To send only to users in one tenant, add an inline `filters` array with the `MEMBER_OF` operator:

```json theme={null}
{
  "to": {
    "list_id": "acme-corp.beta-testers",
    "filters": [
      { "operator": "MEMBER_OF", "path": "tenant_id", "value": "acme-corp" }
    ]
  },
  "context": { "tenant_id": "acme-corp" }
}
```

Users must have tenant membership, set with [`PUT /users/{user_id}/tenants/{tenant_id}`](https://www.courier.com/docs/api-reference/tenant-memberships/add-a-user-to-a-tenant), to pass the filter.

## FAQ

> [accordion] Should I use a list or an audience?
>
> Use a list when you pick members by hand and want membership exact, like beta testers or VIPs. Use an [audience](https://www.courier.com/docs/recipients/lists-and-audiences/audiences.md) when membership follows from profile data and should update itself.

> [accordion] Can I send to several lists at once?
>
> Use `list_pattern` with `*` for a single part, or `**` as a trailing wildcard, to match many `list_id`s in one send.
