Endpoint
Base URL
https://api.wapimax.com/whatsapp/v1
| Method | Path | Delivers to |
|---|---|---|
| POST | /sessions/{session_id}/messages/text | Contacts and groups |
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 | ID of the session |
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Phone number or group ID. |
text | string | Yes | Message text |
Recipients
| Recipient | to format | Example |
|---|---|---|
| Contact | Phone number | 254712345678 |
| Group | Group ID | 12036301235678901@g.us |
{
"to": "254712345678",
"text": "Hello! Welcome to WapiMax."
}
{
"to": "120363012345678901@g.us",
"text": "Hello team! Welcome to WapiMax."
}
Request
curl -X POST "https://api.wapimax.com/whatsapp/v1/sessions/202610123/messages/text" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"to": "254712345678",
"text": "Hello! Welcome to WapiMax."
}'
const response = await fetch(
"https://api.wapimax.com/whatsapp/v1/sessions/202610123/messages/text",
{
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
to: "254712345678",
text: "Hello! Welcome to WapiMax."
})
}
);
const data = await response.json();
console.log(data);
const response = await fetch(
"https://api.wapimax.com/whatsapp/v1/sessions/202610123/messages/text",
{
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
to: "254712345678",
text: "Hello! Welcome to WapiMax."
})
}
);
console.log(await response.json());
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wapimax.com/whatsapp/v1/sessions/202610123/messages/text",
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([
"to" => "254712345678",
"text" => "Hello! Welcome to WapiMax."
])
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.wapimax.com/whatsapp/v1/sessions/202610123/messages/text"
headers = {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"to": "254712345678",
"text": "Hello! Welcome to WapiMax."
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String body = """
{
"to": "254712345678",
"text": "Hello! Welcome to WapiMax."
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.wapimax.com/whatsapp/v1/sessions/202610123/messages/text"))
.header("X-API-Key", "YOUR_API_KEY")
.header("Content-Type", "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",
"text": "Hello! Welcome to WapiMax."
}`)
req, _ := http.NewRequest(
"POST",
"https://api.wapimax.com/whatsapp/v1/sessions/202610123/messages/text",
bytes.NewBuffer(body),
)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}
require "net/http"
require "uri"
require "json"
uri = URI("https://api.wapimax.com/whatsapp/v1/sessions/202610123/messages/text")
request = Net::HTTP::Post.new(uri)
request["X-API-Key"] = "YOUR_API_KEY"
request["Content-Type"] = "application/json"
request.body = {
to: "254712345678",
text: "Hello! Welcome to WapiMax."
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.body
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program {
static async Task Main() {
using var client = new HttpClient();
client.DefaultRequestHeaders.Add(
"X-API-Key", "YOUR_API_KEY"
);
var json = """
{
"to": "254712345678",
"text": "Hello! Welcome to WapiMax."
}
""";
var content = new StringContent(
json, Encoding.UTF8, "application/json"
);
var response = await client.PostAsync(
"https://api.wapimax.com/whatsapp/v1/sessions/202610123/messages/text",
content
);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}
import Foundation
let url = URL(string: "https://api.wapimax.com/whatsapp/v1/sessions/202610123/messages/text")!
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.httpBody = try JSONSerialization.data(withJSONObject: [
"to": "254712345678",
"text": "Hello! Welcome to WapiMax."
])
let task = 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) ?? "")
}
}
task.resume()
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.toRequestBody
fun main() {
val client = OkHttpClient()
val json = """
{
"to": "254712345678",
"text": "Hello! Welcome to WapiMax."
}
""".trimIndent()
val body = json.toRequestBody("application/json".toMediaType())
val request = Request.Builder()
.url("https://api.wapimax.com/whatsapp/v1/sessions/202610123/messages/text")
.addHeader("X-API-Key", "YOUR_API_KEY")
.post(body)
.build()
client.newCall(request).execute().use {
println(it.body?.string())
}
}
Response
{
"status": "sent",
"message_id": "3EB0C8F1A2B3C4D5E6",
"timestamp": 1794304083,
"to": "254712345678"
}
Response fields
| Field | Type | Description |
|---|---|---|
status | string | Sending status |
message_id | string | Unique ID of the sent message |
timestamp | integer | Sent time (Unix) |
to | string | Recipient phone number or group ID |
Errors
| Status | Description |
|---|---|
400 | Invalid request or missing required parameters |
401 | Missing or invalid API key |
403 | Access to this session is not permitted |
404 | Session not found |
429 | Rate limit or messaging quota exceeded |
503 | Session is not connected |
Notes
- For contacts, send digits only with the country code. Do not add
+or a WhatsApp suffix. - For groups, the session must be a member of the group.
- Replace
{session_id}with your session ID. Get it from List Sessions. - The
textfield cannot be empty. - Save the
message_idfrom the response for future reference.