Resend: send a batch (`strict` all or nothing, or `permissive`)
const url = 'http://localhost:3000/emails/batch';const options = { method: 'POST', headers: { 'x-batch-validation': 'strict', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '[{"from":"example","to":["example"],"subject":"example","cc":["example"],"bcc":["example"],"reply_to":["example"],"replyTo":["example"],"html":"example","text":"example","headers":{"additionalProperty":"example"},"attachments":[{"content":"example","path":"example","filename":"example","content_type":"example","content_id":"example"}],"tags":[{"name":"example","value":"example"}],"scheduled_at":"example","topic_id":"example","template":"example"}]'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/emails/batch \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'x-batch-validation: strict' \ --data '[ { "from": "example", "to": [ "example" ], "subject": "example", "cc": [ "example" ], "bcc": [ "example" ], "reply_to": [ "example" ], "replyTo": [ "example" ], "html": "example", "text": "example", "headers": { "additionalProperty": "example" }, "attachments": [ { "content": "example", "path": "example", "filename": "example", "content_type": "example", "content_id": "example" } ], "tags": [ { "name": "example", "value": "example" } ], "scheduled_at": "example", "topic_id": "example", "template": "example" } ]'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”At most 256 characters, kept 24 h per connection: the same key and body replay the stored response, another body answers 409 idempotency_mismatch.
At most 256 characters, kept 24 h per connection: the same key and body replay the stored response, another body answers 409 idempotency_mismatch.
strict (default) or permissive.
strict (default) or permissive.
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
object
Example generated
[ { "from": "example", "to": [ "example" ], "subject": "example", "cc": [ "example" ], "bcc": [ "example" ], "reply_to": [ "example" ], "replyTo": [ "example" ], "html": "example", "text": "example", "headers": { "additionalProperty": "example" }, "attachments": [ { "content": "example", "path": "example", "filename": "example", "content_type": "example", "content_id": "example" } ], "tags": [ { "name": "example", "value": "example" } ], "scheduled_at": "example", "topic_id": "example", "template": "example" }]Responses
Section titled “Responses”Accepted.
object
object
object
Example generated
{ "data": [ { "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } ], "errors": [ { "index": 1, "message": "example" } ]}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Requests per window.
Requests per window.
Whole tokens left in the bucket.
Whole tokens left in the bucket.
Seconds until the bucket is full again.
Seconds until the bucket is full again.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Set when the response is replayed for the same Idempotency-Key.
Set when the response is replayed for the same Idempotency-Key.
Error: validation_error
object
Example
{ "name": "missing_api_key"}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Requests per window.
Requests per window.
Whole tokens left in the bucket.
Whole tokens left in the bucket.
Seconds until the bucket is full again.
Seconds until the bucket is full again.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Error: unauthorized
object
Example
{ "name": "missing_api_key"}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Sent with every 401.
Sent with every 401.
Requests per window.
Requests per window.
Whole tokens left in the bucket.
Whole tokens left in the bucket.
Seconds until the bucket is full again.
Seconds until the bucket is full again.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Error: forbidden
object
Example
{ "name": "missing_api_key"}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Requests per window.
Requests per window.
Whole tokens left in the bucket.
Whole tokens left in the bucket.
Seconds until the bucket is full again.
Seconds until the bucket is full again.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Error: idempotency_mismatch
object
Example
{ "name": "missing_api_key"}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Requests per window.
Requests per window.
Whole tokens left in the bucket.
Whole tokens left in the bucket.
Seconds until the bucket is full again.
Seconds until the bucket is full again.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Error: payload_too_large
object
Example
{ "name": "missing_api_key"}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Requests per window.
Requests per window.
Whole tokens left in the bucket.
Whole tokens left in the bucket.
Seconds until the bucket is full again.
Seconds until the bucket is full again.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Error: validation_error
object
Example
{ "name": "missing_api_key"}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Requests per window.
Requests per window.
Whole tokens left in the bucket.
Whole tokens left in the bucket.
Seconds until the bucket is full again.
Seconds until the bucket is full again.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Error: rate_limited, chaos_injected
object
Example
{ "name": "missing_api_key"}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Seconds until one token is back (at least 1).
Seconds until one token is back (at least 1).
Requests per window.
Requests per window.
Whole tokens left in the bucket.
Whole tokens left in the bucket.
Seconds until the bucket is full again.
Seconds until the bucket is full again.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Error: chaos_injected, internal_error
object
Example
{ "name": "missing_api_key"}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Requests per window.
Requests per window.
Whole tokens left in the bucket.
Whole tokens left in the bucket.
Seconds until the bucket is full again.
Seconds until the bucket is full again.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Error: chaos_injected
object
Example
{ "name": "missing_api_key"}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Requests per window.
Requests per window.
Whole tokens left in the bucket.
Whole tokens left in the bucket.
Seconds until the bucket is full again.
Seconds until the bucket is full again.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Error: chaos_injected
object
Example
{ "name": "missing_api_key"}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Requests per window.
Requests per window.
Whole tokens left in the bucket.
Whole tokens left in the bucket.
Seconds until the bucket is full again.
Seconds until the bucket is full again.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.
Resend copy of the matching X-RateLimit header.