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

# Elemental text element

> Render body text and headings with bold, italic, color, and alignment, plus inline links and images. Translate formatted text and keep its styling.

The text element renders a body of text. It supports formatting and styling, and can contain inline text content elements (string, link, img). The type value is `"text"`.

**When to use:**

* Display body text, paragraphs, and descriptions
* Create headings and subheadings
* Show formatted text with styling (bold, italic, colors)
* Include inline links and images within text
* Display dynamic content with Handlebars variables

**Basic example**

```json Elemental theme={null}
{
  "type": "text",
  "content": "Thanks for signing up!"
}
```

```javascript Node.js highlight={9-12} theme={null}
const { requestId } = await client.send.message({
  message: {
    to: {
      email: "sarah@acme-corp.com",
    },
    content: {
      version: "2022-01-01",
      elements: [
        {
          type: "text",
          content: "Thanks for signing up!",
        },
      ],
    },
  },
});
```

```python Python highlight={9-12} theme={null}
response = client.send.message(
    message={
      "to": {
        "email": "sarah@acme-corp.com",
      },
      "content": {
        "version": "2022-01-01",
        "elements": [
          {
            "type": "text",
            "content": "Thanks for signing up!",
          },
        ],
      },
    },
)
```

```bash cURL highlight={12-15} 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"
        },
        "content": {
          "version": "2022-01-01",
          "elements": [
            {
              "type": "text",
              "content": "Thanks for signing up!"
            }
          ]
        }
      }
    }'
```

```ruby Ruby highlight={9-12} theme={null}
response = courier.send_.message(
  message: {
    to: {
      email: "sarah@acme-corp.com"
    },
    content: {
      version: "2022-01-01",
      elements: [
        {
          type: "text",
          content: "Thanks for signing up!"
        }
      ]
    }
  }
)
```

```go Go highlight={5-8} theme={null}
// Elemental nodes carry no typed content fields, so pass the document as raw JSON.
content := param.Override[shared.ElementalContentParam](json.RawMessage(`{
  "version": "2022-01-01",
  "elements": [
    {
      "type": "text",
      "content": "Thanks for signing up!"
    }
  ]
}`))

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"),
			},
		},
		Content: courier.SendMessageParamsMessageContentUnion{OfElementalContent: &content},
	},
})
```

```java Java highlight={7-9} theme={null}
SendMessageParams params = SendMessageParams.builder()
    .message(SendMessageParams.Message.builder()
        .to(JsonValue.from(java.util.Map.of("email", "sarah@acme-corp.com")))
        .content(JsonValue.from(java.util.Map.of(
                "version", "2022-01-01",
                "elements", java.util.List.of(
                  java.util.Map.of(
                    "type", "text",
                    "content", "Thanks for signing up!")))))
        .build())
    .build();
SendMessageResponse response = client.send().message(params);
```

```php PHP highlight={9-12} theme={null}
$response = $client->send->message(
  message: [
    'to' => [
      'email' => 'sarah@acme-corp.com',
    ],
    'content' => [
      'version' => '2022-01-01',
      'elements' => [
        [
          'type' => 'text',
          'content' => 'Thanks for signing up!',
        ],
      ],
    ],
  ],
);
```

```csharp C# highlight={12-15} theme={null}
// Elemental nodes expose no typed content fields, so build the document from raw JSON.
SendMessageParams parameters = new()
{
    Message = new()
    {
        To = new UserRecipient { Email = "sarah@acme-corp.com" },
        Content = ElementalContent.FromRawUnchecked(
            JsonSerializer.Deserialize<Dictionary<string, JsonElement>>("""
            {
              "version": "2022-01-01",
              "elements": [
                {
                  "type": "text",
                  "content": "Thanks for signing up!"
                }
              ]
            }
            """)),
    },
};

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

```bash CLI highlight={4} theme={null}
courier send message \
  --api-key "$COURIER_API_KEY" \
  --message.to '{"email": "sarah@acme-corp.com"}' \
  --message.content '{"version": "2022-01-01", "elements": [{"type": "text", "content": "Thanks for signing up!"}]}'
```

```text MCP theme={null}
With Courier MCP, send an email to sarah@acme-corp.com with a text element that greets them by name.
```

**Fields**

**content** `string`

The text content displayed in the notification. Either this field or the `elements` field must be specified. Supports Handlebars variables.

**elements** `TextContentElement[]`

An array of Text Content Elements (string, link, img). Either this field or `content` must be specified, or both. When both are present, `elements` takes precedence and `content` is ignored. See the **Text content elements** section below.

**align** `string`

Text alignment. One of `"left"`, `"center"`, or `"right"`. Defaults to `"left"`.

**text\_style** `string`

Renders the text as a heading level. One of `"text"`, `"h1"`, `"h2"`, or `"subtext"`. Defaults to `"text"`.

**color** `string`

The text color. Any valid CSS color value (e.g., `"#007bff"`, `"rgb(0, 123, 255)"`).

**bold** `boolean`

Apply bold formatting to the text.

**italic** `boolean`

Apply italic formatting to the text.

**strikethrough** `boolean`

Apply a strikethrough to the text.

**underline** `boolean`

Apply an underline to the text.

**locales** `object`

Translations of this text, keyed by locale code. An entry can hold `content` (a string), `elements` (an array of inline nodes), or both, and [text node resolution
DOC](https://www.courier.com/docs/design/elemental/locales.md#text-node-resolution) shows which one renders. To translate a link's `href` or an image's `src` inside the text, put translated nodes in the entry's `elements`.

**channels** `string[]`

An array of channel names. The text renders only for the listed channels. See [Control flow
DOC](https://www.courier.com/docs/design/elemental/control-flow.md#channels).

**Examples and variants**

**Basic text**

Simple text content:

```json theme={null}
{
  "type": "text",
  "content": "Thanks for signing up!"
}
```

**Text with Handlebars**

Dynamic text with variables:

```json theme={null}
{
  "type": "text",
  "content": "This is a notification I sent to {{first_name}}"
}
```

Variables come from `message.data` (e.g., `data.first_name`).

**Styled text**

Text with formatting:

```json theme={null}
{
  "type": "text",
  "content": "Important Notice",
  "text_style": "h2",
  "bold": true,
  "color": "#007bff",
  "align": "center"
}
```

**Localized text**

Text with translations using the `content` string format:

```json theme={null}
{
  "type": "text",
  "content": "This is a notification I sent to {{first_name}}",
  "locales": {
    "es": {
      "content": "Esta es una notificación que envié a {{first_name}}"
    },
    "fr": {
      "content": "Ceci est une notification que j'ai envoyée à {{first_name}}"
    }
  }
}
```

**Localized text with structured elements**

When your text node uses the `elements` array, provide locale translations as `elements` arrays to preserve inline formatting across languages:

```json theme={null}
{
  "type": "text",
  "elements": [
    { "type": "string", "content": "Your order " },
    { "type": "string", "content": "#{{order.id}}", "bold": true },
    { "type": "string", "content": " has been confirmed." }
  ],
  "locales": {
    "fr": {
      "elements": [
        { "type": "string", "content": "Votre commande " },
        { "type": "string", "content": "#{{order.id}}", "bold": true },
        { "type": "string", "content": " a été confirmée." }
      ]
    }
  }
}
```

**When both `content` and `elements` are present**

If a text node includes both `content` and `elements`, only `elements` is used. Choose one format per node.

> [!NOTE]
>
> If a text node uses `elements` but a locale only provides `content`, Courier wraps that string into a single-element array for backward compatibility. Rendering still works, but any inline formatting is lost. Provide `elements` in your locale translations to keep it. See [text node resolution
> DOC](https://www.courier.com/docs/design/elemental/locales.md#text-node-resolution) for the full table.

**Heading styles**

Use text as headings:

```json theme={null}
{
  "type": "text",
  "content": "Welcome to Our Platform",
  "text_style": "h1"
},
{
  "type": "text",
  "content": "Get started in minutes",
  "text_style": "subtext"
}
```

**Text content elements**

The text element can contain an array of text content elements instead of, or in addition to, the `content` field. These sub-elements build inline text with links, images, and formatted strings.

> [!NOTE]
>
> Text content elements (string, link, img) must be children of a text element. They can't stand alone as top-level elements.

**String element**

Renders a simple string. Behaves like default text, but formats inline within a text element.

**Fields:**

**type** `string` *required*

Must be `"string"`.

**content** `string` *required*

The text content displayed in the notification.

**align** `string`

Text alignment. One of `"left"`, `"center"`, or `"right"`.

**text\_style** `string`

Renders the text as a heading level. One of `"text"`, `"h1"`, `"h2"`, or `"subtext"`.

**color** `string`

The text color. Any valid CSS color value.

**bold** `boolean`

Apply bold formatting to the text.

**italic** `boolean`

Apply italic formatting to the text.

**strikethrough** `boolean`

Apply a strikethrough to the text.

**underline** `boolean`

Apply an underline to the text.

**locales** `object`

Translations of `content`, keyed by locale code, for content you pass inline to a send. In a stored template, translate the [text element
DOC](https://www.courier.com/docs/design/elemental/locales.md#formatted-text) instead.

**Link element**

Renders a clickable link within a body of text.

**Fields:**

**type** `string` *required*

Must be `"link"`.

**content** `string` *required*

The text content of the link (the clickable text).

**href** `string`

The address to link to. When provided, the link becomes clickable.

**disable\_tracking** `boolean`

Disable click tracking for the link. By default, Courier tracks link clicks.

**align** `string`

Text alignment. One of `"left"`, `"center"`, or `"right"`.

**text\_style** `string`

Renders the text as a heading level. One of `"text"`, `"h1"`, `"h2"`, or `"subtext"`.

**color** `string`

The text color. Any valid CSS color value.

**bold** `boolean`

Apply bold formatting to the text.

**italic** `boolean`

Apply italic formatting to the text.

**strikethrough** `boolean`

Apply a strikethrough to the text.

**underline** `boolean`

Apply an underline to the text.

**locales** `object`

Translations of `content` and `href`, keyed by locale code, for content you pass inline to a send. In a stored template, translate the [text element
DOC](https://www.courier.com/docs/design/elemental/locales.md#formatted-text) instead.

**Img element**

Renders an image inline within a body of text.

**Fields:**

**type** `string` *required*

Must be `"img"`.

**src** `string` *required*

The source address of the image. Must be a publicly accessible URL.

**alt\_text** `string`

Text used for screen readers and displayed on mouse hover. Important for accessibility.

**width** `string`

How wide the image renders. Any valid CSS width value (e.g., `"50px"`, `"100%"`).

**href** `string`

An address to link to. Makes the image clickable.

**disable\_tracking** `boolean`

Disable click tracking for the link (if `href` is provided).

**align** `string`

Text alignment. One of `"left"`, `"center"`, or `"right"`.

**text\_style** `string`

Renders the text as a heading level. One of `"text"`, `"h1"`, `"h2"`, or `"subtext"`.

**color** `string`

The text color, for any text overlay.

**bold** `boolean`

Apply bold formatting (for any text overlay).

**italic** `boolean`

Apply italic formatting (for any text overlay).

**strikethrough** `boolean`

Apply a strikethrough (for any text overlay).

**underline** `boolean`

Apply an underline (for any text overlay).

**locales** `object`

Translations of `src` and `href`, keyed by locale code, for content you pass inline to a send. In a stored template, translate the [text element
DOC](https://www.courier.com/docs/design/elemental/locales.md#formatted-text) instead.

**Text with inline links**

Combine strings and links:

```json theme={null}
{
  "type": "text",
  "elements": [
    { "type": "string", "content": "Hey! " },
    { "type": "link", "content": "Check out this site.", "href": "https://www.example.com" },
    { "type": "string", "content": " It's awesome!" }
  ]
}
```

**Text with inline images**

Include images within text:

```json theme={null}
{
  "type": "text",
  "elements": [
    { "type": "string", "content": "Check out this emoji: " },
    { "type": "img", "src": "https://emoji.com/cool-emoji", "width": "20px", "alt_text": "Cool emoji" },
    { "type": "string", "content": " Pretty cool, right?" }
  ]
}
```

**Rich formatted text**

Mix strings, links, and formatting:

```json theme={null}
{
  "type": "text",
  "elements": [
    { "type": "string", "content": "Welcome, ", "bold": true },
    { "type": "string", "content": "{{user_name}}", "bold": true, "color": "#007bff" },
    { "type": "string", "content": "! Visit our " },
    { "type": "link", "content": "documentation", "href": "https://docs.example.com", "bold": true },
    { "type": "string", "content": " to get started." }
  ]
}
```

**Channel support**

* **Email**: ✅ Full support with all formatting options
* **Push**: ✅ Supported (formatting may be limited)
* **SMS**: ⚠️ Limited support (plain text only)
* **Inbox**: ✅ Full support with rich formatting

### Best practices

* **Use `content` for simple text**: plain text needs nothing more
* **Use `elements` for rich formatting**: inline links, images, or mixed styling
* **Avoid specifying both**: `elements` takes precedence and `content` is ignored. Pick one format per node
* **Match locale format to root format**: if your text node uses `elements`, provide `elements` in your locales. A `content`-only locale works but loses inline formatting
* **Keep text concise**: long paragraphs are hard to read, especially in email
* **Use headings appropriately**: use `text_style` for a proper heading hierarchy
