Send an email
const url = 'https://api.duta.indra.sh/v1/emails';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"},"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"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters”Repeat a request safely for 24 hours. A replay carries Idempotent-Replayed: true
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
object
Responses
Section titled “ Responses ”Success
object
Sent is a sandbox send, delivered at once
Example
{ "status": "queued"}Missing or invalid API key
object
The Resend error name, so code that branches on it keeps working
Duta’s error code, finer grained than name
object
Find this request on the Logs screen
Example
{ "code": "unauthorized"}The request was refused. code says why
object
The Resend error name, so code that branches on it keeps working
Duta’s error code, finer grained than name
object
Find this request on the Logs screen
Example
{ "code": "unauthorized"}Rate limited. Retry after the Retry-After header
object
The Resend error name, so code that branches on it keeps working
Duta’s error code, finer grained than name
object
Find this request on the Logs screen
Example
{ "code": "unauthorized"}