Installing
pip install voaaroVersion 0.4.0. Python 3.9 or later, no dependencies (standard library), typed (py.typed, checked with mypy --strict).
Configuring
Like resend-python, at module level:
import os
import voaaro
voaaro.api_key = os.environ["VOAARO_API_KEY"]
voaaro.base_url = "https://mail.example.com"or with a client (several instances, adjustable timeout, 30 seconds by default):
client = voaaro.Voaaro(api_key=os.environ["VOAARO_API_KEY"], base_url="https://mail.example.com", timeout=30, max_retries=2)
client.emails.send({...})Without arguments, Voaaro() reads VOAARO_API_KEY and VOAARO_BASE_URL. The key never appears in repr(client) or in error messages.
Sending
email = voaaro.Emails.send(
{
"from": "Acme <notifications@example.com>",
"to": ["client@example.org"],
"subject": "Welcome",
"html": "<p>Your account is ready.</p>",
"attachments": [{"filename": "guide.pdf", "content": pdf_bytes}], # bytes encoded by the SDK
},
{"idempotency_key": "welcome-42"},
)
print(email["id"])Retries and idempotency
- A request is retried up to
max_retriestimes (2 by default, on the client orvoaaro.max_retries) after a network error or a timeout, a429 rate_limit_exceededor a 500, 502, 503, 504; never afterdaily_quota_exceedednor another4xxerror. Wait:Retry-After(60 seconds at most), otherwise 0.5 s × 2^n with jitter, 8 seconds at most. - Each
POSTgoes out with anIdempotency-Key: yours ({"idempotency_key": …}as the last argument), otherwise a UUID v4 drawn by the SDK, the same on each attempt. max_retries=0: no retry, and no key drawn.sleep=replacestime.sleepbetween two attempts (fast tests).VoaaroError.retry_aftergives the delay asked for by the service.
Pagination
Each cursor list has its generator …_all, lazy (one page at a time):
for c in voaaro.Contacts.list_all({"segment_id": segment_id, "unsubscribed": False}):
print(c["email"])
ids = [s["id"] for s in client.suppressions.list_all({"reason": "bounce"})]| List | Generator |
|---|---|
X.list(params) | X.list_all(params): Emails, Emails.Receiving, ApiKeys, Domains, Suppressions, Webhooks, Contacts, Contacts.Imports, Segments, Audiences, Topics, ContactProperties, Broadcasts, Forms, NewsletterTemplates, Automations |
X.list(id, params) | X.list_all(id, params): Contacts.Segments, Audiences.Contacts, Webhooks.deliveries |
Emails.events, Segments.list_contacts, Broadcasts.recipients, Forms.signups, Automations.runs | events_all, list_contacts_all, recipients_all, signups_all, runs_all |
Pages of 100 (or the limit given); an after given is the starting point, before is refused.
The rest
voaaro.Batch.send([...], {"batch_validation": "permissive"})
voaaro.Emails.get(email_id)
voaaro.Emails.list({"limit": 20})
voaaro.Emails.update({"id": email_id, "scheduled_at": "in 2 hours"})
voaaro.Emails.cancel(email_id)
voaaro.Emails.events({"type": "bounced", "created_after": "2026-11-01T00:00:00Z"})
voaaro.Emails.Receiving.list({"limit": 10}) # personal key with receiving
voaaro.Domains.create({"name": "notify.example.com"})
voaaro.Suppressions.add({"email": "former.customer@example.org", "domain": "example.com"})
voaaro.ApiKeys.create({"name": "CI", "permission": "sending_access"})
voaaro.Contacts.create({"email": "ada@example.org", "first_name": "Ada"})
voaaro.Broadcasts.create({"segment_id": segment_id, "from": sender, "subject": subject, "html": html, "send": True})Resources: Emails (with Attachments and Receiving), Batch, ApiKeys, Domains, Suppressions, Contacts, Segments, Audiences, Topics, ContactProperties, Broadcasts, Newsletter, Forms, NewsletterTemplates, Automations, Events, Webhooks, Organizations (operator key mko_…); on a client, the same in lowercase (client.emails, client.api_keys, client.newsletter_templates…).
Newsletters
voaaro.Newsletter.update_settings({"from": "Acme <news@example.com>", "postal_address": "Acme\n12 Lilac Street\nSpringfield"})
o = voaaro.Newsletter.overview({"days": 30})
f = voaaro.Forms.create({"name": "Website newsletter", "double_opt_in": True, "segment_ids": [segment_id]})
voaaro.Segments.preview({"filter": {"match": "all", "conditions": [{"field": "opened", "op": "none", "days": 90}]}})
voaaro.Broadcasts.links(broadcast_id)
voaaro.Broadcasts.choose_winner(broadcast_id, "b")
csv_text = voaaro.Broadcasts.export(broadcast_id)
t = voaaro.NewsletterTemplates.create({"name": "Monthly letter", "subject": "What's new", "html": html})
voaaro.Automations.create({"name": "After purchase", "trigger": {"type": "event", "event": "purchase"}, "steps": steps, "status": "active"})
voaaro.Events.send({"email": "ada@example.org", "name": "purchase", "data": {"total": 42}})
voaaro.Contacts.cleanup({"days": 180}) # simulation; "dry_run": False to actRoute details: Newsletters. Give "domain" when the key covers several domains.
Subscribing and unsubscribing from your application (server: Newsletter.subscribe, unsubscribe, get_subscription; browser: PublicForm, solve_challenge), campaign scheduling (Broadcasts.schedule, unschedule, send_now, list_scheduled, check): see the guides Your own signup form, Unsubscribing from your application and Scheduling a campaign, with examples for each SDK.
Contact quality and deliverability: verifying an address without storing it (Contacts.verify_email) or a contact's address (Contacts.reverify), engagement and address status filters (engagement, email_status), CSV export (Contacts.export), importing without invalid addresses (skip_invalid) and a broadcast's deliverability score (Broadcasts.deliverability): see Contacts, segments and topics and Broadcasts, with examples for each SDK.
Errors
try:
voaaro.Emails.send(params)
except voaaro.RateLimitError as e:
print("later", e.retry_after)
except voaaro.ValidationError as e:
print("request to fix", e)
except voaaro.VoaaroError as e:
print(e)Webhooks
event = voaaro.Webhooks.verify(request.get_data(), request.headers, os.environ["VOAARO_WEBHOOK_SECRET"])Raises voaaro.WebhookVerificationError if the signature is wrong or too old (5 minutes). Several secrets: pass a list [new, old] instead of one secret (an empty secret is ignored); the notification is accepted if one of them matches one of the header's v1. Full example and rotation: Signature.
Managing endpoints (details):
w = voaaro.Webhooks.create({"endpoint": "https://app.example.com/webhooks/voaaro", "events": ["email.bounced"]})
w["signing_secret"] # shown only once
voaaro.Webhooks.rotate_secret(w["id"], {"grace_hours": 24})
for d in voaaro.Webhooks.deliveries.list_all(w["id"], {"status": "failed"}):
voaaro.Webhooks.deliveries.replay(w["id"], d["id"])