Send a batch, items validated one by one (D33)
const url = 'http://localhost:3000/v1/emails/batch';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '[{"from":{"email":"example","name":"example"},"to":{"email":"example","name":"example"},"cc":{"email":"example","name":"example"},"bcc":{"email":"example","name":"example"},"replyTo":{"email":"example","name":"example"},"subject":"example","html":"example","text":"example","headers":{"additionalProperty":"example"},"tags":[{"name":"example","value":"example"}],"attachments":[{"filename":"example","content":"example","contentType":"example","contentId":"example"}],"metadata":{"additionalProperty":"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/v1/emails/batch \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '[ { "from": { "email": "example", "name": "example" }, "to": { "email": "example", "name": "example" }, "cc": { "email": "example", "name": "example" }, "bcc": { "email": "example", "name": "example" }, "replyTo": { "email": "example", "name": "example" }, "subject": "example", "html": "example", "text": "example", "headers": { "additionalProperty": "example" }, "tags": [ { "name": "example", "value": "example" } ], "attachments": [ { "filename": "example", "content": "example", "contentType": "example", "contentId": "example" } ], "metadata": { "additionalProperty": "example" } } ]'200 when every item is accepted, 207 otherwise (also when none is).
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.
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
object
object
Example generated
[ { "from": { "email": "example", "name": "example" }, "to": { "email": "example", "name": "example" }, "cc": { "email": "example", "name": "example" }, "bcc": { "email": "example", "name": "example" }, "replyTo": { "email": "example", "name": "example" }, "subject": "example", "html": "example", "text": "example", "headers": { "additionalProperty": "example" }, "tags": [ { "name": "example", "value": "example" } ], "attachments": [ { "filename": "example", "content": "example", "contentType": "example", "contentId": "example" } ], "metadata": { "additionalProperty": "example" } }]Responses
Section titled “Responses”Every item accepted.
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.
Set when the response is replayed for the same Idempotency-Key.
Set when the response is replayed for the same Idempotency-Key.
Some or no item accepted.
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.
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
object
Example
{ "error": { "code": "unauthorized" }}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.
Error: unauthorized
object
object
Example
{ "error": { "code": "unauthorized" }}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.
Error: forbidden
object
object
Example
{ "error": { "code": "unauthorized" }}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.
Error: idempotency_mismatch
object
object
Example
{ "error": { "code": "unauthorized" }}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.
Error: payload_too_large
object
object
Example
{ "error": { "code": "unauthorized" }}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.
Error: validation_error
object
object
Example
{ "error": { "code": "unauthorized" }}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.
Error: rate_limited, chaos_injected
object
object
Example
{ "error": { "code": "unauthorized" }}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.
Error: chaos_injected, internal_error
object
object
Example
{ "error": { "code": "unauthorized" }}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.
Error: chaos_injected
object
object
Example
{ "error": { "code": "unauthorized" }}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.
Error: chaos_injected
object
object
Example
{ "error": { "code": "unauthorized" }}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.