> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unosend.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Email with Template

> Send an email using a pre-configured template with dynamic merge fields.

**template\_key** `string` *required*

The unique key of the template to use.

**from** `object` *required*

Sender details.

**from properties**

**from.address** `string` *required*

Sender email address. Must be from a verified domain.

**from.name** `string`

Sender display name.

**to** `array` *required*

Array of recipient objects.

**recipient properties**

**email\_address.address** `string` *required*

Recipient email address.

**email\_address.name** `string`

Recipient display name.

**merge\_info** `object`

Key-value pairs for template variable substitution. Example: `{"first_name": "John", "order_id": "12345"}`.

**reply\_to** `object`

Reply-to address with `address` and optional `name`.

**cc** `array`

CC recipients. Same structure as `to`.

**bcc** `array`

BCC recipients. Same structure as `to`.

### Request

```bash cURL theme={null}
curl -X POST https://api.unosend.co/v1/email/template \
  -H "Authorization: Bearer un_xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "template_key": "welcome-email",
    "from": {
      "address": "hello@yourdomain.com",
      "name": "Your App"
    },
    "to": [
      {
        "email_address": {
          "address": "user@example.com",
          "name": "John Doe"
        }
      }
    ],
    "merge_info": {
      "first_name": "John",
      "activation_link": "https://yourapp.com/activate/abc123"
    }
  }'
```

```javascript JavaScript theme={null}
await fetch('https://api.unosend.co/v1/email/template', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer un_xxxxxxxxxx',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    template_key: 'welcome-email',
    from: { address: 'hello@yourdomain.com', name: 'Your App' },
    to: [{ email_address: { address: 'user@example.com', name: 'John Doe' } }],
    merge_info: { first_name: 'John', activation_link: 'https://yourapp.com/activate/abc123' }
  })
});
```

```python Python theme={null}
import requests

requests.post('https://api.unosend.co/v1/email/template',
  headers={'Authorization': 'Bearer un_xxxxxxxxxx'},
  json={
    'template_key': 'welcome-email',
    'from': {'address': 'hello@yourdomain.com', 'name': 'Your App'},
    'to': [{'email_address': {'address': 'user@example.com', 'name': 'John Doe'}}],
    'merge_info': {'first_name': 'John', 'activation_link': 'https://yourapp.com/activate/abc123'}
  }
)
```

### Response

```json 200 theme={null}
{
  "message": "OK",
  "request_id": "req_abc123def456",
  "data": {
    "message_id": "msg_550e8400e29b41d4"
  }
}
```

> [!NOTE]
>
> Template variables use the `{{variable_name}}` syntax. Make sure all required variables in the template are provided in `merge_info`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.