Quick Use
client.audiences.create({name})to make a listclient.contacts.create({audience_id, email, ...})per signupclient.broadcasts.create + sendto ship a campaign with auto-unsubscribe
Intro
Resend Audiences is the list-management API — your agent adds recipients on signup, removes them on unsubscribe, segments by tag, and ships compliant unsubscribe links automatically. No separate ESP, no list-import CSV nightmare. Best for: AI agents that nurture leads, newsletter signup flows, onboarding sequences with per-stage list membership, anywhere your agent needs to send to a managed group. Works with: Resend Node + Python SDKs, REST. Setup time: 5 minutes.
Create an audience
from resend import Resend
client = Resend(api_key=os.environ["RESEND_API_KEY"])
audience = client.audiences.create({"name": "TokRepo Weekly Digest"})
print(audience["id"]) # save this — used for all member opsAdd a contact
client.contacts.create({
"audience_id": audience_id,
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Smith",
"unsubscribed": False,
})Bulk import on signup
async def on_user_signup(user):
client.contacts.create({
"audience_id": WEEKLY_DIGEST_ID,
"email": user.email,
"first_name": user.first_name,
"unsubscribed": False,
})
# If user opted into multiple lists, repeat per audience_idSend a broadcast to an audience
broadcast = client.broadcasts.create({
"audience_id": WEEKLY_DIGEST_ID,
"from": "TokRepo Weekly <weekly@tokrepo.com>",
"subject": "5 new AI assets shipped this week",
"html": render_weekly_digest_html(this_week_assets),
"scheduled_at": "in 1 hour", # or "2026-05-12 09:00:00 -0700"
})
client.broadcasts.send(broadcast["id"])Compliance: unsubscribe + RFC 8058
Resend automatically:
- Adds a one-click unsubscribe link to every broadcast email
- Includes
List-UnsubscribeandList-Unsubscribe-Postheaders (Gmail/Yahoo 2024 sender requirements) - Records unsubscribes against the contact — future sends skip them
# Manually unsubscribe (e.g., from a user-facing preference center)
client.contacts.update({
"audience_id": WEEKLY_DIGEST_ID,
"email": "jane@example.com",
"unsubscribed": True,
})List members
contacts = client.contacts.list({"audience_id": WEEKLY_DIGEST_ID})
for c in contacts["data"]:
print(c["email"], c["unsubscribed"])FAQ
Q: Can I do tag-based segmentation? A: Yes — contacts support arbitrary tag fields. Filter at send time by tag value to create dynamic segments. Use a separate audience per major list type, then tags for sub-segmentation.
Q: How does Audiences compare to Klaviyo / Mailchimp? A: Audiences is a primitive — list + send + unsubscribe + compliance. Klaviyo/Mailchimp layer on visual campaign builders, automations, predictive segments. For AI-agent-driven lists where the agent IS the segmentation engine, Audiences is the right size.
Q: What about double opt-in?
A: Not built in — Resend assumes you've collected consent before adding. Implement double opt-in by sending a confirm-email through emails.send with a token URL, and only call contacts.create after the recipient clicks confirm.
Source & Thanks
Built by Resend. Audiences API docs at resend.com/docs/api-reference/audiences.
resend/resend-node — official SDK