Endpoints
| Type | Endpoint |
|---|---|
| Image | POST /sessions/{session_id}/messages/image |
| Video | POST /sessions/{session_id}/messages/video |
| Audio | POST /sessions/{session_id}/messages/audio |
| Document | POST /sessions/{session_id}/messages/document |
https://api.wapimax.com/whatsapp/v1
Authentication
Every request must include your API key in theX-API-Key header. See Authorization to create one.
| Header | Value | Required |
|---|---|---|
X-API-Key | Your WapiMax API key | Yes |
Content-Type | application/json | Yes |
Accept | application/json | Recommended |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
session_id | string | Yes | Session used to send the message |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient ID, for example 254712345678@s.whatsapp.net |
image / video / audio / document | object | Yes | Media source, one per endpoint |
caption | string | No | Caption for image, video or document |
filename | string | No | File name, documents only |
ptt | boolean | No | Send audio as a voice note |
reply_to | string | No | ID of the message to reply to |
send_at | string | No | Scheduled send time, ISO 8601 UTC |
Media source
| Parameter | Type | Description |
|---|---|---|
url | string | Public URL of the file |
data | string | Base64 encoded file |
mimetype | string | MIME type, required with data |
Media URLs must be publicly reachable.
Request
{
"to": "254712345678@s.whatsapp.net",
"image": {
"url": "https://example.com/images/photo.jpg"
},
"caption": "Check out this photo!"
}
{
"to": "254712345678@s.whatsapp.net",
"video": {
"url": "https://example.com/videos/demo.mp4"
},
"caption": "Watch this video."
}
{
"to": "254712345678@s.whatsapp.net",
"audio": {
"url": "https://example.com/audio/recording.mp3"
},
"ptt": false
}
{
"to": "254712345678@s.whatsapp.net",
"document": {
"url": "https://example.com/files/report.pdf"
},
"filename": "report.pdf",
"caption": "Please find the report attached."
}
{
"to": "254712345678@s.whatsapp.net",
"image": {
"data": "BASE64_ENCODED_MEDIA",
"mimetype": "image/jpeg"
},
"caption": "Check out this photo!"
}
curl -X POST "https://api.wapimax.com/whatsapp/v1/sessions/YOUR_SESSION_ID/messages/image" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"to": "254712345678@s.whatsapp.net",
"image": {
"url": "https://example.com/images/photo.jpg"
},
"caption": "Check out this photo!"
}'
const body = {
to: "254712345678@s.whatsapp.net",
image: { url: "https://example.com/images/photo.jpg" },
caption: "Check out this photo!"
};
const response = await fetch("https://api.wapimax.com/whatsapp/v1/sessions/YOUR_SESSION_ID/messages/image", {
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json",
"Accept": "application/json"
},
body: JSON.stringify(body)
});
const data = await response.json();
console.log(data);
// Node.js 18 or later
const body = { to: "254712345678@s.whatsapp.net", image: { url: "https://example.com/images/photo.jpg" }, caption: "Check out this photo!" };
const response = await fetch("https://api.wapimax.com/whatsapp/v1/sessions/YOUR_SESSION_ID/messages/image", {
method: "POST",
headers: {
"X-API-Key": process.env.WAPIMAX_API_KEY,
"Content-Type": "application/json",
"Accept": "application/json"
},
body: JSON.stringify(body)
});
if (!response.ok) {
throw new Error(`Request failed with status ${response.status}`);
}
console.log(await response.json());
<?php
$body = [
"to" => "254712345678@s.whatsapp.net",
"image" => ["url" => "https://example.com/images/photo.jpg"],
"caption" => "Check out this photo!"
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wapimax.com/whatsapp/v1/sessions/YOUR_SESSION_ID/messages/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: YOUR_API_KEY",
"Content-Type: application/json",
"Accept: application/json"
],
CURLOPT_POSTFIELDS => json_encode($body)
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
body = {
"to": "254712345678@s.whatsapp.net",
"image": {"url": "https://example.com/images/photo.jpg"},
"caption": "Check out this photo!"
}
response = requests.post(
"https://api.wapimax.com/whatsapp/v1/sessions/YOUR_SESSION_ID/messages/image",
headers={
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json",
"Accept": "application/json"
},
json=body
)
print(response.json())
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String body = """
{
"to": "254712345678@s.whatsapp.net",
"image": {
"url": "https://example.com/images/photo.jpg"
},
"caption": "Check out this photo!"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.wapimax.com/whatsapp/v1/sessions/YOUR_SESSION_ID/messages/image"))
.header("X-API-Key", "YOUR_API_KEY")
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = client.send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
body := []byte(`{
"to": "254712345678@s.whatsapp.net",
"image": {
"url": "https://example.com/images/photo.jpg"
},
"caption": "Check out this photo!"
}`)
req, _ := http.NewRequest(
"POST",
"https://api.wapimax.com/whatsapp/v1/sessions/YOUR_SESSION_ID/messages/image",
bytes.NewBuffer(body),
)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
resBody, _ := io.ReadAll(resp.Body)
fmt.Println(string(resBody))
}
require "net/http"
require "uri"
require "json"
uri = URI("https://api.wapimax.com/whatsapp/v1/sessions/YOUR_SESSION_ID/messages/image")
body = {
"to" => "254712345678@s.whatsapp.net",
"image" => { "url" => "https://example.com/images/photo.jpg" },
"caption" => "Check out this photo!"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.post(uri, body, {
"X-API-Key" => "YOUR_API_KEY",
"Content-Type" => "application/json",
"Accept" => "application/json"
})
end
puts response.body
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var body = new
{
to = "254712345678@s.whatsapp.net",
image = new { url = "https://example.com/images/photo.jpg" },
caption = "Check out this photo!"
};
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", "YOUR_API_KEY");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync(
"https://api.wapimax.com/whatsapp/v1/sessions/YOUR_SESSION_ID/messages/image",
new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json")
);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}
import Foundation
let url = URL(string: "https://api.wapimax.com/whatsapp/v1/sessions/YOUR_SESSION_ID/messages/image")!
let body: [String: Any] = [
"to": "254712345678@s.whatsapp.net",
"image": ["url": "https://example.com/images/photo.jpg"],
"caption": "Check out this photo!"
]
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "X-API-Key")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("application/json", forHTTPHeaderField: "Accept")
request.httpBody = try? JSONSerialization.data(withJSONObject: body)
URLSession.shared.dataTask(with: request) { data, _, error in
if let error = error {
print(error)
return
}
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}.resume()
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
fun main() {
val body = """
{
"to": "254712345678@s.whatsapp.net",
"image": {
"url": "https://example.com/images/photo.jpg"
},
"caption": "Check out this photo!"
}
""".trimIndent()
val client = OkHttpClient()
val request = Request.Builder()
.url("https://api.wapimax.com/whatsapp/v1/sessions/YOUR_SESSION_ID/messages/image")
.post(body.toRequestBody("application/json".toMediaType()))
.addHeader("X-API-Key", "YOUR_API_KEY")
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
}
Response
{
"status": "sent",
"message_id": "3EB0C8F1A2B3C4D5E6",
"timestamp": 1794304083,
"to": "254712345678@s.whatsapp.net"
}
{
"status": "pending",
"schedule_id": "b3f1c2a4-1234-4cde-9f00-abcdef123456",
"send_at": "2026-12-01T12:00:00Z"
}
Response fields
| Field | Type | Description |
|---|---|---|
status | string | sent or pending |
message_id | string | Sent message ID |
timestamp | integer | Sent time (Unix) |
to | string | Recipient ID |
schedule_id | string | Scheduled message ID |
send_at | string | Scheduled send time |
Errors
| Status | Description |
|---|---|
| 400 | Invalid request or parameters |
| 401 | Missing or invalid API key |
| 403 | Access to this session is not allowed |
| 404 | Session or resource not found |
| 429 | Rate limit or quota exceeded |
| 503 | Session is not connected |