> ## 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 Batch with Template

> Send multiple templated emails in a single API call with individual merge data per recipient.

<ParamField body="template_key" type="string" required>
  The unique key of the template to use for all emails in the batch.
</ParamField>

<ParamField body="from" type="object" required>
  Sender details with `address` and optional `name`.
</ParamField>

<ParamField body="to" type="array" required>
  Array of recipient objects. Each recipient can have their own `merge_info`.

  <Expandable title="recipient properties">
    <ParamField body="email_address.address" type="string" required>
      Recipient email address.
    </ParamField>

    <ParamField body="email_address.name" type="string">
      Recipient display name.
    </ParamField>

    <ParamField body="merge_info" type="object">
      Per-recipient template variables.
    </ParamField>
  </Expandable>
</ParamField>

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.unosend.co/v1/email/template/batch \
    -H "Authorization: Bearer un_xxxxxxxxxx" \
    -H "Content-Type: application/json" \
    -d '{
      "template_key": "order-confirmation",
      "from": {
        "address": "orders@yourdomain.com",
        "name": "Your Store"
      },
      "to": [
        {
          "email_address": {
            "address": "user1@example.com",
            "name": "Alice"
          },
          "merge_info": {
            "first_name": "Alice",
            "order_id": "ORD-001"
          }
        },
        {
          "email_address": {
            "address": "user2@example.com",
            "name": "Bob"
          },
          "merge_info": {
            "first_name": "Bob",
            "order_id": "ORD-002"
          }
        }
      ]
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch('https://api.unosend.co/v1/email/template/batch', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer un_xxxxxxxxxx',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      template_key: 'order-confirmation',
      from: { address: 'orders@yourdomain.com', name: 'Your Store' },
      to: [
        { email_address: { address: 'user1@example.com', name: 'Alice' }, merge_info: { first_name: 'Alice', order_id: 'ORD-001' } },
        { email_address: { address: 'user2@example.com', name: 'Bob' }, merge_info: { first_name: 'Bob', order_id: 'ORD-002' } }
      ]
    })
  });
  ```
</CodeGroup>

### Response

```json 200 theme={null}
{
  "message": "OK",
  "request_id": "req_batch_789xyz",
  "data": [
    { "message_id": "msg_001", "recipient": "user1@example.com", "status": "queued" },
    { "message_id": "msg_002", "recipient": "user2@example.com", "status": "queued" }
  ]
}
```

<Info>
  Each recipient in the batch uses 1 credit. A batch of 50 recipients consumes 50 credits.
</Info>
