Skip to content

API

Sending emails

One email, attachments, scheduling, idempotency, batches, tracking and statistics.

Sending an email

POST /api/v1/emails with any key (sending_access is enough).

cURL

curl https://mail.example.com/api/v1/emails \
  -H "Authorization: Bearer $VOAARO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "Acme <invoices@example.com>",
    "to": ["client@example.org"],
    "cc": ["accounting@example.org"],
    "reply_to": "support@example.com",
    "subject": "Your invoice F-2026-042",
    "html": "<p>Hello,</p><p>Your invoice is attached.</p>",
    "text": "Hello, your invoice is attached.",
    "tags": [{"name": "category", "value": "invoice"}],
    "headers": {"X-Entity-Ref-ID": "F-2026-042"}
  }'

Node / Bun

const { data, error } = await voaaro.emails.send({
  from: "Acme <invoices@example.com>",
  to: ["client@example.org"],
  cc: ["accounting@example.org"],
  replyTo: "support@example.com",
  subject: "Your invoice F-2026-042",
  html: "<p>Hello,</p><p>Your invoice is attached.</p>",
  text: "Hello, your invoice is attached.",
  tags: [{ name: "category", value: "invoice" }],
  headers: { "X-Entity-Ref-ID": "F-2026-042" },
})
if (error) throw new Error(`${error.name}: ${error.message}`)

Python

email = voaaro.Emails.send({
    "from": "Acme <invoices@example.com>",
    "to": ["client@example.org"],
    "cc": ["accounting@example.org"],
    "reply_to": "support@example.com",
    "subject": "Your invoice F-2026-042",
    "html": "<p>Hello,</p><p>Your invoice is attached.</p>",
    "text": "Hello, your invoice is attached.",
    "tags": [{"name": "category", "value": "invoice"}],
    "headers": {"X-Entity-Ref-ID": "F-2026-042"},
})

PHP

$email = $voaaro->emails->send([
    'from' => 'Acme <invoices@example.com>',
    'to' => ['client@example.org'],
    'cc' => ['accounting@example.org'],
    'replyTo' => 'support@example.com',
    'subject' => 'Your invoice F-2026-042',
    'html' => '<p>Hello,</p><p>Your invoice is attached.</p>',
    'text' => 'Hello, your invoice is attached.',
    'tags' => [['name' => 'category', 'value' => 'invoice']],
    'headers' => ['X-Entity-Ref-ID' => 'F-2026-042'],
]);

Go

sent, err := client.Emails.Send(&voaaro.SendEmailRequest{
	From:    "Acme <invoices@example.com>",
	To:      []string{"client@example.org"},
	Cc:      []string{"accounting@example.org"},
	ReplyTo: "support@example.com",
	Subject: "Your invoice F-2026-042",
	Html:    "<p>Hello,</p><p>Your invoice is attached.</p>",
	Text:    "Hello, your invoice is attached.",
	Tags:    []voaaro.Tag{{Name: "category", Value: "invoice"}},
	Headers: map[string]string{"X-Entity-Ref-ID": "F-2026-042"},
})

Response 200:

JSON
{ "id": "4f9c1e0a-5b8d-4c7e-9a31-2d6f8b0c7e15", "suppressed": [] }

suppressed lists the recipients left out because they are on the domain's suppression list (hard bounce, complaint): they receive nothing.

The fields

FieldRule
fromName <address> or address, on one of the key's domains (rules)
to, cc, bccone address or an array; at most 50 recipients in total, at least one to
reply_toone address or an array, at most 5
subjectone line, at most 998 characters
html, textat least one of the two
headersat most 20 headers; structural headers (From, Subject, Message-ID, List-*, DKIM-*…) are refused
tags[{name, value}] or {name: value}, at most 10
attachmentssee below
scheduled_atsee Scheduling
template{alias or id, variables}: a published template from the editor (application keys)

An unknown field is refused (422), so that a typo is never silently ignored.

Attachments

content in base64, at most 20 files and 10 MB (decoded). An image embedded in the HTML carries a content_id referenced by cid:. Downloading from a URL (path) is not supported: send the content.

Node / Bun

import { readFile } from "node:fs/promises"

await voaaro.emails.send({
  from: "Acme <invoices@example.com>",
  to: "client@example.org",
  subject: "Your invoice",
  html: '<img src="cid:logo"><p>Invoice attached.</p>',
  attachments: [
    { filename: "invoice.pdf", content: await readFile("invoice.pdf") }, // encoded by the SDK
    { filename: "logo.png", content: logoBase64, contentType: "image/png", contentId: "logo" },
  ],
})

Python

with open("invoice.pdf", "rb") as f:
    pdf = f.read()

voaaro.Emails.send({
    "from": "Acme <invoices@example.com>",
    "to": "client@example.org",
    "subject": "Your invoice",
    "html": "<p>Invoice attached.</p>",
    "attachments": [{"filename": "invoice.pdf", "content": pdf}],  # bytes encoded by the SDK
})

PHP

use Voaaro\Attachment;

$voaaro->emails->send([
    'from' => 'Acme <invoices@example.com>',
    'to' => 'client@example.org',
    'subject' => 'Your invoice',
    'html' => '<p>Invoice attached.</p>',
    'attachments' => [Attachment::fromPath('/invoices/F-2026-042.pdf')],
]);

Go

pdf, _ := os.ReadFile("invoice.pdf")

sent, err := client.Emails.Send(&voaaro.SendEmailRequest{
	From:        "Acme <invoices@example.com>",
	To:          []string{"client@example.org"},
	Subject:     "Your invoice",
	Html:        "<p>Invoice attached.</p>",
	Attachments: []*voaaro.Attachment{{Filename: "invoice.pdf", Content: pdf}}, // raw bytes
})

cURL

curl https://mail.example.com/api/v1/emails \
  -H "Authorization: Bearer $VOAARO_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"from\": \"Acme <invoices@example.com>\",
    \"to\": \"client@example.org\",
    \"subject\": \"Your invoice\",
    \"html\": \"<p>Invoice attached.</p>\",
    \"attachments\": [{\"filename\": \"invoice.pdf\", \"content\": \"$(base64 -w0 invoice.pdf)\"}]
  }"

For a file larger than 10 MB, the mail app offers sending by link; through the API, host the file and put the link in the message.

Scheduling

scheduled_at (or send_at): an RFC 3339 date (2026-11-20T08:00:00Z, 2026-11-20T09:00:00+01:00) or a delay in <number><unit> (in 30 min, in 2 hours, in 1 day), at most 30 days. A date in the past sends immediately.

Node / Bun

const { data } = await voaaro.emails.send({ from, to, subject: "Reminder", text: "…", scheduledAt: "in 1 hour" })
await voaaro.emails.update({ id: data.id, scheduledAt: "2026-11-20T08:00:00Z" })
await voaaro.emails.cancel(data.id)

Python

email = voaaro.Emails.send({**params, "scheduled_at": "in 1 hour"})
voaaro.Emails.update({"id": email["id"], "scheduled_at": "2026-11-20T08:00:00Z"})
voaaro.Emails.cancel(email["id"])

PHP

$email = $voaaro->emails->send([...$params, 'scheduledAt' => 'in 1 hour']);
$voaaro->emails->update($email->id, ['scheduledAt' => '2026-11-20T08:00:00Z']);
$voaaro->emails->cancel($email->id);

Go

sent, _ := client.Emails.Send(&voaaro.SendEmailRequest{From: from, To: to, Subject: "Reminder", Text: "…", ScheduledAt: "in 1 hour"})
client.Emails.Update(&voaaro.UpdateEmailRequest{Id: sent.Id, ScheduledAt: "2026-11-20T08:00:00Z"})
client.Emails.Cancel(sent.Id)

cURL

curl -X PATCH https://mail.example.com/api/v1/emails/$ID \
  -H "Authorization: Bearer $VOAARO_API_KEY" -H "Content-Type: application/json" \
  -d '{"scheduled_at": "2026-11-20T08:00:00Z"}'

curl -X POST https://mail.example.com/api/v1/emails/$ID/cancel \
  -H "Authorization: Bearer $VOAARO_API_KEY"

Rescheduling and canceling only work as long as the message has not left (409 otherwise).

Idempotency

A network that drops at the wrong moment must not send the same code twice. Add an Idempotency-Key header (1 to 256 printable ASCII characters) unique to this message:

Situation (same API key, within 24 h)Response
same idempotency key, same requestthe first response, replayed as is, with the Idempotent-Replayed: true header; nothing is done again
same idempotency key, different request409 invalid_idempotent_request
two identical requests at the same timethe first one wins; the other gets the replayed response or 409 concurrent_idempotent_requests
empty key or key longer than 256 characters422 invalid_idempotency_key

The body is compared byte for byte: send exactly the same request again. Only successful responses (2xx) are kept: after an error, fix it and retry with the same key. After 24 hours, the key is released. Each API key has its own idempotency keys.

cURL

curl https://mail.example.com/api/v1/emails \
  -H "Authorization: Bearer $VOAARO_API_KEY" \
  -H "Idempotency-Key: otp-482913" \
  -H "Content-Type: application/json" \
  -d '{"from": "Acme <security@example.com>", "to": "client@example.org", "subject": "Your code: 482913", "text": "482913"}'

Node / Bun

await voaaro.emails.send(params, { idempotencyKey: "otp-482913" })

Python

voaaro.Emails.send(params, {"idempotency_key": "otp-482913"})

PHP

$voaaro->emails->send($params, ['idempotencyKey' => 'otp-482913']);

Go

client.Emails.SendWithOptions(ctx, req, &voaaro.SendEmailOptions{IdempotencyKey: "otp-482913"})

Any creation

The same rules apply to any POST request on /api/v1: contact, segment, broadcast, form, webhook, key, suppression list entry… A retry after a dropped connection never creates two objects.

  • The compared request includes the method, the path, the parameters, the content type and the body (for a file upload in multipart/form-data, the boundary chosen at random by the client does not count).
  • The kept response is encrypted on the server: it may contain a secret (created API key, webhook secret), returned identically on a retry.
  • PATCH and DELETE do not need it: replaying them gives the same state.
cURL
curl https://mail.example.com/api/v1/webhooks \
  -H "Authorization: Bearer $VOAARO_API_KEY" \
  -H "Idempotency-Key: webhook-production-1" \
  -H "Content-Type: application/json" \
  -d '{"endpoint": "https://app.example.com/webhooks/voaaro", "events": ["email.bounced", "contact.unsubscribed"]}'

The SDKs pick a key themselves (a UUID) for each POST when retries are allowed, and keep it from one attempt to the next (SDKs).

Sending a batch

POST /api/v1/emails/batch: an array of 1 to 100 emails, each with the same fields as a single send (attachments, scheduling and templates included), at most 16 MB for the request.

  • x-batch-validation: strict (default): everything is validated first, then written at once; one error refuses the whole batch (message prefixed with message <index>).
  • x-batch-validation: permissive: the valid emails are sent, the others are listed in errors: [{index, message}].

With Idempotency-Key: K, each email gets the key K#0, K#1…

Node / Bun

const { data, error } = await voaaro.batch.send(
  [
    { from: "Acme <notifications@example.com>", to: "a@example.org", subject: "Hello A", text: "…" },
    { from: "Acme <notifications@example.com>", to: "b@example.org", subject: "Hello B", text: "…" },
  ],
  { idempotencyKey: "reminder-2026-11-12", batchValidation: "permissive" },
)
// data.data: [{ id, suppressed }], data.errors: [{ index, message }]

Python

r = voaaro.Batch.send(
    [
        {"from": "Acme <notifications@example.com>", "to": "a@example.org", "subject": "Hello A", "text": "…"},
        {"from": "Acme <notifications@example.com>", "to": "b@example.org", "subject": "Hello B", "text": "…"},
    ],
    {"idempotency_key": "reminder-2026-11-12", "batch_validation": "permissive"},
)

PHP

$lot = $voaaro->batch->send(
    [
        ['from' => 'Acme <notifications@example.com>', 'to' => 'a@example.org', 'subject' => 'Hello A', 'text' => '…'],
        ['from' => 'Acme <notifications@example.com>', 'to' => 'b@example.org', 'subject' => 'Hello B', 'text' => '…'],
    ],
    ['idempotencyKey' => 'reminder-2026-11-12', 'batchValidation' => 'permissive'],
);

Go

resp, err := client.Batch.SendWithOptions(ctx, []*voaaro.SendEmailRequest{
	{From: "Acme <notifications@example.com>", To: []string{"a@example.org"}, Subject: "Hello A", Text: "…"},
	{From: "Acme <notifications@example.com>", To: []string{"b@example.org"}, Subject: "Hello B", Text: "…"},
}, &voaaro.BatchSendEmailOptions{IdempotencyKey: "reminder-2026-11-12", BatchValidation: voaaro.BatchValidationPermissive})

cURL

curl https://mail.example.com/api/v1/emails/batch \
  -H "Authorization: Bearer $VOAARO_API_KEY" \
  -H "x-batch-validation: permissive" \
  -H "Content-Type: application/json" \
  -d '[
    {"from": "Acme <notifications@example.com>", "to": "a@example.org", "subject": "Hello A", "text": "…"},
    {"from": "Acme <notifications@example.com>", "to": "b@example.org", "subject": "Hello B", "text": "…"}
  ]'

Tracking an email

GET /api/v1/emails/{id} gives the message's status (queued, sending, sent, failed, canceled), the latest event last_event, each recipient with its status and the remote server's response, the list of events, the content and the attachments. GET /api/v1/emails lists the emails from newest to oldest (pagination).

last_eventMeaning
queued, scheduledaccepted, waiting (scheduled)
senthanded to the mail engine
deliveredaccepted by the recipient's server
delivery_delayedtemporary refusal, another attempt planned
bouncedpermanent refusal
failedgiven up (temporary refusal until the end, or all recipients suppressed)
suppressedrecipient on the suppression list
complainedthe recipient reported the message as spam
opened, clickedopen, click (if tracking is enabled on the key)
canceledcanceled

Open and click tracking is set per key, in the console (disabled by default). Messages are kept for 30 days after they are sent.

Attachments of an email: GET /api/v1/emails/{id}/attachments then GET …/attachments/{attachment}, which gives a signed download_url, valid for one hour.

Share link: POST /api/v1/emails/{id}/share (expires_in from 1 minute to 48 hours) creates a public, read-only page of the message, without the blind copies.

Statistics

GET /api/v1/emails/metrics (alias /api/v1/metrics): counters received (accepted by the API), sent, delivered, delivery_delayed, bounced, failed, suppressed, complained, opened (every open, each time the pixel loads), unique_opened (messages opened at least once), clicked, and the rates (delivery_rate, open_rate on unique opens, click_rate, bounce_rate, complaint_rate, in percent).

ParameterValues
start_date, end_dateYYYY-MM-DD (last 7 days by default, three years at most)
granularitydaily (default), weekly, monthly
dimensionsperiod, domain, api_key, tag
metricscounters and rates to return (metrics=sent,delivered); all by default
domain, api_key_idfilters

A sending_access key only sees its own figures. All dates are in UTC.

Esc