Send WhatsApp messages programmatically using our REST API. Choose your programming language and message type below to get started with code examples you can copy and paste.
Quick answer
To send a WhatsApp message, POST JSON to https://quackapi.com/v1/messages/chat with an x-api-key header and the fields deviceId, to and body. A successful call returns { "success": true, "messageId": 1042, "status": "queued" }, which means the message was accepted for sending, not delivered. Machine-readable description: OpenAPI spec (JSON).
All API requests require authentication via your API key. Include the key in the x-api-key header with every request.
x-api-key: wa_your_api_key_hereYou can find your API key in your Profile Settings after logging in. Each account gets a unique API key starting with wa_.
POST https://quackapi.com/v1/messages/chatEach message type has its own endpoint under /v1/messages: chat, image, video, audio, document, link, contact and location. Every request is a JSON POST with your x-api-key header and the deviceId of a connected device.
All API responses are returned in JSON format:
// Success Response
{
"id": 42,
"deviceId": 1,
"to": "923001234567",
"content": "Hello from QuackAPI!",
"type": "text",
"status": "sent",
"createdAt": "2026-01-15T10:30:00.000Z"
}
// Error Response
{
"message": "Device not connected",
"error": "DEVICE_OFFLINE"
}Send a simple text message to any WhatsApp number.
{
"deviceId": 1,
"to": "923001234567",
"content": "Hello from QuackAPI!",
"type": "text"
}curl -X POST "https://quackapi.com/v1/messages/chat" \
-H "Content-Type: application/json" \
-H "x-api-key: wa_your_api_key_here" \
-d '{"deviceId":1,"to":"923001234567","body":"Hello from QuackAPI!"}'Configure a webhook URL for each device to receive real-time notifications. QuackAPI sends a POST request with Content-Type: application/json to your webhook URL whenever a message is received, sent, or fails. Set up your webhook URL in the device settings page after connecting your WhatsApp device.
Use the event field in the payload to determine the type of notification.
Triggered when your connected WhatsApp device receives a new message from someone. Media messages include a type prefix in the content field (e.g. [Image], [Video], [Document]) followed by the caption or filename.
{
"event": "message.received",
"deviceId": 1,
"from": "923001234567@s.whatsapp.net",
"content": "Hi there! I'd like to place an order.",
"timestamp": 1708531200,
"messageId": "BAE5F4A2C1D3E6F7"
}| Field | Type | Description |
|---|---|---|
| event | string | Always "message.received" |
| deviceId | number | The ID of your connected device that received the message |
| from | string | Sender's WhatsApp JID (phone number with @s.whatsapp.net suffix) |
| content | string | Message text content. Media messages are prefixed with type (e.g. [Image] caption) |
| timestamp | number | Unix timestamp (seconds) when the message was sent |
| messageId | string | WhatsApp's unique message identifier |
Triggered when a message you sent via the API is successfully delivered to WhatsApp.
{
"event": "message.sent",
"messageId": 42,
"to": "923001234567",
"deviceId": 1,
"status": "sent"
}| Field | Type | Description |
|---|---|---|
| event | string | Always "message.sent" |
| messageId | number | Your QuackAPI message ID (from the send API response) |
| to | string | Recipient's phone number |
| deviceId | number | The device that sent the message |
| status | string | Always "sent" |
Triggered when a message you sent via the API fails to deliver (e.g. device disconnected, invalid number).
{
"event": "message.failed",
"messageId": 42,
"to": "923001234567",
"deviceId": 1,
"error": "Device not connected"
}| Field | Type | Description |
|---|---|---|
| event | string | Always "message.failed" |
| messageId | number | Your QuackAPI message ID |
| to | string | Recipient's phone number |
| deviceId | number | The device that attempted to send |
| error | string | Human-readable error message describing why the send failed |
| Plan | Messages/Day | Devices | Rate Limit |
|---|---|---|---|
| Starter (free; 50/day during the first 30 days, then 10/day) | 50, then 10 | 1 | 10 req/min |
| Professional | 1,000 | 5 | 60 req/min |
| Enterprise | 10,000 | 50 | 300 req/min |
Dive deeper with step-by-step tutorials and guides for building with QuackAPI.