Skip to main content

Broadcasts

Send mass emails to your subscribers.

Send Broadcast

Endpoint: POST /api/v1/broadcast
Authentication: Secret Key (sdk_...)

Request Parameters

FieldTypeRequiredDescription
subjectstringYesEmail subject.
templatestringYesTemplate name.
filterobjectNoFilter recipients.

Filter Recipients

{
"filter": {
"status": "confirmed", // active, pending, unsubscribed
"source": "landing_page" // Matches metadata.source
}
}
Important

Your HTML MUST include {{unsubscribe_link}}. We generate a unique URL for each user.

Example with Template

curl -X POST https://senddock.dev/api/v1/broadcast \
-H "Authorization: Bearer sdk_..." \
-H "Content-Type: application/json" \
-d '{
"subject": "Weekly News",
"template": "newsletter",
"filter": { "status": "active" }
}'

Example with Raw HTML

curl -X POST https://senddock.dev/api/v1/broadcast \
-H "Authorization: Bearer sdk_..." \
-H "Content-Type: application/json" \
-d '{
"subject": "November Updates",
"html": "<h1>Hello {{name}}!</h1><p>...</p><a href=\"{{unsubscribe_link}}\">Unsubscribe</a>",
"filter": { "status": "confirmed" }
}'

Response (202 Accepted)

{
"success": true,
"data": {
"message": "Broadcast started successfully. We are processing it in the background.",
"broadcastId": "bc_17098234_clxxx..."
}
}

Code Examples

await fetch('https://senddock.dev/api/v1/broadcast', {
method: 'POST',
headers: {
'Authorization': 'Bearer sdk_your_secret_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
template: 'weekly-digest',
subject: 'Weekly Tech News',
filter: { status: 'active' }
})
});