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

# Message statuses and errors

> Every message status and what it means, the Send API's error responses, why a send is UNROUTABLE or THROTTLED, and why a message stops at SENT.

A send is asynchronous. The API returns a `requestId`, and the message moves through a status lifecycle you track in the logs.

## How it works

### The status lifecycle

A message's status only advances, never backward. Two independent systems drive it. **Provider confirmation** produces `DELIVERED`. **Courier tracking** produces `OPENED` and `CLICKED`, so engagement can arrive before or without a delivery confirmation.

| Category | Statuses | Meaning |
| - | - | - |
| Intermediate | `ENQUEUED`, `ROUTED`, `SENT` | Still processing or awaiting provider confirmation. `SENT` isn't terminal. |
| Terminal (delivery) | `DELIVERED`, `UNDELIVERABLE` | Provider accepted, or rejected/failed. |
| Terminal (engagement) | `OPENED`, `CLICKED` | The recipient interacted. |
| Terminal (routing) | `UNROUTABLE`, `CANCELED`, `FILTERED`, `UNMAPPED` | The message never reached a provider. |
| Processing | `DELAYED`, `DIGESTED`, `THROTTLED` | Held for later, batched into a digest, or rate-limited. |

Open a message in the [logs](https://www.courier.com/docs/monitor/overview.md) to see its provider response.

### Send API responses

A successful send returns a `requestId` you use to track the message:

```json theme={null}
{ "requestId": "87e7c05b-4f46-fda24e356e23" }
```

A failed request returns an HTTP error with a `message` and a `type`:

| Type | Status | Meaning |
| - | - | - |
| `invalid_request_error` | 400, 404, 409, 413 | Malformed request or a missing resource. Fix it before retrying. |
| `authentication_error` | 401 | The API key is missing, invalid, or for the wrong environment. |
| `authorization_error` | 403 | The key is valid but lacks permission. |
| `rate_limit_error` | 429 | A rate limit was exceeded. Back off and retry. |
| `api_error` | 500, 503 | A Courier-side error. Retry with exponential backoff. |

The most common `400` on `/send` is `Either 'content' or 'template' must be defined`. Send one, not both. Next most common are a missing `to`, or a `list_id`/`audience_id` that doesn't exist. A `413` means the request exceeded the **6 MB** payload limit. Host attachments externally and pass URLs in `data` rather than base64.

### Limits

[`POST /send`](https://www.courier.com/docs/api-reference/send/send-a-message) is **not rate-limited by request count**, so you can send at volume. Its request body caps at **6 MB**, as does [`POST /automations/invoke`](https://www.courier.com/docs/api-reference/automations/invoke-an-ad-hoc-automation). Every other endpoint caps at 1 MB.

A few management endpoints are rate-limited per workspace. Their responses carry `X-RateLimit-Limit` and `X-RateLimit-Remaining` so you can pace requests. Exceeding a limit returns `429 Too Many Requests`:

| Endpoint | Limit |
| - | - |
| [`PUT /lists/{list_id}`](https://www.courier.com/docs/api-reference/lists/update-a-list) | 60 requests / minute |
| `POST` or [`PUT /users/{user_id}/preferences`](https://www.courier.com/docs/api-reference/user-preferences/replace-user-preferences-in-bulk) | 50 requests / second |
| [`POST /messages/{message_id}/resend`](https://www.courier.com/docs/api-reference/messages/resend-message) | 1 request / 2 seconds, per message |

Endpoints not listed here aren't request-count limited today.

### Send limits

**Send limits** cap how many messages Courier sends in a period: across the environment, per user, per tenant, or per user for one subscription topic. Set them in **Settings → Send Limits**. Each limit counts messages per billing period, hour, day, week, or month, and you can exclude subscription topics from every limit. They are a separate feature from API rate limits. A message blocked by one shows as `THROTTLED` in the log instead of delivering. A [send rate limit](https://www.courier.com/docs/integrations/send-rate-limits.md) on a provider queues sends above the rate instead of blocking them.

The Developer plan's 10,000-sends-per-period cap produces the same `THROTTLED` status. It applies after the API returns `202`, so the status shows up in the message log rather than the response. A `THROTTLED` message you didn't set a limit for usually means the plan cap.

### Why a message is UNROUTABLE

`UNROUTABLE` is one status with several causes. Open the message in [Logs](https://app.courier.com/logs) and read its `reason`:

| `reason` | Cause | Fix |
| - | - | - |
| `NO_PROVIDERS` | No provider is configured for the routed channel in this environment, or none of the configured ones is allowed by the send's channel list. | Configure a provider for the channel in [Integrations](https://app.courier.com/integrations), or drop the channel from `routing`. |
| `NO_CHANNELS` | No channel resolved for the send. | Add a channel to `routing`, or to the template's routing strategy. |
| `UNPUBLISHED` | The template has never been published. | Publish it. |
| `OPT_IN_REQUIRED` | The topic needs an opt-in the recipient hasn't given. | See [preference resolution](https://www.courier.com/docs/recipients/preferences/overview.md#status-precedence). |
| `UNSUBSCRIBED` | The recipient opted out of the topic. | Expected. Opt-outs are per tenant, so check the tenant context too. |
| `FILTERED` | A channel or provider condition evaluated false. | Check the `if` conditions on the channel and provider. |

The timeline then shows one attempt per provider, each with its own `reason` for being skipped:

| Provider `reason` | Meaning |
| - | - |
| `MISSING_CONFIGURATION` | The provider is named on the send or template but isn't configured in this environment. |
| `MISSING_PROVIDER_SUPPORT` | The provider doesn't serve that channel. |
| `INCOMPLETE_PROFILE_DATA` | The recipient has no address this provider can use: no `email` or `phone_number` on the profile, or no device token stored for the user. See [what each channel needs](https://www.courier.com/docs/recipients/overview.md#what-each-channel-needs). |
| `FILTERED_AT_PROVIDER` | The provider's own `if` condition evaluated false. |

To audit in bulk, list the failures over the API:

```javascript Node.js highlight={1} theme={null}
const messages = await client.messages.list({ status: ['UNROUTABLE'] });

for (const message of messages.results) {
  console.log(message.messageId, message.reason);
}
```

```python Python highlight={1} theme={null}
messages = client.messages.list(status=["UNROUTABLE"])

for message in messages.results:
    print(message.message_id, message.reason)
```

```bash cURL theme={null}
curl "https://api.courier.com/messages?status=UNROUTABLE" \
  -H "Authorization: Bearer $COURIER_API_KEY"
```

```ruby Ruby highlight={1} theme={null}
messages = courier.messages.list(status: ["UNROUTABLE"])

messages.results.each do |message|
  puts "#{message.message_id} #{message.reason}"
end
```

```go Go highlight={2} theme={null}
messages, err := client.Messages.List(context.TODO(), courier.MessageListParams{
	Status: []string{"UNROUTABLE"},
})
if err != nil {
	panic(err)
}

for _, message := range messages.Results {
	fmt.Println(message.MessageID, message.Reason)
}
```

```java Java highlight={2} theme={null}
MessageListResponse messages =
    client.messages().list(MessageListParams.builder().addStatus("UNROUTABLE").build());

messages.results().forEach(message ->
    System.out.println(message.messageId() + " " + message.reason()));
```

```php PHP highlight={1} theme={null}
$messages = $client->messages->list(status: ['UNROUTABLE']);

foreach ($messages->results as $message) {
  echo $message->messageId . ' ' . $message->reason . PHP_EOL;
}
```

```csharp C# highlight={1} theme={null}
var messages = await client.Messages.List(new() { Status = ["UNROUTABLE"] });

foreach (var message in messages.Results)
{
    Console.WriteLine($"{message.MessageID} {message.Reason}");
}
```

```bash CLI highlight={3} theme={null}
courier messages list \
  --api-key "$COURIER_API_KEY" \
  --status UNROUTABLE
```

```text MCP theme={null}
With Courier MCP, list my messages with the UNROUTABLE status.
```

### Debug other statuses

* **Stuck at `SENT`**: delivery tracking isn't configured for that channel, not a failure. See [delivery tracking](#delivery-tracking-is-per-provider).
* **`FILTERED`**: preferences, send conditions, or routing removed the message. Check the recipient's [preferences](https://www.courier.com/docs/recipients/preferences/overview.md).
* **`UNDELIVERABLE`**: the provider rejected it. The timeline shows the provider's error.

For real-time status without polling, receive the `message:updated` [outbound webhook](https://www.courier.com/docs/monitor/webhooks/outbound.md).

### Delivery tracking is per provider

`DELIVERED` only appears when the provider tells Courier the message landed. That reporting is **off until you set it up, per provider**. Until then a healthy send stops at `SENT`. This is the most common reason a working integration looks broken.

A provider reports in one of four ways:

| How it reports | What you do | Providers |
| - | - | - |
| **Webhook** | Paste Courier's webhook URL into the provider, and it pushes status in real time. | [SendGrid](https://www.courier.com/docs/integrations/email/sendgrid.md#delivery-tracking), [AWS SES](https://www.courier.com/docs/integrations/email/aws-ses.md#delivery-tracking), [Mailgun](https://www.courier.com/docs/integrations/email/mailgun.md), [Resend](https://www.courier.com/docs/integrations/email/resend.md), [Sinch Engage](https://www.courier.com/docs/integrations/sms/sinch-engage.md) |
| **Polling** | Turn the toggle on in the integration's settings. Courier then asks the provider's API on a schedule. | SendGrid, Mailgun, [Twilio](https://www.courier.com/docs/integrations/sms/twilio.md), [Postmark](https://www.courier.com/docs/integrations/email/postmark.md), [Mandrill](https://www.courier.com/docs/integrations/email/mandrill.md), [Plivo](https://www.courier.com/docs/integrations/sms/plivo.md) |
| **Immediate** | Nothing. The provider acknowledges synchronously, so Courier marks the message `DELIVERED` on accept. | [Slack](https://www.courier.com/docs/integrations/direct-message/slack.md), [Microsoft Teams](https://www.courier.com/docs/integrations/direct-message/microsoft-teams.md), [Discord](https://www.courier.com/docs/integrations/direct-message/discord.md), [Stream Chat](https://www.courier.com/docs/integrations/direct-message/stream-chat.md), [Viber](https://www.courier.com/docs/integrations/direct-message/viber.md), [PagerDuty](https://www.courier.com/docs/integrations/other/pagerduty.md), [Webhook](https://www.courier.com/docs/integrations/other/webhook-integration.md) |
| **Reported by your app** | Use a Courier mobile SDK, or `POST` the `trackingUrl` from the payload yourself. | [APNs, FCM, Expo, OneSignal](https://www.courier.com/docs/integrations/push/overview.md#tracking) |

Providers absent from this table send no delivery confirmation, so their messages stop at `SENT` by design. Where both a webhook and polling are offered, prefer the webhook. It is real time and needs no extra provider permissions.

## FAQ

> [accordion] What does UNROUTABLE mean?
>
> Courier found no valid route: the recipient had no address for the routed channel, or no channel was configured for the send. Check the recipient's profile against [what each channel needs](https://www.courier.com/docs/recipients/overview.md#what-each-channel-needs), and check the send's routing.

> [accordion] My message is stuck at SENT. Did it fail?
>
> Usually not. `SENT` means Courier handed it to the provider and got no delivery confirmation back. That usually means delivery tracking isn't set up for that channel.

> [accordion] Is the Send API rate-limited?
>
> Not by request count. You can send at volume. A few management endpoints are limited (see the table above). Send limits (per user, topic, or tenant) govern message volume and mark blocked messages `THROTTLED`.

> [accordion] Why did I get a 413?
>
> The request exceeded the body-size cap: 6 MB on `/send` and `/automations/invoke`, 1 MB on every other endpoint. Host attachments externally and pass their URLs in `data`. Base64 inflates size by about a third.
