Create Broadcast
/v1/broadcastsCreate a broadcast (bulk template send). Returns 202 — by the time the response comes back, nothing has been sent yet: the platform advances the actual sending one message at a time, throttled to its send rate.
Send Authorization: Bearer <API_KEY> in the request headers, with scope messages:send. Which resources an API Key can reach is determined by its current authorization scope.
Request
Base URL: https://api.bluehola.com
Parameters
| Name | In | Required | Type / constraints | Description |
|---|---|---|---|---|
Idempotency-Key | header | No | string, ≤200 characters | Campaign-level idempotency key. The same key with the same request body returns the original campaign (replayed: true); the same key with a different request body returns 409 IDEMPOTENCY_CONFLICT; ignored when dryRun is set. A longer key returns 400 VALIDATION_FAILED |
Request body
A request body is required.
Request body fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | A human-readable campaign name, e.g. "Singles' Day Warm-up" |
phoneNumberId | string | Yes | The sending number, pn_... |
template | object | Yes | { name, language: { code }, components? }; a campaign sends exactly one template |
recipients | array | Yes | [{ to?, toUserId?, variables?, reference? }], at most 20000 entries; provide a phone (to) or BSUID (toUserId), with phone taking precedence; variables override template.components; reference is correlation data (1–200 characters), not a deduplication key, returned in Recipient Details |
scheduledAt | ISO 8601 | No | Dispatch starts only once this time is reached; omit it to start immediately |
dryRun | boolean | No | true validates and estimates cost only, without persisting anything |
Content-Type: application/json
Example:
{
"name": "Singles' Day Warm-up",
"phoneNumberId": "<YOUR_PHONE_NUMBER_ID>",
"template": {
"name": "promo_v1",
"language": {
"code": "zh_CN"
}
},
"recipients": [
{
"to": "8613800138000",
"reference": "crm-10001"
},
{
"toUserId": "US.13491208655302741918",
"reference": "crm-10002",
"variables": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Zhang San"
}
]
}
]
}
]
}
Schema:
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "string · required — a human-readable campaign name, e.g. \"Singles' Day Warm-up\""
},
"phoneNumberId": {
"type": "string",
"description": "string · required — the sending number, pn_..."
},
"template": {
"type": "string",
"description": "object · required — { name, language: { code }, components? }; a campaign sends exactly one template"
},
"recipients": {
"type": "array",
"minItems": 1,
"maxItems": 20000,
"description": "Provide to (phone) or toUserId (BSUID); phone wins when both are supplied.",
"items": {
"type": "object",
"additionalProperties": false,
"anyOf": [{ "required": ["to"] }, { "required": ["toUserId"] }],
"properties": {
"to": { "type": "string", "minLength": 1 },
"toUserId": { "type": "string", "minLength": 1 },
"variables": { "type": "array", "items": { "type": "object" } },
"reference": { "type": "string", "minLength": 1, "maxLength": 200 }
}
}
},
"scheduledAt": {
"type": "string",
"description": "ISO 8601 · optional — dispatch starts only once this time is reached; omit it to start immediately"
},
"dryRun": {
"type": "string",
"description": "boolean · optional — true validates and estimates cost only, without persisting anything"
}
},
"required": [
"name",
"phoneNumberId",
"template",
"recipients"
],
"example": {
"name": "Singles' Day Warm-up",
"phoneNumberId": "<YOUR_PHONE_NUMBER_ID>",
"template": {
"name": "promo_v1",
"language": {
"code": "zh_CN"
}
},
"recipients": [
{
"to": "8613800138000",
"reference": "crm-10001"
},
{
"toUserId": "US.13491208655302741918",
"reference": "crm-10002",
"variables": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Zhang San"
}
]
}
]
}
]
}
}
Response
| Status | Description |
|---|---|
202 | Accepted |
4xx | Client error |
For the common error envelope and how to handle it, see Error Codes.
Notes
How this differs from looping your own calls to POST /v1/messages
Throttling, de-duplication, resuming after a mid-run outage, and cost pre-checks all happen on the platform side. The Cloud API defaults to 80 msg/s per number (1000 after an upgrade; only 20 for numbers that coexist with the WhatsApp Business app), returning 130429 if you exceed it; the platform paces itself at "N messages per round, one round per second", roughly 50 msg/s by default.
Four things that happen at creation
-
The template is validated exactly once: not yet approved, or not present under the WABA that owns this number → an immediate 404/409, rather than turning into tens of thousands of failed recipients.
-
Effective identities are de-duplicated: normalize phone numbers (
+86 133…,86133…, spaces and hyphens), or compare full BSUID strings exactly. Keep the first entry's variables andreference. The response'ssubmitted/accepted/duplicatesare the submitted, persisted and duplicate counts. When both identities are supplied, only the phone is used; the ignored BSUID is not treated as an alias. The platform cannot infer that separate phone-only and BSUID-only entries are the same Contact: de-duplicate by Contact in your audience before submitting.referenceis not a deduplication key. -
Invalid identities each get a reason: phone entries use
{ to, reason }(empty / not_a_number / length_out_of_range); BSUID entries use{ toUserId, reason: "invalid_bsuid" }. If no valid recipients remain, creation returns400 VALIDATION_FAILED. Format validation does not check WhatsApp registration, and an invalid supplied phone never falls back to BSUID. -
Cost is pre-checked: each de-duplicated recipient is priced from your rate card by market, at the highest rate that can apply — so the estimate is an upper bound on what the campaign will actually cost. Recipients that cannot be priced (for example a market missing from the rate card) are counted at a flat fallback estimate. The same estimate is returned as
estimatedCostMinorwithdryRun: true, and is what each message reserves when it is sent. If the account balance can't cover the whole campaign, it returns402 INSUFFICIENT_FUNDSright away, rather than sending half of it and stopping; if the customer budget can't, it returns402 CUSTOMER_BUDGET_EXCEEDED.The
INSUFFICIENT_FUNDSdetails arerequiredMinor/availableMinor, the authoritativerequiredMicros/availableMicros,currency,recipients, andpricedRecipients/fallbackRecipients/fallbackEstimateMinor. IffallbackRecipientsis not 0, check the rate card before topping up: those recipients were counted at the fallback estimate, which is usually far higher than the real price.
BSUID restrictions and Business Portfolio scope
Provide to or toUserId on each recipient. When both are present, the phone wins and only the identity actually used is persisted (toNumber or toUserId in recipient details, with the other null). Use the full BSUID, including its country prefix and periods; do not put it in to.
One-tap / zero-tap / copy-code authentication templates and templates with Max Price cannot target BSUIDs. If any accepted recipient actually uses a BSUID, creation rejects the entire campaign with 400 VALIDATION_FAILED, including dryRun, before storing the campaign or recipients. Supplying a phone as well uses the phone and is not blocked by this rule.
A regular BSUID is scoped to one Business Portfolio: select a sending phone owned by that Portfolio. Parent BSUIDs (CC.ENT.id) work only across the Portfolios Meta enrolled in that parent scope. Scope cannot be verified from the BSUID string locally; dryRun and 202 acceptance do not guarantee deliverability. Meta rejects a mismatched scope; the platform never switches sending numbers or falls back to a phone. Inspect dispatch errorCode / errorMessage or delivery.errorCode / delivery.errorMessage in Recipient Details, and Message Details for the full native Meta error. No fixed numeric scope-mismatch error code is promised.
BSUID-only recipients have no phone for market pricing and use the existing unpriced-recipient fallback estimate for the pre-check and reservation; the BSUID country prefix is not a phone pricing market. Existing authorization, opt-out, cooldown, pacing, balance, customer budget and idempotency rules still apply.
Warnings are worth reading
warnings does not block creation, but each one genuinely affects the delivery outcome:
- The recipient count exceeds the Business Portfolio's message cap for the number used (a new combination gets only 250 unique users/24h, shared across every number under that combination); the excess will be rejected by Meta;
- The platform doesn't know the current limit tier locally (it hasn't been synced) — ask BlueMedia support to refresh the number from Meta;
- A MARKETING template sent to a +1 number: WhatsApp does not deliver marketing templates to US numbers (Canada is also +1 and the platform cannot tell them apart locally, so it only warns rather than silently dropping them);
- MARKETING templates are subject to a per-person frequency cap; recipients over the limit fail with 131049 and cannot be retried within 24 hours (the platform does not automatically retry this kind of failure);
- Sending large volumes of marketing messages while a number's quality rating is YELLOW/RED will push the rating down further and may trigger a lower limit.
Idempotency
- Campaign level: with an
Idempotency-Keyheader, one key creates at most one campaign. Repeating the POST (same key, same request body) returns the original campaign withreplayed: truein the response, andsubmitted/accepted/warningsand the other counts are the results of the original request. The same key with a different request body returns409 IDEMPOTENCY_CONFLICT. Replay happens before the balance and template checks, so a retry does not get a402even after the original campaign has spent the balance. Concurrent requests with the same key persist only one campaign. Without this header, repeating the POST creates two campaigns. - When the outcome is unknown: if the create request timed out and you do not know whether the campaign was created, query
GET /v1/broadcasts?idempotencyKey=<the same key>. Do not guess by name or time, and do not create it again with a new key. - Recipient level: each recipient's message uses a fixed idempotency key,
bcast:<recipientId>, so a restart of the dispatch process cannot send the same person a duplicate.