This guide explains how to integrate with the WhatsApp API using API keys. The API provides endpoints for sending individual and bulk WhatsApp messages, managing devices, and checking message status.
authenticated → 5. Set Default (optional)Production: https://prosendi.com/api
Development: http://localhost:8000/api
API key must be active, not expired, belong to your company, and service type whatsapp.
Example:
curl -X POST https://prosendi.com/api/whatsapp/send \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"recipient": "+22370123456", "message": "Hello World"}'
/api/whatsapp/devicesReturns devices with status: pending, qr_ready, authenticated, disconnected, error.
/api/whatsapp/devicesBody: { "name": "My WhatsApp Device" }
/api/whatsapp/devices/{id}/qrReturns qr_code and device_status.
/api/whatsapp/devices/{id}/statusReturns status and phone_number when available.
/api/whatsapp/devices/{id}/set-defaultSets chosen device as company default.
/api/whatsapp/devices/{id}Update name, is_active.
/api/whatsapp/devices/{id}Removes device and sessions.
/api/whatsapp/sendBody:
{
"recipient": "+22370123456",
"message": "Your message",
"is_group": false,
"device_id": 1
}
Returns chat_id, message_id, device_id, and quota info.
You can send a media file (image, PDF, audio, video) by providing a publicly accessible URL in the media_url field. The message is then used as the caption (optional for images/documents).
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
recipient |
string | Yes | Phone number (e.g. +22370123456) or group ID |
message |
string | No* | Text message or caption for the media. Required if media_url is omitted |
media_url |
string | No | Public URL of the file (image, document, audio, video) |
is_group |
boolean | No | true if recipient is a group |
device_id |
integer | No | Device to use; default device if omitted |
Example – send image with caption:
{
"recipient": "+22370123456",
"message": "Check out this document",
"media_url": "https://example.com/files/invoice.pdf"
}
Example – image only (optional caption):
{
"recipient": "+22370123456",
"message": "Here is the photo",
"media_url": "https://example.com/images/photo.jpg"
}
Supported formats:
The file must be publicly downloadable (HTTP/HTTPS). The server fetches the file from the URL and sends it via WhatsApp. For large files, ensure the URL is fast and stable.
cURL example (media):
curl -X POST "https://prosendi.com/api/whatsapp/send" \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"recipient": "+22370123456",
"message": "Your caption (optional)",
"media_url": "https://example.com/image.jpg"
}'
/api/whatsapp/send-bulkBody:
{
"messages": [
{ "recipient": "+22370123456", "message": "Hello" },
{ "recipient": "+22370987654", "message": "Caption", "media_url": "https://example.com/photo.jpg" }
],
"device_id": 1
}
messages can optionally include media_url (same as single send).Common codes: invalid_api_key, company_inactive, key_expired, quota_exceeded, device_not_found, device_not_ready, invalid_phone_number, message_too_long, service_type_mismatch.
HTTP: 200, 400, 401, 403, 404, 422, 429, 500, 503.
import requests
headers = {"X-API-Key": "your_api_key_here", "Content-Type": "application/json"}
requests.post("https://prosendi.com/api/whatsapp/send", json={"recipient":"+22370123456","message":"Hello"}, headers=headers)
const axios = require("axios");
axios.post(
"https://prosendi.com/api/whatsapp/send",
{ recipient: "+22370123456", message: "Hello" },
{
headers: {
"X-API-Key": "your_api_key_here",
"Content-Type": "application/json",
},
}
);
<?php
$headers = ['X-API-Key: your_api_key_here','Content-Type: application/json'];
$ch = curl_init('https://prosendi.com/api/whatsapp/send');
curl_setopt_array($ch,[CURLOPT_POST=>true,CURLOPT_HTTPHEADER=>$headers,CURLOPT_POSTFIELDS=>json_encode(['recipient'=>'+22370123456','message'=>'Hello']),CURLOPT_RETURNTRANSFER=>true]);
echo curl_exec($ch);
curl_close($ch);
API_KEY="your_api_key_here"
curl -X POST "https://prosendi.com/api/whatsapp/send" -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" -d '{"recipient":"+22370123456","message":"Hello"}'
Support: [email protected]
Version 1.0.0 – Initial release, device management, quota, error handling.