> ## 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.
> Adding notifications to a framework app? Start from its quickstart, which has a runnable repo and complete files: Next.js email https://www.courier.com/docs/guides/add-transactional-email-to-nextjs.md, Django https://www.courier.com/docs/guides/add-notifications-to-django.md, Rails https://www.courier.com/docs/guides/add-notifications-to-rails.md, Node.js digest https://www.courier.com/docs/guides/batch-notifications-into-a-daily-digest-in-node.md, Laravel https://www.courier.com/docs/guides/add-notifications-to-laravel.md, FastAPI https://www.courier.com/docs/guides/send-notifications-from-fastapi.md, Express https://www.courier.com/docs/guides/add-notifications-to-express.md, and the React, Next.js, Astro, and Nuxt inbox quickstarts under /guides/add-an-inbox-to-*.
> 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.

# Keep your email provider and add Courier

> Keep Resend, SendGrid, Postmark, or SES for email and add Courier on top for an in-app inbox, preferences, failover, and logs, with no DNS changes.

Courier doesn't replace your email provider. It sends through the Resend, SendGrid, Postmark, or SES account you already have, and adds what an email API doesn't: an in-app inbox, user preferences, routing, failover, and one log for every channel.

This guide moves one email onto Courier, then sends the same message to the user's inbox.

## Who does what

Your provider keeps delivering email from the domain you verified with it. Courier decides where each message goes.

| Job | Done by |
| :- | :- |
| Delivers the email from your verified domain | Your provider, with your API key |
| Bills for email delivery | Your provider |
| Picks channels and applies each user's preferences | Courier |
| Fails over to a backup email provider | Courier |
| Shows the message in your app's inbox | Courier |
| Logs every send across channels, and bills per send | Courier |

## Prerequisites

* [A Courier Test API key](https://app.courier.com/~/test/platform/api-keys)
* The provider credentials and verified sending domain your app uses today
* A [Courier SDK](https://www.courier.com/docs/sdk-libraries/sdks-overview.md) in your server code, or `curl`

## Move one email

**1. Connect your provider in Courier**

Open [Integrations](https://app.courier.com/integrations/catalog), pick your provider, and paste the same credentials your app uses: an API key for most providers, or access keys or an IAM role plus your region for Amazon SES. Each provider's page lists its fields: [Resend](https://www.courier.com/docs/integrations/email/resend.md), [SendGrid](https://www.courier.com/docs/integrations/email/sendgrid.md), [Postmark](https://www.courier.com/docs/integrations/email/postmark.md), [Amazon SES](https://www.courier.com/docs/integrations/email/aws-ses.md), and [the rest](https://www.courier.com/docs/integrations/overview.md).

Set the From address to one on the domain you already verified, and your DNS stays as it is. Include the display name, as in `Acme Support <support@acme-corp.com>`, or it's lost. A template's From field or a send's `channels.email.override.from` takes priority over this default, as [Send from your domain](https://www.courier.com/docs/guides/send-from-your-domain.md) explains.

Integrations are per environment, so connect it in the environment your API key belongs to. In Test, the **Courier Test Email Provider** stays connected too, so put yours first in [channel priority](https://www.courier.com/docs/send/routing.md#channel-priority).

**2. Send the same email through Courier**

Find one place your app calls its provider directly. Here is a typical Resend call:

```javascript Before theme={null}
await resend.emails.send({
  from: "Acme Support <support@acme-corp.com>",
  to: "sarah@acme-corp.com",
  subject: "Your order shipped",
  text: "Order 1042 is on its way.",
});
```

Replace it with a Courier send. `user_id` is your own id for the person, which Courier uses for the inbox in the next step. `title` becomes the subject and `body` the message, and the From address comes from the integration.

```javascript Node.js highlight={4} theme={null}
const { requestId } = await client.send.message({
  message: {
    to: { user_id: "user_123", email: "sarah@acme-corp.com" },
    routing: { method: "single", channels: ["email"] },
    content: { title: "Your order shipped", body: "Order 1042 is on its way." },
  },
});
```

```python Python highlight={4} theme={null}
response = client.send.message(
    message={
        "to": {"user_id": "user_123", "email": "sarah@acme-corp.com"},
        "routing": {"method": "single", "channels": ["email"]},
        "content": {"title": "Your order shipped", "body": "Order 1042 is on its way."},
    },
)
```

```bash cURL highlight={7} theme={null}
curl -X POST https://api.courier.com/send \
  -H "Authorization: Bearer $COURIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "to": { "user_id": "user_123", "email": "sarah@acme-corp.com" },
      "routing": { "method": "single", "channels": ["email"] },
      "content": { "title": "Your order shipped", "body": "Order 1042 is on its way." }
    }
  }'
```

```ruby Ruby highlight={4} theme={null}
response = courier.send_.message(
  message: {
    to: {user_id: "user_123", email: "sarah@acme-corp.com"},
    routing: {method: "single", channels: ["email"]},
    content: {title: "Your order shipped", body: "Order 1042 is on its way."}
  }
)
```

```go Go highlight={11} theme={null}
response, err := client.Send.Message(context.TODO(), courier.SendMessageParams{
	Message: courier.SendMessageParamsMessage{
		To: courier.SendMessageParamsMessageToUnion{
			OfUserRecipient: &shared.UserRecipientParam{
				UserID: courier.String("user_123"),
				Email:  courier.String("sarah@acme-corp.com"),
			},
		},
		Routing: courier.SendMessageParamsMessageRouting{
			Method:   string(shared.MessageRoutingMethodSingle),
			Channels: []shared.MessageRoutingChannelUnionParam{{OfString: courier.String("email")}},
		},
		Content: courier.SendMessageParamsMessageContentUnion{
			OfElementalContentSugar: &shared.ElementalContentSugarParam{
				Title: "Your order shipped",
				Body:  "Order 1042 is on its way.",
			},
		},
	},
})
```

```java Java highlight={6} theme={null}
SendMessageParams.Message message = SendMessageParams.Message.builder()
    .to(SendMessageParams.Message.To.ofUserRecipient(
        UserRecipient.builder().userId("user_123").email("sarah@acme-corp.com").build()))
    .routing(SendMessageParams.Message.Routing.builder()
        .method(SendMessageParams.Message.Routing.Method.SINGLE)
        .channels(List.of(MessageRoutingChannel.ofString("email")))
        .build())
    .content(ElementalContentSugar.builder()
        .title("Your order shipped")
        .body("Order 1042 is on its way.")
        .build())
    .build();

client.send().message(SendMessageParams.builder().message(message).build());
```

```php PHP highlight={4} theme={null}
$response = $client->send->message(
  message: [
    'to' => ['user_id' => 'user_123', 'email' => 'sarah@acme-corp.com'],
    'routing' => ['method' => 'single', 'channels' => ['email']],
    'content' => ['title' => 'Your order shipped', 'body' => 'Order 1042 is on its way.'],
  ],
);
```

```csharp C# highlight={6} theme={null}
SendMessageParams parameters = new()
{
    Message = new()
    {
        To = new UserRecipient { UserID = "user_123", Email = "sarah@acme-corp.com" },
        Routing = new() { Method = "single", Channels = ["email"] },
        Content = new ElementalContentSugar
        {
            Title = "Your order shipped",
            Body = "Order 1042 is on its way.",
        },
    },
};

var response = await client.Send.Message(parameters);
```

```bash CLI highlight={4} theme={null}
courier send message \
  --api-key "$COURIER_API_KEY" \
  --message.to '{"user_id": "user_123", "email": "sarah@acme-corp.com"}' \
  --message.routing '{"method": "single", "channels": ["email"]}' \
  --message.content '{"title": "Your order shipped", "body": "Order 1042 is on its way."}'
```

```text MCP theme={null}
With Courier MCP, email user_123 at sarah@acme-corp.com to say order 1042 shipped.
```

**3. Send it to the inbox too**

Add `inbox` to the channels and switch the method to `all`. Courier sends the email through your provider and puts the same message in the user's inbox.

```javascript Node.js highlight={4} theme={null}
const { requestId } = await client.send.message({
  message: {
    to: { user_id: "user_123", email: "sarah@acme-corp.com" },
    routing: { method: "all", channels: ["email", "inbox"] },
    content: { title: "Your order shipped", body: "Order 1042 is on its way." },
  },
});
```

```python Python highlight={4} theme={null}
response = client.send.message(
    message={
        "to": {"user_id": "user_123", "email": "sarah@acme-corp.com"},
        "routing": {"method": "all", "channels": ["email", "inbox"]},
        "content": {"title": "Your order shipped", "body": "Order 1042 is on its way."},
    },
)
```

```bash cURL highlight={7} theme={null}
curl -X POST https://api.courier.com/send \
  -H "Authorization: Bearer $COURIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "to": { "user_id": "user_123", "email": "sarah@acme-corp.com" },
      "routing": { "method": "all", "channels": ["email", "inbox"] },
      "content": { "title": "Your order shipped", "body": "Order 1042 is on its way." }
    }
  }'
```

```ruby Ruby highlight={4} theme={null}
response = courier.send_.message(
  message: {
    to: {user_id: "user_123", email: "sarah@acme-corp.com"},
    routing: {method: "all", channels: ["email", "inbox"]},
    content: {title: "Your order shipped", body: "Order 1042 is on its way."}
  }
)
```

```go Go highlight={11} theme={null}
response, err := client.Send.Message(context.TODO(), courier.SendMessageParams{
	Message: courier.SendMessageParamsMessage{
		To: courier.SendMessageParamsMessageToUnion{
			OfUserRecipient: &shared.UserRecipientParam{
				UserID: courier.String("user_123"),
				Email:  courier.String("sarah@acme-corp.com"),
			},
		},
		Routing: courier.SendMessageParamsMessageRouting{
			Method: string(shared.MessageRoutingMethodAll),
			Channels: []shared.MessageRoutingChannelUnionParam{
				{OfString: courier.String("email")},
				{OfString: courier.String("inbox")},
			},
		},
		Content: courier.SendMessageParamsMessageContentUnion{
			OfElementalContentSugar: &shared.ElementalContentSugarParam{
				Title: "Your order shipped",
				Body:  "Order 1042 is on its way.",
			},
		},
	},
})
```

```java Java highlight={6} theme={null}
SendMessageParams.Message message = SendMessageParams.Message.builder()
    .to(SendMessageParams.Message.To.ofUserRecipient(
        UserRecipient.builder().userId("user_123").email("sarah@acme-corp.com").build()))
    .routing(SendMessageParams.Message.Routing.builder()
        .method(SendMessageParams.Message.Routing.Method.ALL)
        .channels(List.of(
            MessageRoutingChannel.ofString("email"),
            MessageRoutingChannel.ofString("inbox")))
        .build())
    .content(ElementalContentSugar.builder()
        .title("Your order shipped")
        .body("Order 1042 is on its way.")
        .build())
    .build();

client.send().message(SendMessageParams.builder().message(message).build());
```

```php PHP highlight={4} theme={null}
$response = $client->send->message(
  message: [
    'to' => ['user_id' => 'user_123', 'email' => 'sarah@acme-corp.com'],
    'routing' => ['method' => 'all', 'channels' => ['email', 'inbox']],
    'content' => ['title' => 'Your order shipped', 'body' => 'Order 1042 is on its way.'],
  ],
);
```

```csharp C# highlight={6} theme={null}
SendMessageParams parameters = new()
{
    Message = new()
    {
        To = new UserRecipient { UserID = "user_123", Email = "sarah@acme-corp.com" },
        Routing = new Routing { Method = Method.All, Channels = ["email", "inbox"] },
        Content = new ElementalContentSugar
        {
            Title = "Your order shipped",
            Body = "Order 1042 is on its way.",
        },
    },
};

var response = await client.Send.Message(parameters);
```

```bash CLI highlight={4} theme={null}
courier send message \
  --api-key "$COURIER_API_KEY" \
  --message.to '{"user_id": "user_123", "email": "sarah@acme-corp.com"}' \
  --message.routing '{"method": "all", "channels": ["email", "inbox"]}' \
  --message.content '{"title": "Your order shipped", "body": "Order 1042 is on its way."}'
```

```text MCP theme={null}
With Courier MCP, tell user_123 by email at sarah@acme-corp.com and in their inbox that order 1042 shipped.
```

To show those messages in your app, [add the inbox component](https://www.courier.com/docs/in-app/add-an-inbox.md) and [sign the user in](https://www.courier.com/docs/in-app/authenticate-users.md) with the same `user_id`. Courier Inbox comes installed in every workspace, so there's no integration to add.

## Verify

**1. Check your provider**

The email shows up in your provider's own log, such as Resend's **Emails** page, sent from your domain. That proves Courier used your account.

**2. Check Courier**

Open [Logs](https://app.courier.com/logs) and find the message. It lists both channels, and its timeline shows a send through your provider and one through Courier Inbox.

## What changes in production

**Move one notification at a time.** Swap one send call, check it in Logs, then do the next. The rest of your app keeps calling the provider directly until you get to it. Your sending reputation carries over, because the same account and domain send everything. Courier renders its own HTML from `content`, and [click tracking](https://www.courier.com/docs/monitor/tracking.md) rewrites links when it's on, so look at one real message before moving more.

**Add a backup provider.** Connect a second email provider and Courier [fails over](https://www.courier.com/docs/send/routing.md#failover) to it when the first can't take the message or returns an error, after retrying temporary errors. A bounce doesn't trigger failover.

**Let users choose.** [Preferences](https://www.courier.com/docs/recipients/preferences/overview.md) let each person turn a topic off or pick its channels. Map a send to a topic, on its template or with `preferences.subscription_topic_id`, and Courier applies them at send time.

**Move copy into templates.** Inline `content` is fine to start. A [template](https://www.courier.com/docs/design/templates/overview.md) lets someone edit the wording and design without a deploy.

## FAQ

> [accordion] Does Courier replace Resend or SendGrid?
>
> Courier doesn't replace your email provider. It calls Resend, SendGrid, Postmark, Amazon SES, or another provider with your API key, and adds the inbox, preferences, routing, and logs on top.

> [accordion] Do I have to change DNS or my sending domain?
>
> Your DNS and sending domain stay as they are, because your provider still sends the email. Set Courier's From address to one on the domain you already verified with that provider.

> [accordion] Who bills for what when I use Courier with my email provider?
>
> Your email provider bills for email delivery under its own pricing, and Courier [bills per send](https://www.courier.com/docs/workspaces/billing.md). Courier counts sends, not deliveries, so a multi-channel template to one person is one send even when it delivers email and an inbox message.

> [accordion] Can I keep calling my provider directly for some emails?
>
> Calling your provider directly for some emails works fine alongside Courier. Move notifications over one at a time, and keep direct calls for anything you'd rather not route through Courier.
