Preview Campaign Audience
Returns the total audience size, an opt-out / undeliverable breakdown, and a 10-row sample for the audience block you would send to POST /v2.0/campaigns. Nothing is persisted — use this freely to tune filters before launching.
POST/v2.0/campaigns/preview
Authentication
Bearer token + brandNumber.
Audience modes (mutually exclusive)
Choose one of the two modes:
- Segment / tag / filter mode — pass any combination of
segmentIds,excludeSegmentIds,tags,excludeTags, andfilters. The query is the union of include segments AND-ed with extra filters, with excludes subtracted. - Raw contacts mode — pass
audience.contacts(an array of{ phone, name?, email?, custom? }). Sendiee upserts each phone into your Contact directory before counting.
Request Body
Body
| Parameter | Type | Description |
|---|---|---|
| brandNumber | string | Your WhatsApp Business phone number |
| audience.segmentIds | string[] | Include contacts matching ANY of these segments |
| audience.excludeSegmentIds | string[] | Exclude contacts matching ANY of these segments |
| audience.tags | string[] | Tag IDs — include contacts with any of these tags |
| audience.excludeTags | string[] | Tag IDs — exclude contacts with any of these tags |
| audience.filters | object | Additional filters: { source, hasEmail, optedOut, ignoreUndeliverableContacts, advancedFilters } |
| audience.contacts | object[] | Raw list { phone, name?, email?, custom? }. Mutually exclusive with the segment-mode fields above |
| audience.ignoreUndeliverable | boolean | Default true — exclude contacts marked wa_undeliverable |
Examples
By segments + tags
cURL
curl -X POST https://api.sendiee.com/v2.0/campaigns/preview \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"brandNumber": "917012345678",
"audience": {
"segmentIds": ["66a1...", "66a2..."],
"excludeTags": ["churned"],
"filters": { "optedOut": false }
}
}'By raw contacts
cURL
curl -X POST https://api.sendiee.com/v2.0/campaigns/preview \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"brandNumber": "917012345678",
"audience": {
"contacts": [
{ "phone": "919876543210", "name": "Surya" },
{ "phone": "918765432109", "name": "Ravi", "custom": { "city": "Chennai" } }
]
}
}'Response
{
"success": true,
"data": {
"mode": "segment",
"totalContacts": 1234,
"breakdown": {
"whatsappEligible": 1230,
"optedOut": 4,
"undeliverable": 0
},
"sample": [
{
"phone": "919876543210",
"name": "Surya",
"email": null,
"optedOut": false
}
],
"segmentsUsed": [
{
"id": "66a1...",
"name": "VIPs"
}
]
}
}Raw contacts are upserted on preview too
When you pass
audience.contacts, those phones are upserted into your Contact directory immediately so the count is accurate. Subsequent calls with the same list are idempotent.