Send an email
const url = 'https://api.vaartix.com/emails';const options = { method: 'POST', headers: { 'Idempotency-Key': 'order-1042-receipt', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"from":"Acme <[email protected]>","to":["[email protected]"],"subject":"Your Acme order","html":"<p>Thanks for your order, Priya.</p>","tags":[{"name":"category","value":"receipt"}]}'};
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.vaartix.com/emails \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: order-1042-receipt' \ --data '{ "from": "Acme <[email protected]>", "to": [ "[email protected]" ], "subject": "Your Acme order", "html": "<p>Thanks for your order, Priya.</p>", "tags": [ { "name": "category", "value": "receipt" } ] }'Accepts an email and queues it for sending. Returns as soon as it is queued; follow its
progress with GET /emails/{id}.
Works with send-only and full-access keys. Limited to 10 requests per second per key.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Retrying with the same key within 24 hours returns the first email instead of sending
again. Reusing a key with a different body returns 409 idempotency_conflict.
Example
order-1042-receiptRequest Bodyrequired
Section titled “Request Bodyrequired”object
Must be on a domain your team has verified (or a subdomain of it), or test.vaartix.com for test mode.
HTML body. Provide html, text or both.
Plain-text body.
Custom headers such as List-Unsubscribe. Standard headers (From, To, Subject, …) cannot be set.
object
object
Up to 30 MB in total. Executable files are not allowed.
object
Base64-encoded file content.
Detected from the filename if omitted.
For inline images. Reference it in your HTML as cid:<contentId>.
Send later, up to 30 days ahead. Times in the past send immediately.
Example
{ "to": [ ], "subject": "Your Acme order", "html": "<p>Thanks for your order, Priya.</p>", "tags": [ { "name": "category", "value": "receipt" } ]}Responses
Section titled “Responses”The email is queued (or scheduled).
object
Example
{ "id": "em_7hq2kv9xr4m1c8d3"}Headers
Section titled “Headers”Example
10Requests allowed per second for this key.
Requests left in the current second.
Seconds until the limit resets.
validation_error: the request is invalid. The message says which field and why.
object
object
Stable, machine-readable error type.
Human-readable explanation, safe to show to developers.
Example
{ "error": { "type": "validation_error", "message": "to: \"priya@\" is not a valid email address." }}unauthorized: the API key is missing, invalid or revoked.
object
object
Stable, machine-readable error type.
Human-readable explanation, safe to show to developers.
Example
{ "error": { "type": "validation_error" }}domain_not_verified: the from domain is not verified for your team.
account_paused: sending is paused for this account.
forbidden: this key is limited to a different domain.
object
object
Stable, machine-readable error type.
Human-readable explanation, safe to show to developers.
Example
{ "error": { "type": "domain_not_verified", "message": "acme.in is not verified yet. Check its DNS records." }}idempotency_conflict: the Idempotency-Key was used with a different request.
object
object
Stable, machine-readable error type.
Human-readable explanation, safe to show to developers.
Example
{ "error": { "type": "validation_error" }}rate_limited: more than 10 requests in one second (see the Retry-After header).
daily_quota_exceeded: your team’s daily limit is used up; it resets at midnight IST.
object
object
Stable, machine-readable error type.
Human-readable explanation, safe to show to developers.
Example
{ "error": { "type": "validation_error" }}Headers
Section titled “Headers”Seconds to wait before retrying (rate limits only).