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

# Batch and Bulk Sending

> Best practices for high-volume email sending including batching, rate management, and recipient grouping

When your application needs to send thousands or millions of emails, how you structure and pace those sends directly affects deliverability, performance, and cost. This guide covers practical strategies for batching, rate management, and recipient grouping at scale.

***

## Batch Sending with the API

Lettr's API supports sending to up to 50 recipients in a single request (counted across `to`, `cc` and `bcc` combined). Each address in `to` receives its own copy of the email. This reduces HTTP overhead and simplifies your sending logic.

### Single Request, Multiple Recipients

```javascript theme={null}
const response = await fetch('https://app.lettr.com/api/emails', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    from: 'updates@mail.example.com',
    to: [
      'user1@example.com',
      'user2@example.com',
      'user3@example.com'
    ],
    subject: 'Your weekly summary',
    template_slug: 'weekly-summary',
    substitution_data: {
      // Shared data for all recipients
      companyName: 'Acme Inc'
    }
  })
});
```

### Per-Recipient Content

`substitution_data` applies to every recipient in the request. When each recipient needs different content (personalized data, unique links), send one request per recipient with that recipient's data:

```javascript theme={null}
for (const order of orders) {
  await fetch('https://app.lettr.com/api/emails', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer your-api-key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      from: 'orders@mail.example.com',
      to: [order.email],
      template_slug: 'order-confirmation',
      substitution_data: {
        name: order.name,
        orderId: order.id,
        total: order.total
      }
    })
  });
}
```

> [!TIP]
>
> When the content is the same for everyone, fill each request with up to 50 recipients. One request with 50 recipients is faster than 50 individual requests and uses far less of your rate limit.

***

## Structuring High-Volume Sends

When sending to large lists (tens of thousands or more), you need to break the work into manageable batches and pace them appropriately.

### Batch Size

Each API request accepts at most 50 recipients across `to`, `cc` and `bcc`. Requests with more are rejected with a validation error, so split larger lists into batches of 50.

| List Size | Batch Size | Approach |
| - | - | - |
| ≤ 50 | All in one request | Single API call |
| 50-10,000 | 50 per request | Loop with sequential requests |
| 10,000-100,000 | 50 per request | Queue-based with rate limiting |
| 100,000+ | 50 per request | Queue-based with backpressure and monitoring |

### Queue-Based Architecture

For large sends, use a job queue to manage the workload. This gives you control over pacing, retry logic, and failure handling.

```javascript theme={null}
// Producer: Split recipients into batches and enqueue
async function enqueueBulkSend(recipients, templateSlug) {
  const BATCH_SIZE = 50; // Lettr's per-request recipient limit

  for (let i = 0; i < recipients.length; i += BATCH_SIZE) {
    const batch = recipients.slice(i, i + BATCH_SIZE);

    await queue.add('send-email-batch', {
      recipients: batch,
      templateSlug,
      batchNumber: Math.floor(i / BATCH_SIZE) + 1,
      totalBatches: Math.ceil(recipients.length / BATCH_SIZE)
    });
  }
}

// Consumer: Process each batch with rate limiting
queue.process('send-email-batch', async (job) => {
  const { recipients, templateSlug } = job.data;

  const response = await fetch('https://app.lettr.com/api/emails', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.LETTR_API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      from: 'newsletter@mail.example.com',
      to: recipients,
      template_slug: templateSlug
    })
  });

  if (response.status === 429) {
    const retryAfter = response.headers.get('Retry-After');
    throw new Error(`Rate limited. Retry after ${retryAfter}s`);
  }

  if (!response.ok) {
    throw new Error(`Send failed: ${response.status}`);
  }
});
```

> [!NOTE]
>
> Configure your queue workers with appropriate concurrency limits. Lettr's API rate limit is 3 requests per second per team, shared across all of your API keys, so running too many workers in parallel will hit it. Start with a single worker and add more only if you have headroom.

***

## Rate Management

Lettr enforces rate limits to protect deliverability for all senders. Understanding and working within these limits is essential for high-volume sending.

### Handling Rate Limit Responses

When you exceed the rate limit, the API returns a `429 Too Many Requests` response with a `Retry-After` header indicating how long to wait.

```javascript theme={null}
async function sendWithRetry(payload, maxRetries = 3) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    const response = await fetch('https://app.lettr.com/api/emails', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${process.env.LETTR_API_KEY}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(payload)
    });

    if (response.status === 429) {
      const retryAfter = parseInt(response.headers.get('Retry-After') || '10');
      console.log(`Rate limited. Waiting ${retryAfter}s before retry...`);
      await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
      continue;
    }

    return response;
  }

  throw new Error('Max retries exceeded');
}
```

### Proactive Rate Limiting

Rather than hitting rate limits and retrying, pace your sends proactively:

```javascript theme={null}
// Simple token bucket rate limiter
class RateLimiter {
  constructor(maxRequests, windowMs) {
    this.maxRequests = maxRequests;
    this.windowMs = windowMs;
    this.timestamps = [];
  }

  async waitForSlot() {
    const now = Date.now();
    this.timestamps = this.timestamps.filter(t => now - t < this.windowMs);

    if (this.timestamps.length >= this.maxRequests) {
      const oldestInWindow = this.timestamps[0];
      const waitTime = this.windowMs - (now - oldestInWindow);
      await new Promise(resolve => setTimeout(resolve, waitTime));
    }

    this.timestamps.push(Date.now());
  }
}

// Usage: 3 requests per second (Lettr's per-team API limit)
const limiter = new RateLimiter(3, 1000);

for (const batch of batches) {
  await limiter.waitForSlot();
  await sendBatch(batch);
}
```

***

## Recipient Grouping Strategies

How you segment your recipients for bulk sends affects both deliverability and engagement.

### Group by Engagement Level

Send to your most engaged recipients first. This front-loads positive signals (opens, clicks) that improve your reputation for the remainder of the send.

| Send Order | Segment | Why |
| - | - | - |
| First | Opened/clicked in last 7 days | Highest engagement probability — builds positive signals |
| Second | Opened/clicked in last 30 days | Still engaged, reinforces positive reputation |
| Third | Opened/clicked in last 90 days | Moderate risk, but still opted-in |
| Last (or skip) | No engagement in 90+ days | Highest risk — consider a re-engagement campaign first |

### Group by Domain

When sending to large lists, consider grouping recipients by their email domain. This lets you monitor deliverability per provider and respond if a specific provider starts throttling.

```javascript theme={null}
function groupByDomain(recipients) {
  const groups = {};
  for (const recipient of recipients) {
    const domain = recipient.split('@')[1];
    if (!groups[domain]) groups[domain] = [];
    groups[domain].push(recipient);
  }
  return groups;
}

// Send to each domain group with independent monitoring
const groups = groupByDomain(allRecipients);
for (const [domain, recipients] of Object.entries(groups)) {
  console.log(`Sending ${recipients.length} emails to ${domain}`);
  await enqueueBulkSend(recipients, templateSlug);
}
```

***

## Monitoring Bulk Sends

Track the health of your bulk sends in real time using webhooks.

### Key Metrics to Track

| Metric | Healthy | Warning | Action Required |
| - | - | - | - |
| Delivery rate | > 95% | 90–95% | Investigate bounce reasons |
| Bounce rate | \< 2% | 2–5% | Clean list, check data quality |
| Complaint rate | \< 0.1% | 0.1–0.3% | Review content and targeting |
| Deferral rate | \< 5% | 5–15% | Reduce sending speed |

### Real-Time Dashboard

Set up a simple counter to track bulk send progress:

```javascript theme={null}
const bulkSendMetrics = {
  sent: 0,
  delivered: 0,
  bounced: 0,
  complained: 0,
  deferred: 0
};

app.post('/webhooks/lettr', (req, res) => {
  // Lettr delivers webhook events as a JSON array
  for (const event of req.body) {
    const data = event.msys?.message_event;
    if (!data) continue;

    switch (data.type) {
      case 'delivery': bulkSendMetrics.delivered++; break;
      case 'bounce': bulkSendMetrics.bounced++; break;
      case 'spam_complaint': bulkSendMetrics.complained++; break;
      case 'delay': bulkSendMetrics.deferred++; break;
    }
  }

  // Alert if complaint rate exceeds threshold
  const total = bulkSendMetrics.delivered + bulkSendMetrics.bounced;
  if (total > 100 && bulkSendMetrics.complained / total > 0.003) {
    alertTeam('Complaint rate exceeding 0.3% — consider pausing send');
  }

  res.sendStatus(200);
});
```

> [!WARNING]
>
> Always set up monitoring before starting a bulk send. Discovering a problem after sending to your entire list is much worse than catching it after the first few thousand and pausing.

***

## Common Mistakes

> [accordion] Sending the entire list at maximum speed
>
> Blasting your full list as fast as possible overwhelms receiving servers and triggers rate limiting or blocks. Pace your sends and start with engaged recipients.

> [accordion] Not filtering suppressed recipients before sending
>
> Always check your suppression list before a bulk send. Sending to previously bounced or complained addresses damages your reputation with every hit. Lettr's suppression list handles this automatically, but you should also maintain your own internal suppression logic.

> [accordion] Ignoring rate limit responses
>
> Treating 429 responses as permanent failures instead of implementing retry logic with backoff. Rate limits are temporary — wait and retry.

> [accordion] No monitoring during the send
>
> Launching a bulk send and walking away. Without real-time monitoring, you won't catch deliverability problems until it's too late.

> [accordion] Using individual API calls for each recipient
>
> Sending 50,000 individual API requests when you could batch 50 recipients per request (1,000 requests total). Batching is dramatically more efficient.

***

## Related Topics

> [card] [Batch Sending](https://docs.lettr.com/learn/sending/batch-sending.md)
>
> API documentation for batch sending

> [card] [Rate Limits](https://docs.lettr.com/knowledge-base/troubleshooting/rate-limits.md)
>
> Understanding and handling rate limits

> [card] [IP and Domain Warm-Up](https://docs.lettr.com/knowledge-base/best-practices/ip-domain-warmup.md)
>
> Warm-up schedules for new domains

> [card] [List Hygiene](https://docs.lettr.com/knowledge-base/best-practices/list-hygiene.md)
>
> Maintain clean recipient lists before bulk sends


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