> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anpord.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Channels

> Naming the version each audience receives

A channel is a named pointer at a version. Callers ask for a channel rather than
a number, so the number can change without them.

## Production

Every prompt gets `production` by default, and a `get` with no selector resolves
it. In application code, ask for nothing:

```ts theme={null}
const prompt = await anpord.prompts.get({ id: "support-reply" });
```

## Adding a channel

Promoting to a name that does not exist yet creates it:

```ts theme={null}
await anpord.prompts.promote({
  id: "support-reply",
  channel: "staging",
  version: 6,
});
```

Now the same prompt answers differently depending on who asks:

```ts theme={null}
await anpord.prompts.get({ id: "support-reply" });                      // production
await anpord.prompts.get({ id: "support-reply", channel: "staging" });  // version 6
```

Which suits running a new prompt against internal traffic while customers keep
receiving the version you trust.

```ts theme={null}
const channel = process.env.NODE_ENV === "production" ? "production" : "staging";

const prompt = await anpord.prompts.get({ id: "support-reply", channel });
```

## The latest channel

`latest` always resolves the highest version:

```ts theme={null}
await anpord.prompts.get({ id: "support-reply", channel: "latest" });
```

It is derived from the version table rather than stored, so it cannot fall out
of step with it.

<Warning>
  Do not point production traffic at `latest`. Every edit ships the moment it is
  written, with no review and nothing to roll back to.
</Warning>

## Naming

Channel names are lowercase alphanumeric and may contain `_` or `-`, up to 36
characters. Name them after the audience, not the version: `production`,
`staging`, `beta`.
