curl --request POST \
--url https://your-instance.example.com/api/{session}/messages/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"chatId": "1234567890@s.whatsapp.net",
"address": "San Francisco, CA",
"base64": "<string>",
"caption": "Check this out",
"filename": "photo.jpg",
"isForwarded": true,
"latitude": 37.7749,
"longitude": -122.4194,
"mentions": [
"<string>"
],
"mimeType": "image/jpeg",
"pollMultiSelect": true,
"pollOptions": [
"Red",
"Blue",
"Green"
],
"pollTitle": "What's your favorite color?",
"ptt": true,
"text": "Hello, world!",
"url": "https://example.com/image.jpg",
"vcard": "<string>"
}
EOFconst options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chatId: '1234567890@s.whatsapp.net',
address: 'San Francisco, CA',
base64: '<string>',
caption: 'Check this out',
filename: 'photo.jpg',
isForwarded: true,
latitude: 37.7749,
longitude: -122.4194,
mentions: ['<string>'],
mimeType: 'image/jpeg',
pollMultiSelect: true,
pollOptions: ['Red', 'Blue', 'Green'],
pollTitle: 'What\'s your favorite color?',
ptt: true,
text: 'Hello, world!',
url: 'https://example.com/image.jpg',
vcard: '<string>'
})
};
fetch('https://your-instance.example.com/api/{session}/messages/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://your-instance.example.com/api/{session}/messages/send"
payload = {
"chatId": "1234567890@s.whatsapp.net",
"address": "San Francisco, CA",
"base64": "<string>",
"caption": "Check this out",
"filename": "photo.jpg",
"isForwarded": True,
"latitude": 37.7749,
"longitude": -122.4194,
"mentions": ["<string>"],
"mimeType": "image/jpeg",
"pollMultiSelect": True,
"pollOptions": ["Red", "Blue", "Green"],
"pollTitle": "What's your favorite color?",
"ptt": True,
"text": "Hello, world!",
"url": "https://example.com/image.jpg",
"vcard": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/{session}/messages/send"
payload := strings.NewReader("{\n \"chatId\": \"1234567890@s.whatsapp.net\",\n \"address\": \"San Francisco, CA\",\n \"base64\": \"<string>\",\n \"caption\": \"Check this out\",\n \"filename\": \"photo.jpg\",\n \"isForwarded\": true,\n \"latitude\": 37.7749,\n \"longitude\": -122.4194,\n \"mentions\": [\n \"<string>\"\n ],\n \"mimeType\": \"image/jpeg\",\n \"pollMultiSelect\": true,\n \"pollOptions\": [\n \"Red\",\n \"Blue\",\n \"Green\"\n ],\n \"pollTitle\": \"What's your favorite color?\",\n \"ptt\": true,\n \"text\": \"Hello, world!\",\n \"url\": \"https://example.com/image.jpg\",\n \"vcard\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/{session}/messages/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chatId' => '1234567890@s.whatsapp.net',
'address' => 'San Francisco, CA',
'base64' => '<string>',
'caption' => 'Check this out',
'filename' => 'photo.jpg',
'isForwarded' => true,
'latitude' => 37.7749,
'longitude' => -122.4194,
'mentions' => [
'<string>'
],
'mimeType' => 'image/jpeg',
'pollMultiSelect' => true,
'pollOptions' => [
'Red',
'Blue',
'Green'
],
'pollTitle' => 'What\'s your favorite color?',
'ptt' => true,
'text' => 'Hello, world!',
'url' => 'https://example.com/image.jpg',
'vcard' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"fromLid": "<string>",
"fromPhoneNumber": "<string>",
"id": "<string>",
"mediaId": "<string>",
"senderLid": "<string>",
"senderPhoneNumber": "<string>",
"status": "<string>",
"timestamp": "<string>"
}{
"docs": "https://docs.polymorfa.com/api/messages/send",
"error": "missing required field: chatId"
}{
"error": "missing or invalid API key"
}{
"error": "internal server error"
}{
"docs": "<string>",
"error": "<string>"
}Send message
Sends any message type. Use the “type” field to specify: text, image, file, voice, video, poll, location, contact.
curl --request POST \
--url https://your-instance.example.com/api/{session}/messages/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"chatId": "1234567890@s.whatsapp.net",
"address": "San Francisco, CA",
"base64": "<string>",
"caption": "Check this out",
"filename": "photo.jpg",
"isForwarded": true,
"latitude": 37.7749,
"longitude": -122.4194,
"mentions": [
"<string>"
],
"mimeType": "image/jpeg",
"pollMultiSelect": true,
"pollOptions": [
"Red",
"Blue",
"Green"
],
"pollTitle": "What's your favorite color?",
"ptt": true,
"text": "Hello, world!",
"url": "https://example.com/image.jpg",
"vcard": "<string>"
}
EOFconst options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chatId: '1234567890@s.whatsapp.net',
address: 'San Francisco, CA',
base64: '<string>',
caption: 'Check this out',
filename: 'photo.jpg',
isForwarded: true,
latitude: 37.7749,
longitude: -122.4194,
mentions: ['<string>'],
mimeType: 'image/jpeg',
pollMultiSelect: true,
pollOptions: ['Red', 'Blue', 'Green'],
pollTitle: 'What\'s your favorite color?',
ptt: true,
text: 'Hello, world!',
url: 'https://example.com/image.jpg',
vcard: '<string>'
})
};
fetch('https://your-instance.example.com/api/{session}/messages/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://your-instance.example.com/api/{session}/messages/send"
payload = {
"chatId": "1234567890@s.whatsapp.net",
"address": "San Francisco, CA",
"base64": "<string>",
"caption": "Check this out",
"filename": "photo.jpg",
"isForwarded": True,
"latitude": 37.7749,
"longitude": -122.4194,
"mentions": ["<string>"],
"mimeType": "image/jpeg",
"pollMultiSelect": True,
"pollOptions": ["Red", "Blue", "Green"],
"pollTitle": "What's your favorite color?",
"ptt": True,
"text": "Hello, world!",
"url": "https://example.com/image.jpg",
"vcard": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/{session}/messages/send"
payload := strings.NewReader("{\n \"chatId\": \"1234567890@s.whatsapp.net\",\n \"address\": \"San Francisco, CA\",\n \"base64\": \"<string>\",\n \"caption\": \"Check this out\",\n \"filename\": \"photo.jpg\",\n \"isForwarded\": true,\n \"latitude\": 37.7749,\n \"longitude\": -122.4194,\n \"mentions\": [\n \"<string>\"\n ],\n \"mimeType\": \"image/jpeg\",\n \"pollMultiSelect\": true,\n \"pollOptions\": [\n \"Red\",\n \"Blue\",\n \"Green\"\n ],\n \"pollTitle\": \"What's your favorite color?\",\n \"ptt\": true,\n \"text\": \"Hello, world!\",\n \"url\": \"https://example.com/image.jpg\",\n \"vcard\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/{session}/messages/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chatId' => '1234567890@s.whatsapp.net',
'address' => 'San Francisco, CA',
'base64' => '<string>',
'caption' => 'Check this out',
'filename' => 'photo.jpg',
'isForwarded' => true,
'latitude' => 37.7749,
'longitude' => -122.4194,
'mentions' => [
'<string>'
],
'mimeType' => 'image/jpeg',
'pollMultiSelect' => true,
'pollOptions' => [
'Red',
'Blue',
'Green'
],
'pollTitle' => 'What\'s your favorite color?',
'ptt' => true,
'text' => 'Hello, world!',
'url' => 'https://example.com/image.jpg',
'vcard' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"fromLid": "<string>",
"fromPhoneNumber": "<string>",
"id": "<string>",
"mediaId": "<string>",
"senderLid": "<string>",
"senderPhoneNumber": "<string>",
"status": "<string>",
"timestamp": "<string>"
}{
"docs": "https://docs.polymorfa.com/api/messages/send",
"error": "missing required field: chatId"
}{
"error": "missing or invalid API key"
}{
"error": "internal server error"
}{
"docs": "<string>",
"error": "<string>"
}Authorizations
Scoped API key created via POST /api/account/keys.
Path Parameters
Session name
Body
Message payload
Target chat JID (e.g. "5511999@s.whatsapp.net", "120363...@g.us", or "status@broadcast")
"1234567890@s.whatsapp.net"
text, image, file, voice, video, poll, location, contact Human-readable address text (type=location)
"San Francisco, CA"
Base64-encoded media bytes (alternative to url)
Caption text for media messages (image, video, document)
"Check this out"
Original filename for document messages
"photo.jpg"
Whether the message should be marked as forwarded
Latitude coordinate in degrees (type=location)
37.7749
Longitude coordinate in degrees (type=location)
-122.4194
JIDs to mention/tag in the message text
MIME type of the media (e.g. "image/jpeg", "application/pdf")
"image/jpeg"
Whether recipients can select multiple poll options
Array of answer options for the poll
["Red", "Blue", "Green"]
Poll question text (type=poll)
"What's your favorite color?"
Whether the audio is a push-to-talk voice note (type=voice only)
Show child attributes
Show child attributes
Text content (type=text)
"Hello, world!"
HTTP(S) URL of media to send (type=image, file, voice, video)
"https://example.com/image.jpg"
vCard-formatted contact data (type=contact)
Response
OK
LID of the target chat
Phone number of the target chat (if available)
Message ID assigned by WhatsApp
Media record ID (present when message contained media)
LID of the sender (session account)
Phone number of the sender (if available)
Delivery status: pending, sent, delivered, read
When the message was accepted by WhatsApp