Skip to content

API

Contacts, segments and topics

The recipients of broadcasts: contacts, properties, segments, subscription topics and CSV import.

These routes require a full_access key. An application key manages the contacts of its domains (give domain, as a parameter or in the body, if it covers several). Newsletters belong to the domain: a personal key gets 401. An object outside this scope returns 404.

Contacts

A contact is identified by its ID or its address. Creating a contact whose address already exists updates it (same ID, response 200 instead of 201).

Node / Bun

await voaaro.contacts.create({
  email: "ada@example.org",
  firstName: "Ada",
  properties: { plan: "pro" },
  segments: [{ id: segmentId }],
})
await voaaro.contacts.update({ email: "ada@example.org", unsubscribed: true })

Python

voaaro.Contacts.create({
    "email": "ada@example.org",
    "first_name": "Ada",
    "properties": {"plan": "pro"},
    "segments": [{"id": segment_id}],
})
voaaro.Contacts.update("ada@example.org", {"unsubscribed": True})

PHP

$voaaro->contacts->create([
    'email' => 'ada@example.org',
    'firstName' => 'Ada',
    'properties' => ['plan' => 'pro'],
    'segments' => [['id' => $segmentId]],
]);
$voaaro->contacts->update('ada@example.org', ['unsubscribed' => true]);

Go

c, _ := client.Contacts.Create(&voaaro.CreateContactRequest{
	Email:      "ada@example.org",
	FirstName:  "Ada",
	Properties: map[string]any{"plan": "pro"},
	Segments:   []string{segmentId},
})

cURL

curl https://mail.example.com/api/v1/contacts \
  -H "Authorization: Bearer $VOAARO_API_KEY" -H "Content-Type: application/json" \
  -d '{"email": "ada@example.org", "first_name": "Ada", "properties": {"plan": "pro"}}'
FieldRule
emailrequired, cannot be changed afterwards
first_name, last_nameat most 100 characters; null clears
unsubscribedunsubscribed from all broadcasts; setting it to true cancels their pending broadcast messages
properties{key: value} for declared properties; text of at most 500 characters or a number; null clears
segments[{id}] at creation
topics[{id, subscription: "opt_in" | "opt_out"}]

Listing: GET /api/v1/contacts with segment_id, q (search in the address and the name), email (the address contains), unsubscribed, created_after, created_before (filters), and the usual pagination.

Every creation, change, unsubscribe or deletion of a contact, through any path (API, console, import, form, preferences page), produces a contact.* webhook.

Engagement score and verification

Each contact carries, in short form, engagement_score (0 to 100, null until a tracked broadcast has been received) and email_status (valid, risky, invalid, null until the address has been checked). GET /api/v1/contacts/{id} gives the details:

JSON
{ "engagement": { "score": 72, "level": "high", "updated_at": "…", "last_open_at": "…", "last_click_at": "…" },
  "verification": { "status": "risky", "reasons": ["typo"], "suggestion": "jane@gmail.com", "checked_at": "…" } }
  • Score: weighted average of the tracked broadcasts received over the past year (click 1, open 0.8, Apple Mail automatic open 0.3, nothing 0), weight halved every 60 days, pulled towards 50 while there are few sends; 0 after a hard bounce or a complaint. Levels: low (below 30), medium (30 to 69), high (70 and above), unmeasured.
  • Verification reasons: syntax, no_mail_server (neither MX nor A), null_mx, reserved_domain (status invalid); disposable, role, typo (status risky); dns_unknown (resolver unreachable: nothing is concluded). No SMTP connection to the recipients' servers.
  • Filters of GET /api/v1/contacts: engagement=low|medium|high|unmeasured, email_status=valid|risky|invalid|unchecked. Dynamic segment conditions: { "field": "engagement", "op": "lt" | "gte", "value": 30 } (or "op": "is_not_set"), { "field": "email_status", "op": "equals" | "not_equals", "value": "invalid" }.
  • POST /api/v1/contacts/verify { "email" } checks an address without saving it; POST /api/v1/contacts/{id}/verify checks a contact again and keeps the result.
  • GET /api/v1/contacts/export: CSV (UTF-8 with BOM) of the contacts, same filters as the list (segment_id, unsubscribed, engagement, email_status), with the columns engagement_score, engagement_level, email_status, email_reasons, email_suggestion, last_open_at, last_click_at.

Node / Bun

const { data: v } = await voaaro.contacts.verifyEmail({ email: "jane@gmial.com" })
await voaaro.contacts.reverify({ email: "jane@gmial.com" })
const { data: low } = await voaaro.contacts.list({ engagement: "low", emailStatus: "valid" })
const { data: csv } = await voaaro.contacts.export({ segmentId, engagement: "high" })
await voaaro.contacts.imports.create({ file, skipInvalid: true })

Python

v = voaaro.Contacts.verify_email({"email": "jane@gmial.com"})
voaaro.Contacts.reverify("jane@gmial.com")
low = voaaro.Contacts.list({"engagement": "low", "email_status": "valid"})
csv_text = voaaro.Contacts.export({"segment_id": segment_id, "engagement": "high"})
voaaro.Contacts.imports.create({"file": data, "skip_invalid": True})

PHP

$v = $voaaro->contacts->verifyEmail('jane@gmial.com');
$voaaro->contacts->reverify('jane@gmial.com');
$low = $voaaro->contacts->list(['engagement' => 'low', 'emailStatus' => 'valid']);
$csv = $voaaro->contacts->export(['segmentId' => $segmentId, 'engagement' => 'high']);
$voaaro->contacts->imports->create(['file' => 'contacts.csv', 'skipInvalid' => true]);

Go

v, _ := client.Contacts.VerifyEmail(&voaaro.VerifyEmailRequest{Email: "jane@gmial.com"})
client.Contacts.Reverify("jane@gmial.com", "")
low, _ := client.Contacts.List(&voaaro.ListContactsOptions{Engagement: voaaro.EngagementLow, EmailStatus: voaaro.EmailValid})
csv, _ := client.Contacts.Export(&voaaro.ExportContactsOptions{SegmentId: segmentId, Engagement: voaaro.EngagementHigh})
client.Contacts.Imports.Create(&voaaro.CreateContactImportRequest{File: data, SkipInvalid: voaaro.Bool(true)})

cURL

curl https://mail.example.com/api/v1/contacts/verify \
  -H "Authorization: Bearer $VOAARO_API_KEY" -H "Content-Type: application/json" \
  -d '{"email": "jane@gmial.com"}'

Properties

Custom fields, declared once and then usable in broadcasts ({{contact.plan}}): POST /api/v1/contact-properties with key (letters, digits, _, at most 50), type (string or number) and fallback_value (default value). Only fallback_value can be changed afterwards. Deleting a property removes its value from all contacts.

Segments

The groups to send a broadcast to: POST /api/v1/segments (name), GET /api/v1/segments/{id}/contacts, POST and DELETE /api/v1/contacts/{id}/segments/{segment} to add or remove a contact. The /api/v1/audiences routes (the former name at Resend) are still served. A segment can also be dynamic: conditions instead of a list (dynamic segments).

Topics

A topic ("Product news", "Offers") lets each contact choose what they receive. POST /api/v1/topics with name, description, default_subscription (opt_in or opt_out, set at creation) and visibility (public: shown on the contact's preferences page). A contact's choices: GET and PATCH /api/v1/contacts/{id}/topics. A broadcast linked to a topic only goes to its subscribers.

Importing a CSV file

POST /api/v1/contacts/imports as multipart/form-data: file (UTF-8 CSV, separator , or ;, at most 10 MB and 50,000 lines), and optionally column_map, on_conflict (upsert by default, or skip), segments, topics. Columns are recognized by their header. The import is processed during the request:

JSON
{ "object": "contact_import", "id": "…", "counts": { "total": 1200, "created": 1150, "updated": 40, "skipped": 0, "failed": 10 } }

GET /api/v1/contacts/imports/{id} also gives the first 20 errors (line and reason).

Each imported address is checked (each domain queried once, 20 seconds at most for the file): counts.verification gives { "valid", "risky", "invalid" }. With skip_invalid=true, invalid addresses are not imported and are counted in counts.excluded (and listed in the errors).

An import of 1,000 lines produces 1,000 contact.created (or contact.updated) webhooks per subscribed endpoint: plan for it in your application.

Limits

Per domain: 200,000 contacts, 100 segments, 50 topics, 50 properties.

Esc