Broadcasting to a list from your API
A broadcast normally goes to a segment of contacts stored in Postrun. If your own system already decides who should get a campaign, point a segment at an API instead and let that API do the filtering. When the broadcast starts sending, Postrun reads your API, saves everyone it returns as a contact, and sends to them.
Setting it up
On Audience → Segments, give the segment a name and an API URL, and a bearer token if your API needs one. Then attach the segment to a broadcast and schedule it like any other.
What your API must answer
Postrun calls your URL with GET, sending Authorization: Bearer <token>
when you gave one:
GET https://example.com/audience
GET https://example.com/audience?cursor=page2
Answer each call with 200 and a JSON page:
{
"contacts": [
{ "email": "ada@example.com", "first_name": "Ada", "last_name": "Lovelace",
"properties": { "plan": "pro" } }
],
"next": "page2"
}
emailis required. Everything else is optional. A field you leave out keeps whatever Postrun already holds for that contact.propertiesare the merge fields your template uses, as{{plan}}.nextis sent back as?cursor=to get the following page. Leave it empty or out on the last page.
When the list is read
The list is read once, when the broadcast starts sending. For a scheduled broadcast, that is the scheduled time, not the moment you pressed Schedule. That list is fixed for the rest of that broadcast, so changes on your side while it sends cannot mail anyone twice. The next broadcast reads the list again.
Opt-outs are still respected
Postrun skips anyone who has unsubscribed, opted out of the broadcast’s topic, bounced or complained, even when your API returns them. Reading your list updates names and merge fields only. It never re-subscribes anybody.
If someone opts out on your side rather than through Postrun’s link, stop returning them from your API.
When something goes wrong
If your API cannot be reached, answers anything but 2xx, or returns JSON in
another shape, the broadcast pauses before sending anything and shows what
went wrong. Fix the API and press Resume. The list is then read again.
Your API must be on the public internet. Addresses inside private networks are refused, and redirects are not followed. Every recipient becomes a contact, so the list counts toward your plan’s contact allowance.