Batch Send Messages
The batch endpoint lets you send 1 to 100 messages from one sender number (phone_number_id) in a single HTTP request. Each item in the messages array is an object { "idempotency_key"?: "<=256 chars", "message": { ... } }, where message uses the exact same request body format as a single send (POST /v1/{phone_number_id}/messages).
Endpoint
Section titled “Endpoint”POST /v1/{phone_number_id}/messages/batchAuthorization: Bearer YOUR_API_KEYContent-Type: application/jsonRequest Example
Section titled “Request Example”{ "messages": [ { "idempotency_key": "order-1001-confirm", "message": { "messaging_product": "whatsapp", "to": "6281234567890", "type": "template", "template": { "name": "order_confirmation", "language": { "code": "id" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "Budi" }, { "type": "text", "text": "INV-1001" } ] } ] } } }, { "message": { "messaging_product": "whatsapp", "to": "6289876543210", "type": "template", "template": { "name": "order_confirmation", "language": { "code": "id" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "Siti" }, { "type": "text", "text": "INV-1002" } ] } ] } } } ]}Response Example
Section titled “Response Example”The server returns 202 Accepted whenever the batch envelope is valid (1–100 items), even if some or all individual items are rejected.
{ "messaging_product": "whatsapp", "accepted": 1, "rejected": 1, "results": [ { "index": 0, "to": "6281234567890", "status": "accepted", "id": "msg_01933c8a-7f2b-7d10-8a31-91b2c3d4e5f6", "idempotent_replayed": false }, { "index": 1, "to": "6289876543210", "status": "rejected", "idempotent_replayed": false, "error": { "code": 400, "error": "validation_error", "message": "Template 'order_confirmation' is not approved" } } ]}Response Fields
Section titled “Response Fields”| Field | Type | Description |
|---|---|---|
messaging_product | string | Always "whatsapp" |
accepted | number | Number of items accepted and queued for delivery |
rejected | number | Number of items that failed validation or were rejected |
results[] | array | Per-item results in the same order as the request array |
results[].index | number | 0-based index in the request messages array |
results[].to | string | Recipient phone number for that item |
results[].status | string | "accepted" or "rejected" |
results[].id | string | Message ID (msg_<uuid>), present only when status is "accepted" |
results[].idempotent_replayed | boolean | Always present. true if the item’s idempotency_key matched a previous send, otherwise false (also on rejected items) |
results[].error | object | { code, error, message }, present only when status is "rejected" (code is the HTTP status number, error is the snake_case error slug such as "validation_error" or "payment_required", and message is the public error message) |
Rules and Limits
Section titled “Rules and Limits”- Batch size: Minimum 1 item and maximum 100 items per request. An empty batch (
[]) or more than 100 items returns400 Bad Request. - JSON parsing: A request body that is not valid JSON or has a structurally invalid item is rejected as a whole with
400 Bad Request(per-item results cover checks after parsing). - Payload size: Keep the HTTP request body under 2 MB.
- Independent items: Each item is evaluated independently. If item 3 fails validation or lacks balance, the remaining valid items are still accepted and queued.
- Per-item idempotency: Pass
idempotency_key(up to 256 characters) on the item wrapper object (messages[i].idempotency_key) to safely retry without duplicate sends. - Billing, queueing, and send limits: Every
accepteditem reserves balance, enters the outbound queue, respects the Meta daily recipient limit and frequency cap, and emits per-message status webhooks (message.status.sent,delivered,read,failed) identically to single sends.
When to Use Batch vs Campaigns
Section titled “When to Use Batch vs Campaigns”| Use Case | Use Batch API | Use Portal Campaigns |
|---|---|---|
| Transactional triggers from your backend / ERP / CRM | Yes | No |
| Scheduled broadcasts or large audiences (thousands–millions of contacts) | No | Yes |
Per-message idempotency and immediate msg_<uuid> responses | Yes | No |
| CSV contact lists and campaign progress tracking in app.mahadata.io | No | Yes |