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

# Go live

> Validate a notification change in Test with a draft key and optional approval workflow, then migrate the template to Production with the Templates API.

Build and validate a notification change without touching live traffic, then promote it to Production.

Test and Production are separate environments with their own keys, templates, and logs. Work in Test, review the draft against a real payload, then migrate the assets.

## The promotion path

```mermaid theme={null}
flowchart LR
    A["Edit in Test"] --> B["Preview draft"]
    B --> C{"Approval workflow?"}
    C -->|No| D["Migrate to Production"]
    C -->|Yes| E["Send for Review"]
    E --> D
```

## Prerequisites

* [A connected integration](https://www.courier.com/docs/integrations/overview.md)
* [Your Test and Production API keys](https://app.courier.com/settings/api-keys)
* [The environments model](https://www.courier.com/docs/workspaces/environments.md)

## Promote the change

**1. Work in the Test environment**

Switch to **Test** with the toggle in the settings menu. Templates, brands, and topics you create here are isolated from Production. Edit your template, then send with your Test key. Those sends appear only in the Test dashboard.

```javascript Node.js theme={null}
const { requestId } = await courier.send.message({
  message: {
    to: {
      email: "sarah@acme-corp.com",
    },
    template: "nt_01kx4h2jdafq8bk9aftxak4b40",
    data: {
      name: "Sarah Bennett",
    },
  },
});
```

```python Python theme={null}
response = client.send.message(
    message={
        "to": {
            "email": "sarah@acme-corp.com",
        },
        "template": "nt_01kx4h2jdafq8bk9aftxak4b40",
        "data": {
            "name": "Sarah Bennett",
        },
    },
)
```

```bash cURL wrap theme={null}
curl -X POST https://api.courier.com/send \
  -H "Authorization: Bearer $COURIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "to": {
        "email": "sarah@acme-corp.com"
      },
      "template": "nt_01kx4h2jdafq8bk9aftxak4b40",
      "data": {
        "name": "Sarah Bennett"
      }
    }
  }'
```

```ruby Ruby theme={null}
response = courier.send_.message(
  message: {
    to: {
      email: "sarah@acme-corp.com"
    },
    template: "nt_01kx4h2jdafq8bk9aftxak4b40",
    data: {
      name: "Sarah Bennett"
    }
  }
)
```

```go Go theme={null}
response, err := client.Send.Message(context.TODO(), courier.SendMessageParams{
	Message: courier.SendMessageParamsMessage{
		To: courier.SendMessageParamsMessageToUnion{
			OfUserRecipient: &shared.UserRecipientParam{
				Email: courier.String("sarah@acme-corp.com"),
			},
		},
		Template: courier.String("nt_01kx4h2jdafq8bk9aftxak4b40"),
		Data: map[string]any{
			"name": "Sarah Bennett",
		},
	},
})
```

```java Java theme={null}
SendMessageParams params = SendMessageParams.builder()
    .message(SendMessageParams.Message.builder()
        .to(UserRecipient.builder().email("sarah@acme-corp.com").build())
        .template("nt_01kx4h2jdafq8bk9aftxak4b40")
        .data(JsonValue.from(java.util.Map.of(
            "name", "Sarah Bennett"
        )))
        .build())
    .build();
SendMessageResponse response = client.send().message(params);
```

```php PHP theme={null}
$response = $client->send->message(
  message: [
    'to' => [
      'email' => 'sarah@acme-corp.com',
    ],
    'template' => 'nt_01kx4h2jdafq8bk9aftxak4b40',
    'data' => [
      'name' => 'Sarah Bennett',
    ],
  ],
);
```

```csharp C# theme={null}
SendMessageParams parameters = new()
{
    Message = new()
    {
        To = new UserRecipient { Email = "sarah@acme-corp.com" },
        Template = "nt_01kx4h2jdafq8bk9aftxak4b40",
        Data = new Dictionary<string, JsonElement>()
        {
            { "name", JsonSerializer.SerializeToElement("Sarah Bennett") },
        },
    },
};

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

```bash CLI wrap theme={null}
courier send message \
  --api-key "$COURIER_API_KEY" \
  --message.to '{"email": "sarah@acme-corp.com"}' \
  --message.template nt_01kx4h2jdafq8bk9aftxak4b40 \
  --message.data '{"name": "Sarah Bennett"}'
```

```text MCP theme={null}
With Courier MCP, send my nt_01kx4h2jdafq8bk9aftxak4b40 template to sarah@acme-corp.com with my test key.
```

> [!TIP]
>
> **Keep test sends out of real inboxes.**\\
>
> Configure a sandbox provider key in each integration's Test configuration so Test sends stay in the sandbox.

**2. Preview the draft with a draft key**

A draft key renders the latest **unpublished** draft, not the published version. Use one to review a change against a real payload before publishing. Generate it in [Platform → API Keys](https://app.courier.com/settings/api-keys), send with it, then check the rendered output in [message logs](https://www.courier.com/docs/monitor/overview.md).

```javascript Node.js theme={null}
const { requestId } = await courier.send.message({
  message: {
    to: {
      email: "reviewer@acme-corp.com",
    },
    template: "nt_01kx4h2jdafq8bk9aftxak4b40",
    data: {
      name: "Draft Preview",
    },
  },
});
```

```python Python theme={null}
response = client.send.message(
    message={
        "to": {
            "email": "reviewer@acme-corp.com",
        },
        "template": "nt_01kx4h2jdafq8bk9aftxak4b40",
        "data": {
            "name": "Draft Preview",
        },
    },
)
```

```bash cURL wrap theme={null}
curl -X POST https://api.courier.com/send \
  -H "Authorization: Bearer $COURIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "to": {
        "email": "reviewer@acme-corp.com"
      },
      "template": "nt_01kx4h2jdafq8bk9aftxak4b40",
      "data": {
        "name": "Draft Preview"
      }
    }
  }'
```

```ruby Ruby theme={null}
response = courier.send_.message(
  message: {
    to: {
      email: "reviewer@acme-corp.com"
    },
    template: "nt_01kx4h2jdafq8bk9aftxak4b40",
    data: {
      name: "Draft Preview"
    }
  }
)
```

```go Go theme={null}
response, err := client.Send.Message(context.TODO(), courier.SendMessageParams{
	Message: courier.SendMessageParamsMessage{
		To: courier.SendMessageParamsMessageToUnion{
			OfUserRecipient: &shared.UserRecipientParam{
				Email: courier.String("reviewer@acme-corp.com"),
			},
		},
		Template: courier.String("nt_01kx4h2jdafq8bk9aftxak4b40"),
		Data: map[string]any{
			"name": "Draft Preview",
		},
	},
})
```

```java Java theme={null}
SendMessageParams params = SendMessageParams.builder()
    .message(SendMessageParams.Message.builder()
        .to(UserRecipient.builder().email("reviewer@acme-corp.com").build())
        .template("nt_01kx4h2jdafq8bk9aftxak4b40")
        .data(JsonValue.from(java.util.Map.of(
            "name", "Draft Preview"
        )))
        .build())
    .build();
SendMessageResponse response = client.send().message(params);
```

```php PHP theme={null}
$response = $client->send->message(
  message: [
    'to' => [
      'email' => 'reviewer@acme-corp.com',
    ],
    'template' => 'nt_01kx4h2jdafq8bk9aftxak4b40',
    'data' => [
      'name' => 'Draft Preview',
    ],
  ],
);
```

```csharp C# theme={null}
SendMessageParams parameters = new()
{
    Message = new()
    {
        To = new UserRecipient { Email = "reviewer@acme-corp.com" },
        Template = "nt_01kx4h2jdafq8bk9aftxak4b40",
        Data = new Dictionary<string, JsonElement>()
        {
            { "name", JsonSerializer.SerializeToElement("Draft Preview") },
        },
    },
};

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

```bash CLI wrap theme={null}
courier send message \
  --api-key "$COURIER_API_KEY" \
  --message.to '{"email": "reviewer@acme-corp.com"}' \
  --message.template nt_01kx4h2jdafq8bk9aftxak4b40 \
  --message.data '{"name": "Draft Preview"}'
```

```text MCP theme={null}
With Courier MCP, send the unpublished draft of my nt_01kx4h2jdafq8bk9aftxak4b40 template to reviewer@acme-corp.com.
```

**3. Get approval (optional)**

If your team reviews changes before they ship, enable the [approval workflow](https://www.courier.com/docs/design/templates/api.md#approval-workflow). Publishing then opens a submission instead of going live, and the template stays read-only until that submission is resolved.

**4. Move the template to Production**

Read the template's content from Test and write it to Production with the Templates API. [`GET /notifications/{id}/content`](https://www.courier.com/docs/api-reference/templates/get-notification-content) returns the `{ version, elements }` JSON, and [`PUT /notifications/{id}/content`](https://www.courier.com/docs/api-reference/templates/replace-notification-content) writes it, using each environment's own key.

Remove every `checksum` field and any `locales` key that starts with an underscore before the PUT, and keep each element's `locales` so the Production template gets the same translations. [The round-trip contract](https://www.courier.com/docs/design/templates/api.md#update-content-the-round-trip-contract) covers the rest, and is the same flow as [managing templates as code](https://www.courier.com/docs/design/templates/api.md#manage-templates-as-code).

**Create a template's dependencies in Production yourself.** Brands, tags, and subscription topics are per environment, so set them up there first. A send that references one that is missing fails there while it worked in Test.

## Verify

**1. Smoke test with your Production key**

Send to an internal recipient in Production.

```javascript Node.js theme={null}
const { requestId } = await courier.send.message({
  message: {
    to: {
      email: "ops@acme-corp.com",
    },
    template: "nt_01kx4h2jdafq8bk9aftxak4b40",
    data: {
      name: "Smoke Test",
    },
  },
});
```

```python Python theme={null}
response = client.send.message(
    message={
        "to": {
            "email": "ops@acme-corp.com",
        },
        "template": "nt_01kx4h2jdafq8bk9aftxak4b40",
        "data": {
            "name": "Smoke Test",
        },
    },
)
```

```bash cURL wrap theme={null}
curl -X POST https://api.courier.com/send \
  -H "Authorization: Bearer $COURIER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": {
      "to": {
        "email": "ops@acme-corp.com"
      },
      "template": "nt_01kx4h2jdafq8bk9aftxak4b40",
      "data": {
        "name": "Smoke Test"
      }
    }
  }'
```

```ruby Ruby theme={null}
response = courier.send_.message(
  message: {
    to: {
      email: "ops@acme-corp.com"
    },
    template: "nt_01kx4h2jdafq8bk9aftxak4b40",
    data: {
      name: "Smoke Test"
    }
  }
)
```

```go Go theme={null}
response, err := client.Send.Message(context.TODO(), courier.SendMessageParams{
	Message: courier.SendMessageParamsMessage{
		To: courier.SendMessageParamsMessageToUnion{
			OfUserRecipient: &shared.UserRecipientParam{
				Email: courier.String("ops@acme-corp.com"),
			},
		},
		Template: courier.String("nt_01kx4h2jdafq8bk9aftxak4b40"),
		Data: map[string]any{
			"name": "Smoke Test",
		},
	},
})
```

```java Java theme={null}
SendMessageParams params = SendMessageParams.builder()
    .message(SendMessageParams.Message.builder()
        .to(UserRecipient.builder().email("ops@acme-corp.com").build())
        .template("nt_01kx4h2jdafq8bk9aftxak4b40")
        .data(JsonValue.from(java.util.Map.of(
            "name", "Smoke Test"
        )))
        .build())
    .build();
SendMessageResponse response = client.send().message(params);
```

```php PHP theme={null}
$response = $client->send->message(
  message: [
    'to' => [
      'email' => 'ops@acme-corp.com',
    ],
    'template' => 'nt_01kx4h2jdafq8bk9aftxak4b40',
    'data' => [
      'name' => 'Smoke Test',
    ],
  ],
);
```

```csharp C# theme={null}
SendMessageParams parameters = new()
{
    Message = new()
    {
        To = new UserRecipient { Email = "ops@acme-corp.com" },
        Template = "nt_01kx4h2jdafq8bk9aftxak4b40",
        Data = new Dictionary<string, JsonElement>()
        {
            { "name", JsonSerializer.SerializeToElement("Smoke Test") },
        },
    },
};

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

```bash CLI wrap theme={null}
courier send message \
  --api-key "$COURIER_API_KEY" \
  --message.to '{"email": "ops@acme-corp.com"}' \
  --message.template nt_01kx4h2jdafq8bk9aftxak4b40 \
  --message.data '{"name": "Smoke Test"}'
```

```text MCP theme={null}
With Courier MCP, send my nt_01kx4h2jdafq8bk9aftxak4b40 template to ops@acme-corp.com in production.
```

**2. Confirm the right version rendered**

Open the message in [Logs](https://app.courier.com/logs), expand the timeline, and confirm the migrated version is the one that rendered.

**3. Confirm the provider accepted it**

The same timeline shows the provider's response. A `SENT` status that doesn't progress to `DELIVERED` points at the provider, not the migration.
