Skip to content

API

Newsletters: settings, forms, automations, templates

Sending settings, overview, signup forms, dynamic segments, detailed statistics, A/B testing, templates, automations and inactive contact cleanup.

These routes complement contacts and broadcasts. Like them, they require a full_access key (except API signups, open to sending_access keys and to the browser): an application key manages the newsletter of its domains (add ?domain= if it covers several). Newsletters belong to the domain: a personal key gets 401 restricted_api_key. An object outside this scope responds 404.

ResourceFor
/newsletter/settings, /newsletter/overviewsettings and overview
/forms, /forms/{id}/signups, /forms/{id}/preview, /forms/{id}/rotate-key, /newsletter/default-formsignup forms, default signup page
/newsletter/subscribe, /newsletter/unsubscribe, /newsletter/subscriptions/{email}, /newsletter/public/{public_key}/…subscribing and unsubscribing from your application: signup form, unsubscribing
/newsletter/preferences-page/preview, preferences_page in the settingsdefault preferences page
/broadcasts/{id}/schedule, send-now, /broadcasts/scheduled, /broadcasts/{id}/checkbroadcast scheduling
/segments with filter, /segments/previewdynamic segments
/broadcasts/{id}/links, domains, timeline, exportdetailed statistics
ab of a broadcast, /broadcasts/{id}/ab/winnerA/B testing
/newsletter-templatestemplates
/automations, /automations/{id}/runs, /eventsautomations
/contacts/cleanupinactive contact cleanup

Settings

GET and PATCH /api/v1/newsletter/settings: the sender, the reply-to address and the postal address of the scope. null clears a field.

JSON
{
  "object": "newsletter_settings",
  "domain": "example.com",
  "from": "Acme <news@example.com>",
  "reply_to": "contact@example.com",
  "postal_address": "Acme\n12 Lilac Street\nSpringfield",
  "missing": [],
  "updated_at": "2026-11-12T09:00:00Z"
}
  • from follows the rules of a broadcast: an address of the domain.
  • postal_address: at most 300 characters and 5 lines. The law requires it in commercial emails in many countries: POST /broadcasts/{id}/send requires it (422 validation_error, message starting with postal_address, otherwise).
  • missing lists what is missing to send (from, postal_address).
  • A broadcast created without from or reply_to takes those of the settings: through the API, from can therefore be omitted.

Variables available in addition to those of broadcasts:

VariableValue
{{ postal_address }} (or {{{VOAARO_POSTAL_ADDRESS}}})the postal address; in HTML, each line breaks. Missing from the content, it is added to the footer
{{ preferences_url }} (or {{{VOAARO_PREFERENCES_URL}}})the contact's preferences page: their name, their topics, unsubscribing
{{ view_url }} (or {{{VOAARO_VIEW_URL}}})the broadcast in the browser, as the contact received it, without pixel or tracked link

preferences_page customizes the default preferences page (title, text, colors, image, language).

PATCH with { "archive": true } opens the scope's public archive: archive_url lists the sent broadcasts marked archived: true (a field that can be changed even after sending), shown without contact data. { "archive": false } closes it.

Overview

GET /api/v1/newsletter/overview?days=30 (1 to 366 days) gives, for the period:

  • contacts: total, subscribed, unsubscribed, new, lost, growth, segments, topics;
  • series: one point per UTC day (day, new, unsubscribed, subscribers at the end of the day);
  • campaigns: number of broadcasts, recipients, delivered, opened, clicked, bounces, complaints, unsubscribes, and the rates in percent (null without a denominator; opens and clicks on the broadcasts whose key has tracking enabled);
  • recent and scheduled: the last 5 broadcasts sent and the next 5 scheduled.

Signup forms

A form gives a hosted page (url, https://mail.example.com/n/<id>) and an embed code (embed_html) for your site. It puts signups into segments and offers them topics.

MethodPathResponse
POST/api/v1/forms201 { object: "form", id, url }
GET/api/v1/formslist, status filter (without embed_html)
GET, PATCH/api/v1/forms/{id}the full form, with counts and embed_html
DELETE/api/v1/forms/{id}{ object: "form", id, deleted: true }; the contacts stay
GET/api/v1/forms/{id}/signupssignups, status filter (pending, confirmed), 50 per page without limit
cURL
curl https://mail.example.com/api/v1/forms \
  -H "Authorization: Bearer $VOAARO_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "name": "Website newsletter",
    "segment_ids": ["…"],
    "fields": [{"key": "first_name", "label": "First name", "required": true}],
    "title": "The Acme newsletter",
    "consent_text": "I agree to receive the Acme newsletter.",
    "language": "en"
  }'
FieldRule
namerequired, 100 characters
statusactive (default) or disabled
double_opt_intrue by default: the subscriber confirms through a link received by email
segment_ids, topic_idssegments to put signups into; topics offered as checkboxes
fieldsat most 10, { key, label, required }; key: first_name, last_name or a declared property
title, description, button_label, success_messagepage texts (150, 1,000, 50 and 500 characters)
consent_textwhen filled, it adds a required checkbox (1,000 characters)
redirect_urlpage of your site to return to after signing up (?status=pending or subscribed)
languagefr, en, es, it, ru, zh-CN, de: language of the page and of the confirmation email
accent_color, background_color#rrggbb (background: #f6f6f7 by default)
image_urlheader image: https:// or a base64-embedded image (PNG, JPEG, GIF, WebP, 200 KB), never SVG
allowed_origins, require_challengeallowed origins and proof of work of the browser API
is_default, public_keyread only: the domain's default form, public key mlk_pub_… (POST /api/v1/forms/{id}/rotate-key changes it)

50 forms per scope. Double opt-in requires a sender in the settings (422 otherwise): it sends the confirmation email, valid for 7 days.

  • Anti-bot: proof of work computed by the browser, invisible honeypot field, 20 signups per hour per IP address; at most one confirmation email per address per 24 hours across all the domain's forms, and 3 at most across the whole instance (beyond that, same response, no email).
  • On confirmation (or right away without double opt-in): the contact is created or updated, resubscribed if they had unsubscribed (it is an explicit request), put into the segments, subscribed to the checked topics. The consent (text, date, IP address, browser) is kept on the signup and on the contact.
  • A signup: { id, email, status: "pending" | "confirmed" | "expired", contact_id, created_at, confirmed_at, consent, data }.
  • Webhooks: form.submitted and form.confirmed, and the subscription webhooks contact.subscribed, contact.confirmed.
  • Default form, preview (POST /api/v1/forms/{id}/preview): default signup page. Your own form, from your server or the browser: Your own signup form.

Dynamic segments

A segment holds either a list of members, or conditions (filter), evaluated on each read and frozen when a broadcast starts. POST /api/v1/segments with { name, filter }; PATCH changes the filter of a dynamic segment (a list does not become dynamic: 409). Adding or removing a contact by hand from a dynamic segment also responds 409.

JSON
{
  "match": "all",
  "conditions": [
    { "field": "email", "op": "ends_with", "value": "@example.com" },
    { "field": "property", "key": "age", "op": "gt", "value": 30 },
    { "field": "topic", "topic_id": "…", "op": "subscribed" },
    { "field": "opened", "op": "any", "days": 30 },
    { "field": "inactive", "days": 90 }
  ]
}
fieldop and values
emailcontains, not_contains, equals, ends_with; value (case-insensitive)
first_name, last_nameequals, contains (value), is_set, is_not_set
propertykey (declared property); equals, not_equals, contains, gt, lt (number property), is_set, is_not_set
topictopic_id; subscribed, not_subscribed
segmentsegment_id (a list); in, not_in
created_atwithin_days, older_than_days; days (1 to 3,650)
opened, clickedany, none; optional days and broadcast_id
inactivedays: signed up more than N days ago, no open or click for N days
formform_id: signed up through this form
unsubscribedboolean value

match: all (every condition) or any (at least one); 1 to 20 conditions. A malformed condition responds 422, message filter : condition <n> : …. POST /api/v1/segments/preview with { filter } counts the targeted contacts and shows 10 of them, without creating anything.

Detailed statistics

Every open and every click of a broadcast message (tracking enabled on the key) is kept on the recipient and per link: these figures survive the log purge (30 days). A click also counts as an open (images blocked).

RouteResponse
GET /api/v1/broadcasts/{id}/links{ url, clicks, unique_clicks } per link, from most to least clicked
GET /api/v1/broadcasts/{id}/domainsresults per recipient domain (the 50 largest): recipients, delivered, opened, clicked, bounced, complained, unsubscribed
GET /api/v1/broadcasts/{id}/timeline?hours=48first opens and first clicks per hour since the start (1 to 720 hours)
GET /api/v1/broadcasts/{id}/exportUTF-8 CSV with one row per recipient: status, dates, number of opens and clicks, unsubscribe

A/B testing

The ab field of a broadcast (at creation, or through PATCH while it is a draft or scheduled; null removes it) tries up to three versions on a sample, then sends the best one to the others:

JSON
{
  "variants": [{ "subject": "Subject B" }],
  "sample_pct": 20,
  "metric": "opened",
  "wait_minutes": 240
}
  • The broadcast itself is variant a; variants adds one or two, each changing at least the subject, the sender, the preview (preview_text) or the content (html, text).
  • sample_pct: 5 to 50% of the recipients (20 by default), drawn at random; the others wait (stats.held).
  • After wait_minutes (1 to 10,080, 240 by default), the variant with the best metric rate (opened or clicked, on delivered messages) goes to the others; on a tie, a.
  • POST /api/v1/broadcasts/{id}/ab/winner with { "variant": "b" } chooses without waiting (409 if the test has not started or the winner is already chosen).
  • When read, ab also carries winner, decided_at, decided_by (auto or manual) and results per variant.

Templates

/api/v1/newsletter-templates keeps ready-to-use contents: POST with { name, subject?, preview_text?, html?, text? }, or { broadcast_id, name? } to save a broadcast as a template; GET, PATCH, DELETE on /{id}. 100 templates per scope.

POST /api/v1/broadcasts accepts template_id: the template's subject, preview, HTML and text fill the fields you do not give.

Automations

An automation sends a sequence of emails to each contact who meets a starting condition: welcome, follow-up, signup anniversary…

cURL
curl https://mail.example.com/api/v1/automations \
  -H "Authorization: Bearer $VOAARO_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome",
    "status": "active",
    "trigger": {"type": "contact.created"},
    "steps": [
      {"type": "email", "subject": "Welcome {{{contact.first_name|}}}", "html": "<p>Thanks for signing up.</p>"},
      {"type": "wait", "minutes": 1440},
      {"type": "condition", "filter": {"match": "all", "conditions": [{"field": "opened", "op": "none"}]}},
      {"type": "email", "subject": "Did you miss it?", "text": "…"}
    ]
  }'
Trigger (trigger.type)Starts when
contact.createda contact is created (not unsubscribed)
segment.addeda contact enters the segment segment_id (a list)
topic.subscribeda contact subscribes to the topic topic_id
form.confirmeda signup to the form form_id is confirmed
eventyour application sends the event named event (see below)
  • Steps (at most 20): email (subject, html and or text, optional from: the settings' sender otherwise; same variables as a broadcast, footer with postal address and unsubscribe); wait (minutes, up to one year); condition (filter of a dynamic segment: when false, the run stops).
  • Statuses: draft, active, paused. Activating requires the postal address, a sender and a domain ready for bulk sending (like a broadcast). Triggers count from the first activation; a pause keeps the waiting runs.
  • A contact goes through an automation only once. If they unsubscribe, their run stops before the next email; an address on the suppression list skips the email.
  • 50 automations per scope. GET /api/v1/automations/{id}/runs (status filter: active, done, stopped; 100 per page without limit) shows each run, its step and its log.
  • The emails go through the sending API's queue, with the automation_id and step tags; webhooks: automation.* and the usual email.*.

Sending an event

POST /api/v1/events with { "email" or "contact_id", "name", "data"? } starts the automations whose trigger is { "type": "event", "event": "<name>" }. name: 1 to 64 characters (letters, digits, _ . : -); data: an object of at most 16 KiB. Response 202 { object: "event", id, contact_id, name }.

cURL
curl https://mail.example.com/api/v1/events \
  -H "Authorization: Bearer $VOAARO_API_KEY" -H "Content-Type: application/json" \
  -d '{"email": "ada@example.org", "name": "order.paid", "data": {"amount": 42}}'

Inactive contact cleanup

Writing to addresses that no longer open anything hurts deliverability. POST /api/v1/contacts/cleanup targets subscribed contacts, signed up more than days days ago, who received a tracked broadcast during that period without opening it or clicking:

FieldRule
days30 to 3,650
actionunsubscribe (default) or delete
dry_runtrue by default: counts without changing anything

Response: { object: "contact_cleanup", days, action, dry_run, count, sample } (10 addresses as examples). Run a simulation first, then run again with "dry_run": false. Without open tracking, inactivity cannot be measured: no contact is targeted.

Esc