Send from a linked WhatsApp number
/v1/whatsapp-connect/send Scopewhatsapp_connect:send
Queues a message sent from one of your own WhatsApp numbers, linked by QR code under Dashboard → Plugins → WhatsApp Connect. Requires the plugin to be active.
- Omit
deviceIdto let any connected device send it (messages rotate across devices); pass one to pin it. - Devices pace themselves (
sendIntervalSecondsplus jitter) and stop at their daily limit, so a message may wait inqueued. Messages no device sends within 24 hours expire and are not charged. - Numbers that are not on WhatsApp end as
rejected(not charged). - Attach
mediato send an image, video or document withtextas its caption. - Groups: pass
groupIdinstead ofto(fromGET /whatsapp-connect/groups). The message goes out from a linked number that is in the group (the one you pin withdeviceId, if any); groups where only admins may post need that number to be an admin. - Test keys: no device is used; messages are reported delivered after a moment. Numbers ending in
0000are reported as not on WhatsApp.
WhatsApp Connect uses the WhatsApp Web protocol, not the official WhatsApp Business API: numbers that send unsolicited messages can be banned by WhatsApp.
Parameters1
Idempotency-KeyheaderstringMakes the request safe to retry: repeating it with the same key and body returns the original result (with
Idempotent-Replayed: true) instead of sending again. Use one key per logical message, e.g. derived from your order or login-attempt ID. Reusing a key with a different body is409 IDEMPOTENCY_KEY_REUSED.
Body7
tostringRecipient in international format.
groupIdstringA WhatsApp group one of your linked numbers is in, from
GET /whatsapp-connect/groups. The message is sent from a device that is a member.textstringrequiredThe message (or caption). Personalise with
{{name}}placeholders, or{{name|fallback}}to use a fallback when the value is missing.variablesobjectValues for the placeholders, by name. Extra values are ignored.
mediaWaMediaA file sent with the message;
textbecomes its caption (max 1024 characters). SMS21 downloads it from a public https URL when the message is sent (no redirects).3 nested fields
typestringrequiredimage: JPEG, PNG or WebP · video: MP4 or 3GPP · document: any file but HTML.
imagevideodocumenturlstring (uri)requiredfilenamestringDocuments: the name the recipient sees.
deviceIdstringSend from this linked device. Omit to use any connected device (rotation).
typestringPricing category.
transactionalpromotional
Responses
- 202
Accepted and queued for a device.
- 400
Invalid request, recipient, placeholder values or media URL.
Example
Response 400{ "success": false, "error": { "code": "INVALID_RECIPIENT", "message": "The recipient is not a valid mobile number", "details": [ { "field": "to", "message": "to must be a mobile number in international format, e.g. 919876543210" } ] }, "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d" } - 401
The API key is missing, malformed, unknown, revoked or expired.
Example
Response 401{ "success": false, "error": { "code": "AUTHENTICATION_REQUIRED", "message": "An API key is required; send it in the X-API-Key header or as \"Authorization: Bearer <key>\"" }, "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d" } - 402
Live keys only: the wallet cannot cover the message. Add funds; retrying will not help.
Example
Response 402{ "success": false, "error": { "code": "INSUFFICIENT_BALANCE", "message": "Insufficient wallet balance" }, "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d" } - 403
The plugin is not active, or the key lacks the scope.
Example
Response 403{ "success": false, "error": { "code": "PLUGIN_NOT_ACTIVE", "message": "WhatsApp Connect is not activated for this company; activate it under Plugins" }, "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d" } - 404
The device does not exist in this company.
Example
Response 404{ "success": false, "error": { "code": "NOT_FOUND", "message": "Device not found" }, "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d" } - 409
Conflicting state.
Example
Response 409{ "success": false, "error": { "code": "IDEMPOTENCY_KEY_REUSED", "message": "This Idempotency-Key was already used with a different request" }, "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d" } - 429
Rate limited. Wait
Retry-Afterseconds, then retry with the same Idempotency-Key.Example
Response 429{ "success": false, "error": { "code": "RATE_LIMITED", "message": "Rate limit exceeded for this API key" }, "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d" } - 503
Temporarily unavailable, or live sending paused by SMS21. Retry later with the same Idempotency-Key.
Example
Response 503{ "success": false, "error": { "code": "SERVICE_UNAVAILABLE", "message": "Service temporarily unavailable" }, "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d" }
curl -X POST "https://sms21.in/v1/whatsapp-connect/send" \
-H "X-API-Key: $SMS21_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"919876543210","text":"Hi {{name|there}}, your order {{order}} has shipped.","variables":{"name":"Asha","order":"A-1042"}}'{
"success": true,
"messageId": "msg_01k55q8y4m3d9v7x2c6b0n1r8t",
"status": "queued",
"channel": "whatsapp_connect",
"type": "transactional",
"environment": "live",
"to": "919876543210",
"templateId": null,
"whatsappTemplateId": null,
"segments": 1,
"encoding": "gsm7",
"failure": null,
"queuedAt": "2026-09-15T10:30:00.000Z",
"submittedAt": null,
"sentAt": null,
"deliveredAt": null,
"failedAt": null
}