Batch Email Sending
ProYou must be subscribed to Pro first.Send one email to hundreds of recipients in a single API call. Sendlib queues the job and delivers each email in the background, automatically respecting Gmail's rate limits.
How it works
We handle the rate limits, the exponential backoff, and the background queueing so you don't have to build any of that complex infrastructure yourself. Unlike /api/send which delivers immediately and blocks until done, /api/batch accepts your full recipient list, queues a background job, and returns a batchId instantly. Our background workers then drip the emails out one at a time, perfectly paced to stay under Google's radar. You just poll /api/batch/:id to track the progress!
Step 1: Send the batch
POST /api/batch
Request body fields
| Field | Type | Required | Description |
|---|---|---|---|
from | string | Yes | Connected Gmail account to send from. Supports display name format: "Brand <you@gmail.com>" |
subject | string | Yes | Email subject. Supports {{variable}} interpolation. |
recipients | array | Yes | List of recipient objects (see below). Max 450 for @gmail.com, 2,000 for Workspace. |
html | string | one of | HTML email body. Supports {{variable}} interpolation. |
text | string | one of | Plain text fallback body. Supports {{variable}} interpolation. |
replyTo | string | Optional | Reply-to email address. |
Recipient object
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Recipient's email address. |
variables | object | Optional | Key/value pairs used to personalise the subject, html, and text for this recipient via {{key}} placeholders. |
Response: 202 Accepted
{
"success": true,
"batchId": "64f1a2b3c4d5e6f7a8b9c0d1",
"total": 2,
"status": "queued"
}Step 2: Poll for progress
GET /api/batch/:batchId
Response
{
"success": true,
"batchId": "64f1a2b3c4d5e6f7a8b9c0d1",
"status": "processing",
"total": 2,
"sent": 1,
"failed": 0,
"progress": 50,
"recipients": [
{ "email": "john@example.com", "status": "sent", "messageId": "18b3f...", "error": null },
{ "email": "jane@example.com", "status": "pending", "messageId": null, "error": null }
]
}Job statuses
| Status | Meaning |
|---|---|
queued | Job created, waiting for the worker to pick it up. |
processing | Worker is actively sending emails. |
paused_limit_reached | Gmail daily sending limit reached. Job will automatically resume when quota resets. |
done | All recipients have been processed. Check sent / failed counts. |
failed | Unexpected internal error. Contact support. |
Limits
| Limit | Value |
|---|---|
| Max recipients: @gmail.com account | 450 per batch |
| Max recipients: Google Workspace account | 2,000 per batch |
| Duplicate emails in same batch | Auto-deduplicated |
| Attachments | Not supported (see below) |
| Job history retention | 90 days, then auto-deleted |
The recipient cap matches Gmail's own daily sending limit for the connected account. If your batch hits the daily limit mid-send (e.g., you already sent emails earlier today), the job status will change to paused_limit_reached. You do not need to do anything! Sendlib automatically tracks Gmail's 24-hour rolling quota and will automatically resume sending the remaining recipients as soon as your limit resets. To send to more people immediately without waiting, connect additional Gmail accounts and split batches across them using different from addresses.
Why can't I send attachments in a batch?
Attachments are intentionally not supported on /api/batch. If you attach a file to a batch of 500 emails, Sendlib would have to base64-encode and upload that file 500 separate times to Gmail's API. That is extremely slow, memory-intensive, and would burn through your daily quota much faster than expected.
The right approach is to host your file somewhere (e.g. your own server, AWS S3, Google Drive, or any CDN) and include a download link in your html or text body. Your recipients get the same experience, and your batch sends are fast.
Error responses
| Status | Reason |
|---|---|
401 | Missing or invalid API key. |
403 | Free plan: upgrade to Pro to use batch sending. |
400 | Validation error: check the message field for details. |
413 | HTML or text body exceeds the size limit. |
429 | Rate limit exceeded: check the Retry-After header. |
500 | Internal server error. |
Best Practices for Deliverability
When sending bulk emails from a personal @gmail.comaccount (as opposed to a verified Google Workspace custom domain), Google's spam filters can be highly aggressive. To ensure your batch reaches the primary inbox rather than the spam folder, we strongly recommend the following:
- Send plain text or light HTML: Avoid heavy layouts, large images, and giant colorful buttons. The more your email looks like a genuine 1-on-1 human email, the better.
- Minimize links: Try to include zero or at most one link in your first cold email to a new recipient.
- Avoid spam trigger words: Do not use highly commercial language like "Action Required", "Free Trial", "Buy Now", or "Upgrade".
- Only email expecting recipients: Sendlib automatically throttles your sending speed to keep you under Google's radar, but if a high percentage of recipients manually click "Report Spam", Google will permanently penalize your connected account.
Example: Avoiding Spam Triggers
URGENT: We detected an error.
Click the button below to fix it immediately or lose access.
Hi John,
We recently rolled out an update that might have disconnected your account.
You can easily restore it by visiting your dashboard.
Thanks,
Alex
Ideal Use Cases
Sendlib is intentionally designed for high-deliverability 1-on-1 communication. It is not designed for heavy, image-packed marketing blasts.
Great for Sendlib
- Password resets & Magic links
- Payment receipts & Invoices
- System alerts & Downtime Notifications
- Welcome emails from the founder
- Personalized cold outreach
- New feature announcements to active users
- Trial expiration warnings
- Weekly usage summary reports
Bad for Sendlib
- Weekly marketing newsletters
- Image-heavy promotional blasts
- E-commerce product catalogs
- Discount code mass mailings