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

# Forward Courier events to Datadog

> Forward delivery metrics and message logs to Datadog with an API key and site.

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>;
};

## Setup

<Steps>
  <Step title="Create a Datadog account">
    Create a Datadog account if you don't have one.
  </Step>

  <Step title="Generate an API key">
    Generate a Datadog [API key](https://app.datadoghq.com/organization-settings/api-keys).
  </Step>

  <Step title="Add the API key in Courier">
    Open the <AppLink href="https://app.courier.com/integrations/catalog/datadog">Datadog integration page</AppLink> in Courier and enter the API key you generated.
  </Step>

  <Step title="Verify the Datadog site parameter">
    Check that the [Datadog site parameter](https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site) matches the URL of your Datadog instance.
  </Step>

  <Step title="Add tags (optional)">
    Use the **Tags** field to tag everything Courier emits. Courier sends them as Datadog `ddtags`, so you can filter metrics and logs by environment or team.
  </Step>
</Steps>

<Info>
  The Datadog integration is **forward-only**. Courier starts emitting metrics when you activate it. It does not backfill historical data.
</Info>

## Dashboard

Download the Courier Datadog dashboard to monitor Courier inside Datadog.

[Download Dashboard JSON](https://github.com/trycourier/shareable/blob/main/courier-datadog-dashboard.json)

<Frame caption="Datadog Dashboard">
  <img src="https://mintcdn.com/courier-4f1f25dc/fN1MbwzHtG3Vhos5/assets/datadog-dashboard.webp?fit=max&auto=format&n=fN1MbwzHtG3Vhos5&q=85&s=7e92e5b0580d85b02e668502cbc97778" alt="Datadog Dashboard" width="2524" height="1532" data-path="assets/datadog-dashboard.webp" />
</Frame>

## Available Datadog metrics

<Tip>Datadog's Metrics Without Limits lets you [configure a tag blocklist](https://docs.datadoghq.com/metrics/metrics-without-limits/#blocklist-of-tags) to cut cardinality and cost. You're still [billed](https://docs.datadoghq.com/account_management/billing/custom_metrics/?tab=countrate) for ingestion, at a lower rate.</Tip>

### Account metrics

* `courier.account.created`
* `courier.account.deleted`
* `courier.account.updated`

### Account user relationship metrics

* `courier.account.user.added`
* `courier.account.user.removed`
* `courier.account.user.updated`

### Audience metrics

* `courier.audience.matched`
* `courier.audience.unmatched`

### Automation metrics

* `courier.automation.invoked`
* `courier.automation.throttled`
* `courier.automation.digest.triggered`
* `courier.automation.batch.triggered`
* `courier.automation.fetch-data-step.errored`
* `courier.automation.ai-step.completed`
* `courier.automation.ai-step.errored`

### Channel metrics

* `courier.email.delivered`
* `courier.email.error`
* `courier.email.sent`
* `courier.email.undeliverable`
* `courier.sms.delivered`
* `courier.sms.error`
* `courier.sms.sent`
* `courier.sms.undeliverable`
* `courier.push.delivered`
* `courier.push.error`
* `courier.push.sent`
* `courier.push.undeliverable`
* `courier.direct_message.delivered`
* `courier.direct_message.error`
* `courier.direct_message.sent`
* `courier.direct_message.undeliverable`
* `courier.inbox.delivered`
* `courier.inbox.error`
* `courier.inbox.sent`
* `courier.inbox.undeliverable`
* `courier.webhook.delivered`
* `courier.webhook.error`
* `courier.webhook.sent`
* `courier.webhook.undeliverable`
* `courier.banner.delivered`
* `courier.banner.error`
* `courier.banner.sent`
* `courier.banner.undeliverable`

### Debug metric

* `courier.debug`

### Inbox metrics

* `courier.inbox.connection_attempt`
* `courier.inbox.connection_error`
* `courier.inbox.reconnection_attempt`
* `courier.inbox.notification_attempt`

### List metrics

* `courier.list.subscribed`
* `courier.list.unsubscribed`
* `courier.list.subscribe.failed`

### Message metrics

* `courier.message.canceled`
* `courier.message.clicked.details`
* `courier.message.delivered`
* `courier.message.digested`
* `courier.message.filtered`
* `courier.message.received`
* `courier.message.sent`
* `courier.message.throttled`
* `courier.message.total.clicked`
* `courier.message.total.opened`
* `courier.message.undeliverable`
* `courier.message.unique.clicked`
* `courier.message.unique.opened`
* `courier.message.unique.sent`
* `courier.message.unmapped`
* `courier.message.unroutable`

### User metrics

* `courier.user.created`
* `courier.user.deleted`
* `courier.user.unsubscribed`
* `courier.user.updated`
* `courier.user.update.failed`

## Logs

Courier also forwards delivery logs to Datadog's log intake for your site (`https://http-intake.logs.<your-datadog-site>/api/v2/logs`). Each entry carries the message, its level, and any tags from the **Tags** field, so you can match a log line to the metric that reported it. No extra setup is needed. The same API key and site parameter cover both.

## Troubleshooting

| Symptom                                                   | Cause                                                      | Fix                                                                                                                                           |
| --------------------------------------------------------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| No metrics appearing in Datadog                           | API key incorrect, or Datadog site parameter mismatch      | Verify the API key and [site parameter](https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site) match your Datadog instance |
| Metrics start from integration date, not historical       | The integration is forward-only                            | Expected behavior. Courier does not backfill. Enable the integration before you need the data                                                 |
| Metrics appear in test but not production (or vice versa) | The integration is configured per environment              | Install the Datadog integration in each Courier environment (test and production) separately                                                  |
| `courier.message.*` counts don't match message logs       | Metrics are emitted per status transition, not per message | A single message may trigger multiple `message.updated` metrics as it progresses through statuses                                             |
