Skip to content
This site documents the main branch, which may hold changes not yet released. Latest release: v0.3.0 (changelog).

Resend: send a batch (`strict` all or nothing, or `permissive`)

POST
/emails/batch
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" } ]'
Idempotency-Key

At most 256 characters, kept 24 h per connection: the same key and body replay the stored response, another body answers 409 idempotency_mismatch.

string
<= 256 characters

At most 256 characters, kept 24 h per connection: the same key and body replay the stored response, another body answers 409 idempotency_mismatch.

x-batch-validation

strict (default) or permissive.

string
Allowed values: strict permissive

strict (default) or permissive.

Media typeapplication/json
Array<object>
>= 1 items <= 100 items
object
from
required
string
to
required
Any of:
string
subject
required
string
cc
Any of:
string
bcc
Any of:
string
reply_to
Any of:
string
replyTo
Any of:
string
html
string
text
string
headers
object
key
additional properties
string
attachments
Array<object>
object
content
string format: base64
/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/
path
string
filename
string
content_type
string
content_id
string
tags
Array<object>
object
name
required
string
>= 1 characters <= 256 characters /^[A-Za-z0-9_-]+$/
value
required
string
>= 1 characters <= 256 characters /^[A-Za-z0-9_-]+$/
scheduled_at
string
topic_id
string | null
template

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"
}
]

Accepted.

Media typeapplication/json
object
data
required
Array<object>
object
id
required
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
errors
Array<object>
object
index
required
integer
>= -9007199254740991 <= 9007199254740991
message
required
string

Example generated

{
"data": [
{
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}
],
"errors": [
{
"index": 1,
"message": "example"
}
]
}
X-Request-Id
required

Id of the request (req_…), also the id of its request log row.

string

Id of the request (req_…), also the id of its request log row.

X-RateLimit-Limit

Requests per window.

integer
<= 9007199254740991

Requests per window.

X-RateLimit-Remaining

Whole tokens left in the bucket.

integer
<= 9007199254740991

Whole tokens left in the bucket.

X-RateLimit-Reset

Seconds until the bucket is full again.

integer
<= 9007199254740991

Seconds until the bucket is full again.

ratelimit-limit

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-remaining

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-reset

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

Idempotent-Replayed

Set when the response is replayed for the same Idempotency-Key.

string
Allowed value: true

Set when the response is replayed for the same Idempotency-Key.

Error: validation_error

Media typeapplication/json
object
statusCode
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
Allowed values: missing_api_key validation_error missing_required_field invalid_attachment invalid_parameter invalid_idempotency_key invalid_idempotent_request concurrent_idempotent_requests restricted_api_key not_found rate_limit_exceeded application_error service_unavailable
message
required
string

Example

{
"name": "missing_api_key"
}
X-Request-Id
required

Id of the request (req_…), also the id of its request log row.

string

Id of the request (req_…), also the id of its request log row.

X-RateLimit-Limit

Requests per window.

integer
<= 9007199254740991

Requests per window.

X-RateLimit-Remaining

Whole tokens left in the bucket.

integer
<= 9007199254740991

Whole tokens left in the bucket.

X-RateLimit-Reset

Seconds until the bucket is full again.

integer
<= 9007199254740991

Seconds until the bucket is full again.

ratelimit-limit

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-remaining

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-reset

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

Error: unauthorized

Media typeapplication/json
object
statusCode
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
Allowed values: missing_api_key validation_error missing_required_field invalid_attachment invalid_parameter invalid_idempotency_key invalid_idempotent_request concurrent_idempotent_requests restricted_api_key not_found rate_limit_exceeded application_error service_unavailable
message
required
string

Example

{
"name": "missing_api_key"
}
X-Request-Id
required

Id of the request (req_…), also the id of its request log row.

string

Id of the request (req_…), also the id of its request log row.

WWW-Authenticate
required

Sent with every 401.

string
Allowed value: Bearer

Sent with every 401.

X-RateLimit-Limit

Requests per window.

integer
<= 9007199254740991

Requests per window.

X-RateLimit-Remaining

Whole tokens left in the bucket.

integer
<= 9007199254740991

Whole tokens left in the bucket.

X-RateLimit-Reset

Seconds until the bucket is full again.

integer
<= 9007199254740991

Seconds until the bucket is full again.

ratelimit-limit

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-remaining

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-reset

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

Error: forbidden

Media typeapplication/json
object
statusCode
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
Allowed values: missing_api_key validation_error missing_required_field invalid_attachment invalid_parameter invalid_idempotency_key invalid_idempotent_request concurrent_idempotent_requests restricted_api_key not_found rate_limit_exceeded application_error service_unavailable
message
required
string

Example

{
"name": "missing_api_key"
}
X-Request-Id
required

Id of the request (req_…), also the id of its request log row.

string

Id of the request (req_…), also the id of its request log row.

X-RateLimit-Limit

Requests per window.

integer
<= 9007199254740991

Requests per window.

X-RateLimit-Remaining

Whole tokens left in the bucket.

integer
<= 9007199254740991

Whole tokens left in the bucket.

X-RateLimit-Reset

Seconds until the bucket is full again.

integer
<= 9007199254740991

Seconds until the bucket is full again.

ratelimit-limit

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-remaining

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-reset

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

Error: idempotency_mismatch

Media typeapplication/json
object
statusCode
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
Allowed values: missing_api_key validation_error missing_required_field invalid_attachment invalid_parameter invalid_idempotency_key invalid_idempotent_request concurrent_idempotent_requests restricted_api_key not_found rate_limit_exceeded application_error service_unavailable
message
required
string

Example

{
"name": "missing_api_key"
}
X-Request-Id
required

Id of the request (req_…), also the id of its request log row.

string

Id of the request (req_…), also the id of its request log row.

X-RateLimit-Limit

Requests per window.

integer
<= 9007199254740991

Requests per window.

X-RateLimit-Remaining

Whole tokens left in the bucket.

integer
<= 9007199254740991

Whole tokens left in the bucket.

X-RateLimit-Reset

Seconds until the bucket is full again.

integer
<= 9007199254740991

Seconds until the bucket is full again.

ratelimit-limit

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-remaining

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-reset

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

Error: payload_too_large

Media typeapplication/json
object
statusCode
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
Allowed values: missing_api_key validation_error missing_required_field invalid_attachment invalid_parameter invalid_idempotency_key invalid_idempotent_request concurrent_idempotent_requests restricted_api_key not_found rate_limit_exceeded application_error service_unavailable
message
required
string

Example

{
"name": "missing_api_key"
}
X-Request-Id
required

Id of the request (req_…), also the id of its request log row.

string

Id of the request (req_…), also the id of its request log row.

X-RateLimit-Limit

Requests per window.

integer
<= 9007199254740991

Requests per window.

X-RateLimit-Remaining

Whole tokens left in the bucket.

integer
<= 9007199254740991

Whole tokens left in the bucket.

X-RateLimit-Reset

Seconds until the bucket is full again.

integer
<= 9007199254740991

Seconds until the bucket is full again.

ratelimit-limit

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-remaining

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-reset

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

Error: validation_error

Media typeapplication/json
object
statusCode
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
Allowed values: missing_api_key validation_error missing_required_field invalid_attachment invalid_parameter invalid_idempotency_key invalid_idempotent_request concurrent_idempotent_requests restricted_api_key not_found rate_limit_exceeded application_error service_unavailable
message
required
string

Example

{
"name": "missing_api_key"
}
X-Request-Id
required

Id of the request (req_…), also the id of its request log row.

string

Id of the request (req_…), also the id of its request log row.

X-RateLimit-Limit

Requests per window.

integer
<= 9007199254740991

Requests per window.

X-RateLimit-Remaining

Whole tokens left in the bucket.

integer
<= 9007199254740991

Whole tokens left in the bucket.

X-RateLimit-Reset

Seconds until the bucket is full again.

integer
<= 9007199254740991

Seconds until the bucket is full again.

ratelimit-limit

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-remaining

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-reset

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

Error: rate_limited, chaos_injected

Media typeapplication/json
object
statusCode
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
Allowed values: missing_api_key validation_error missing_required_field invalid_attachment invalid_parameter invalid_idempotency_key invalid_idempotent_request concurrent_idempotent_requests restricted_api_key not_found rate_limit_exceeded application_error service_unavailable
message
required
string

Example

{
"name": "missing_api_key"
}
X-Request-Id
required

Id of the request (req_…), also the id of its request log row.

string

Id of the request (req_…), also the id of its request log row.

Retry-After
required

Seconds until one token is back (at least 1).

integer
<= 9007199254740991

Seconds until one token is back (at least 1).

X-RateLimit-Limit

Requests per window.

integer
<= 9007199254740991

Requests per window.

X-RateLimit-Remaining

Whole tokens left in the bucket.

integer
<= 9007199254740991

Whole tokens left in the bucket.

X-RateLimit-Reset

Seconds until the bucket is full again.

integer
<= 9007199254740991

Seconds until the bucket is full again.

ratelimit-limit

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-remaining

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-reset

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

Error: chaos_injected, internal_error

Media typeapplication/json
object
statusCode
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
Allowed values: missing_api_key validation_error missing_required_field invalid_attachment invalid_parameter invalid_idempotency_key invalid_idempotent_request concurrent_idempotent_requests restricted_api_key not_found rate_limit_exceeded application_error service_unavailable
message
required
string

Example

{
"name": "missing_api_key"
}
X-Request-Id
required

Id of the request (req_…), also the id of its request log row.

string

Id of the request (req_…), also the id of its request log row.

X-RateLimit-Limit

Requests per window.

integer
<= 9007199254740991

Requests per window.

X-RateLimit-Remaining

Whole tokens left in the bucket.

integer
<= 9007199254740991

Whole tokens left in the bucket.

X-RateLimit-Reset

Seconds until the bucket is full again.

integer
<= 9007199254740991

Seconds until the bucket is full again.

ratelimit-limit

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-remaining

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-reset

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

Error: chaos_injected

Media typeapplication/json
object
statusCode
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
Allowed values: missing_api_key validation_error missing_required_field invalid_attachment invalid_parameter invalid_idempotency_key invalid_idempotent_request concurrent_idempotent_requests restricted_api_key not_found rate_limit_exceeded application_error service_unavailable
message
required
string

Example

{
"name": "missing_api_key"
}
X-Request-Id
required

Id of the request (req_…), also the id of its request log row.

string

Id of the request (req_…), also the id of its request log row.

X-RateLimit-Limit

Requests per window.

integer
<= 9007199254740991

Requests per window.

X-RateLimit-Remaining

Whole tokens left in the bucket.

integer
<= 9007199254740991

Whole tokens left in the bucket.

X-RateLimit-Reset

Seconds until the bucket is full again.

integer
<= 9007199254740991

Seconds until the bucket is full again.

ratelimit-limit

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-remaining

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-reset

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

Error: chaos_injected

Media typeapplication/json
object
statusCode
required
integer
>= -9007199254740991 <= 9007199254740991
name
required
string
Allowed values: missing_api_key validation_error missing_required_field invalid_attachment invalid_parameter invalid_idempotency_key invalid_idempotent_request concurrent_idempotent_requests restricted_api_key not_found rate_limit_exceeded application_error service_unavailable
message
required
string

Example

{
"name": "missing_api_key"
}
X-Request-Id
required

Id of the request (req_…), also the id of its request log row.

string

Id of the request (req_…), also the id of its request log row.

X-RateLimit-Limit

Requests per window.

integer
<= 9007199254740991

Requests per window.

X-RateLimit-Remaining

Whole tokens left in the bucket.

integer
<= 9007199254740991

Whole tokens left in the bucket.

X-RateLimit-Reset

Seconds until the bucket is full again.

integer
<= 9007199254740991

Seconds until the bucket is full again.

ratelimit-limit

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-remaining

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.

ratelimit-reset

Resend copy of the matching X-RateLimit header.

string

Resend copy of the matching X-RateLimit header.