Create Broadcast
Create a new broadcast. A broadcast is one message sent to a segment of contacts. Unless you pass send: true, the broadcast is created as a draft; call Send Broadcast to deliver it.
/broadcastsRequires an API key with broadcasts:write permission.
Body Parameters
segment_idstringThe segment ID (UUID) of contacts to send this broadcast to. You may use
audience_id as a legacy alias; provide at least one of these fields. If
both are given, segment_id takes precedence.
audience_idstringLegacy alias for segment_id.
fromstringrequiredSender email address. Use "Name <email@example.com>" format for a friendly name.
subjectstringrequiredEmail subject.
htmlstringHTML content of the broadcast. Either html or text is required.
textstringPlain text content of the broadcast. Either html or text is required.
reply_tostring | string[]Reply-to email address(es).
namestringA friendly internal name for the broadcast (not visible to recipients).
topic_idstringOptional topic ID (UUID) to scope the broadcast. Only contacts subscribed to this topic will receive it.
preview_textstringInbox preview text.
sendbooleanSet to true to send right after creation, or to schedule it when scheduled_at is also given. The key then needs both
broadcasts:write and broadcasts:send; without broadcasts:send the
request fails and no draft is created.
scheduled_atstringNatural language date or ISO 8601 timestamp for sending later. Only valid
with send: true.
Response Fields
idstringThe ID of the newly created broadcast.
curl -X POST 'https://api.postflare.dev/broadcasts' \
-H 'Authorization: Bearer sk_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"segment_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"from": "Acme <newsletter@acme.com>",
"subject": "Our Monthly Newsletter",
"html": "<p>Hello!</p>",
"name": "April Newsletter"
}'const response = await fetch('https://api.postflare.dev/broadcasts', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_xxxxxxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
segment_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
from: 'Acme <newsletter@acme.com>',
subject: 'Our Monthly Newsletter',
html: '<p>Hello!</p>',
name: 'April Newsletter',
}),
});
const data = await response.json();Response
{
"id": "d4e5f6a7-b8c9-0123-defa-234567890123"
}