Skip to content

Send an email

POST
/emails
curl --request POST \
--url https://api.duta.indra.sh/v1/emails \
--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" }, "reply_to": { "email": "example", "name": "example" }, "subject": "example", "html": "example", "text": "example", "headers": { "additionalProperty": "example" }, "attachments": [ { "filename": "example", "content": { "type": "Buffer", "data": [ 1 ] }, "path": "example", "content_type": "example", "content_id": "example" } ], "tags": { "additionalProperty": "example" } }'

Needs html or text. On the Free plan, or from a sandbox address, the mail goes through the sandbox. scheduled_at, template, topic_id are refused with 422 rather than ignored.

Idempotency-Key
string
>= 1 characters <= 256 characters

Repeat a request safely for 24 hours. A replay carries Idempotent-Replayed: true

Media typeapplication/json
object
from
required
Any of:
string
to
required
Any of:
string
cc
Any of:
string
bcc
Any of:
string
reply_to
Any of:
string
subject
required
string
>= 1 characters
html
string
text
string
headers
object
key
additional properties
string
attachments
Array<object>
object
filename
string
>= 1 characters
content
Any of:
string
path

A public https URL Duta downloads. Not accepted in a batch

string
content_type

Inferred from the filename when left out

string
content_id

For inline images referenced as cid: in the HTML

string
tags
Any of:
object
key
additional properties
string
/^[A-Za-z0-9_-]{1,256}$/

Success

Media typeapplication/json
object
id
required
string
status
required

Sent is a sandbox send, delivered at once

string
Allowed values: queued sent suppressed
Example
{
"status": "queued"
}

Missing or invalid API key

Media typeapplication/json
object
statusCode
required
integer
name
required

The Resend error name, so code that branches on it keeps working

string
message
required
string
code
required

Duta’s error code, finer grained than name

string
Allowed values: unauthorized forbidden not_found validation_failed domain_not_verified from_domain_not_allowed recipient_suppressed recipient_not_confirmed rate_limited quota_exceeded conflict payment_required account_paused content_rejected platform_halted payload_too_large length_required idempotency_conflict provider_error internal_error
detail
object
key
additional properties
request_id
required

Find this request on the Logs screen

string
Example
{
"code": "unauthorized"
}

The request was refused. code says why

Media typeapplication/json
object
statusCode
required
integer
name
required

The Resend error name, so code that branches on it keeps working

string
message
required
string
code
required

Duta’s error code, finer grained than name

string
Allowed values: unauthorized forbidden not_found validation_failed domain_not_verified from_domain_not_allowed recipient_suppressed recipient_not_confirmed rate_limited quota_exceeded conflict payment_required account_paused content_rejected platform_halted payload_too_large length_required idempotency_conflict provider_error internal_error
detail
object
key
additional properties
request_id
required

Find this request on the Logs screen

string
Example
{
"code": "unauthorized"
}

Rate limited. Retry after the Retry-After header

Media typeapplication/json
object
statusCode
required
integer
name
required

The Resend error name, so code that branches on it keeps working

string
message
required
string
code
required

Duta’s error code, finer grained than name

string
Allowed values: unauthorized forbidden not_found validation_failed domain_not_verified from_domain_not_allowed recipient_suppressed recipient_not_confirmed rate_limited quota_exceeded conflict payment_required account_paused content_rejected platform_halted payload_too_large length_required idempotency_conflict provider_error internal_error
detail
object
key
additional properties
request_id
required

Find this request on the Logs screen

string
Example
{
"code": "unauthorized"
}