API Documentation

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).

Authentication

All API requests require authentication via your API key. Include the key in the x-api-key header with every request.

HTTP Header
x-api-key: wa_your_api_key_here

You can find your API key in your Profile Settings after logging in. Each account gets a unique API key starting with wa_.

Base URL

Base URL
POST https://quackapi.com/v1/messages/chat

Each 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.

Response Format

All API responses are returned in JSON format:

JSON Response
// 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"
}

Message Types

Text Message

Send a simple text message to any WhatsApp number.

Request Body

JSON
{
  "deviceId": 1,
  "to": "923001234567",
  "content": "Hello from QuackAPI!",
  "type": "text"
}

Code Examples

cURL
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!"}'

Webhook Events

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.

Event 1

Incoming Message Received

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.

message.received
{
  "event": "message.received",
  "deviceId": 1,
  "from": "923001234567@s.whatsapp.net",
  "content": "Hi there! I'd like to place an order.",
  "timestamp": 1708531200,
  "messageId": "BAE5F4A2C1D3E6F7"
}
FieldTypeDescription
eventstringAlways "message.received"
deviceIdnumberThe ID of your connected device that received the message
fromstringSender's WhatsApp JID (phone number with @s.whatsapp.net suffix)
contentstringMessage text content. Media messages are prefixed with type (e.g. [Image] caption)
timestampnumberUnix timestamp (seconds) when the message was sent
messageIdstringWhatsApp's unique message identifier

Event 2

Message Sent Successfully

Triggered when a message you sent via the API is successfully delivered to WhatsApp.

message.sent
{
  "event": "message.sent",
  "messageId": 42,
  "to": "923001234567",
  "deviceId": 1,
  "status": "sent"
}
FieldTypeDescription
eventstringAlways "message.sent"
messageIdnumberYour QuackAPI message ID (from the send API response)
tostringRecipient's phone number
deviceIdnumberThe device that sent the message
statusstringAlways "sent"

Event 3

Message Failed

Triggered when a message you sent via the API fails to deliver (e.g. device disconnected, invalid number).

message.failed
{
  "event": "message.failed",
  "messageId": 42,
  "to": "923001234567",
  "deviceId": 1,
  "error": "Device not connected"
}
FieldTypeDescription
eventstringAlways "message.failed"
messageIdnumberYour QuackAPI message ID
tostringRecipient's phone number
deviceIdnumberThe device that attempted to send
errorstringHuman-readable error message describing why the send failed

Rate Limits

PlanMessages/DayDevicesRate Limit
Starter (free; 50/day during the first 30 days, then 10/day)50, then 10110 req/min
Professional1,000560 req/min
Enterprise10,00050300 req/min

Learn More

Dive deeper with step-by-step tutorials and guides for building with QuackAPI.