Piisend does not yet expose a single POST /emails/batch endpoint. Send to multiple recipients by calling POST /emails once per message (or once per recipient).
When to use batch-style sends
- Transactional notifications to a list of users (each with personalized content)
- Small marketing batches where each recipient gets the same or templated body
- Import flows that enqueue one API call per row
Step-by-step
1. Prepare your recipient list
Load addresses from your database or CSV. Validate format before calling the API.
2. Use templates for personalization
For per-user content, create a template and pass template_id + template_vars on each request instead of duplicating HTML in your loop.
3. Send with controlled concurrency
Issue one POST /emails per recipient. Limit parallel requests to stay under plan rate limits—the API returns 429 when you exceed the per-minute send rate.
4. Add idempotency for retries
If your worker retries failed HTTP calls, set a unique Idempotency-Key per logical send so a retry does not duplicate delivery. See Idempotency keys.
Limitations
- No native batch API yet — a dedicated batch endpoint (single request, many payloads) is planned.
- Rate limits apply per request — see Plans & limits.
- Attachments in loops — each attachment payload is base64-encoded inline; large files multiply request size.
Related
- Schedule email — defer individual sends
- Send test emails — verify integration before bulk sends
Loop example
# Send each recipient with a separate POST /emails call.
# Respect plan rate limits — see /docs/limits.
for email in user1@example.com user2@example.com; do
curl -sS -X POST "https://api.piisend.com/api/v1/emails" \
-H "Authorization: Bearer $PIISEND_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"to\":[\"$email\"],\"subject\":\"Hello\",\"text\":\"Hi there\"}"
done