api docs
Send Text Message
Send a plain text WhatsApp message to a single recipient via the WhatAPI REST API.
Send Text Message
Send a plain text WhatsApp message to a single recipient.
Scope: `send_text` | Method: `POST`
POST /api/v1/messages/send
Request Body
ParameterTypeRequiredDescription
tostringYesRecipient phone number with country code (e.g. `923001234567`)messagestringYesThe body text content of the messagesession_idstringNoOverrides the default assigned WhatsApp sessionExample Request
curl -X POST "https://whatapi.pk/api/v1/messages/send" \
-H "Authorization: Bearer whatapi_live_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"to": "923001234567",
"message": "Hello from Whatapi!"
}'fetch("https://whatapi.pk/api/v1/messages/send", {
method: "POST",
headers: {
"Authorization": "Bearer whatapi_live_your_api_key_here",
"Content-Type": "application/json"
},
body: JSON.stringify({
to: "923001234567",
message: "Hello from Whatapi!"
})
})
.then(res => res.json())
.then(data => console.log(data));Response
{
"success": true,
"message_id": "gBGGK2Lx8K5X7J",
"to": "923001234567",
"session": "session-uuid",
"timestamp": "2026-07-02T12:00:00.000Z"
}Authorization Flow
- Extract API key from `Authorization: Bearer` header
- Look up key in Firestore `api_keys` collection
- Verify key is `active` and not expired
- Check key has `send_text` scope
- Check and decrement daily rate limit
- Resolve WhatsApp session (from `session_id` param or user's default)
- Send message via OpenWA backend
- Log the API call and increment counters
