Send a WhatsApp message with cURL
The fastest way to try the API: one command in your terminal. Copy it, replace your API key and instance id, and your first WhatsApp message is on its way.
Before you start
- Create a free account and copy your API key from Settings.
- Add a WhatsApp number and scan the QR code; copy its instance id.
- Replace
YOUR_API_KEYandYOUR_INSTANCE_IDin the examples below.
1. Setup
# cURL is preinstalled on macOS, Linux and Windows 10+
2. Send a WhatsApp text message with cURL
The recipient goes in to with the country code (for India, 91 followed by the 10-digit number). The response contains the message id and status.
send_text
curl -X POST "https://powerapiwa.com/api/v1/instances/YOUR_INSTANCE_ID/send" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "919876543210", "type": "text", "message": "Hello from cURL π"}'
3. Send an image, PDF or location
Change the type: media_url for files from a URL, media for base64 uploads, location, poll or contact.
send_media
curl -X POST "https://powerapiwa.com/api/v1/instances/YOUR_INSTANCE_ID/send" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "919876543210", "type": "location", "latitude": 12.9716, "longitude": 77.5946, "description": "Our store"}'
Response and errors
Successful calls return {"success": true, ...}. Errors return {"success": false, "error": "..."} with a status code: 401 invalid key, 402 plan expired, 422 invalid payload, 429 daily limit reached. See the full API documentation.