Send a batch of emails (Resend dialect)
Drop-in for Resend's POST /emails/batch. The body is a JSON ARRAY of the objects POST /api/compat/resend/emails takes; a body that is not an array answers 422, while a body that is not JSON, or an entry that is not an object, answers 400. Auth as for that route.
Validation is strict: if ANY entry fails translation, schema validation or content review, the whole batch is refused before any send runs and nothing is sent. That guarantee stops there. The sends then run one after another, so a later entry that fails (an unverified or different from domain, a sandbox restriction, a 429) answers an error for the whole request and leaves the earlier entries already queued, without telling the caller which. Success is 200 { data: [{ id }, …] } in input order. The array carries at most 100 entries, as on the native batch; a longer one answers 422 validation_error and nothing is sent. The Idempotency-Key covers the whole batch, but it does not protect a batch that failed part-way: the failure releases the key, so retrying with the same key sends the entries that were already queued a second time.
Authorization
ApiKeyAuth API key authentication. Use a sk_* (FULL) or pk_* (SENDING_ONLY) key as the bearer token. Public keys (pk_*) are restricted to the email-send endpoints and the self-serve list subscribe/unsubscribe pair; every other endpoint — event tracking included — answers 403 for them. In scope terms (used by /api/v1/* operations): FULL keys hold every scope; SENDING_ONLY keys hold only emails:send.
In: header
Header Parameters
Replay-safety key (1–255 characters, 24h TTL). The first request wins; a retry with the same key AND the same translated message replays its result. Reusing a key for a different message answers 422, in this dialect's error body. An empty or over-long key answers 400 (INVALID_IDEMPOTENCY_KEY). Only a send that SUCCEEDED is replayed: a send that fails releases the key, so a retry with the same key runs again.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
A Resend emails.send() body. Either html or text is required (else 422). Translated to the native send input and then validated by the same schema as POST /api/emails, so its limits apply.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/compat/resend/emails/batch" \ -H "Content-Type: application/json" \ -d '[ { "from": "string", "to": "string", "subject": "string" } ]'{
"data": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}
]
}{
"statusCode": 0,
"message": "string",
"name": "string"
}{
"statusCode": 0,
"message": "string",
"name": "string"
}{
"statusCode": 0,
"message": "string",
"name": "string"
}{
"statusCode": 0,
"message": "string",
"name": "string"
}{
"statusCode": 0,
"message": "string",
"name": "string"
}{
"statusCode": 0,
"message": "string",
"name": "string"
}{
"statusCode": 0,
"message": "string",
"name": "string"
}{
"statusCode": 0,
"message": "string",
"name": "string"
}{
"statusCode": 0,
"message": "string",
"name": "string"
}