Base URLs
WAtext API uses two base URLs for different operations:
| Endpoint | URL |
|---|---|
| Session Management | https://login.watext.me |
| Messaging & Utilities | https://message.watext.me |
Quick Start
Get up and running in 4 simple steps:
Create a Session
curl -X POST https://login.watext.me/api/sessions \
-H "Content-Type: application/json" \
-d '{"sessionId": "my-session"}'
Response:
{
"success": true,
"sessionId": "my-session",
"status": "qr",
"qrDataUrl": "data:image/png;base64,..."
}
Scan QR Code
- Open the
qrDataUrlvalue in your browser (it's a base64 image) - Open WhatsApp on your phone
- Go to Settings → Linked Devices → Link a Device
- Scan the QR code
Verify Connection
curl https://message.watext.me/api/sessions/my-session/status
Wait until status is "connected".
Send Messages
curl -X POST https://message.watext.me/api/sessions/my-session/send \
-H "Content-Type: application/json" \
-d '{
"to": "919876543210",
"message": "Hello from the API!"
}'
Sessions
Create Session
Creates a new WhatsApp session and returns a QR code to scan.
| Parameter | Type | Required | Description |
|---|---|---|---|
sessionId |
string | No | Custom session ID. Auto-generated if not provided. |
curl -X POST https://login.watext.me/api/sessions \
-H "Content-Type: application/json" \
-d '{"sessionId": "my-app-session"}'
Get Session Status
Check if a session is connected and ready to send messages.
Status Values
| Status | Description |
|---|---|
| connecting | Session is starting up |
| qr | QR code ready, waiting for scan |
| connected | ✅ Ready to send messages |
| disconnected | Session was disconnected |
curl https://message.watext.me/api/sessions/my-session/status
Logout / Delete Session
Disconnect and remove a session. You'll need to scan QR again to reconnect.
curl -X DELETE https://message.watext.me/api/sessions/my-session
Messaging
Send Text Message
Send a text message to a phone number or group.
| Parameter | Type | Required | Description |
|---|---|---|---|
to |
string | Yes | Phone number with country code (e.g., 919876543210) |
message |
string | Yes | Text message to send |
curl -X POST https://message.watext.me/api/sessions/my-session/send \
-H "Content-Type: application/json" \
-d '{
"to": "919876543210",
"message": "Hello! This is a test message."
}'
Response:
{
"success": true,
"messageId": "3EB0ABC123..."
}
Send Media (Image, Video, Document, Audio)
Send media files via URL.
| Parameter | Type | Required | Description |
|---|---|---|---|
to |
string | Yes | Phone number with country code |
mediaUrl |
string | Yes | Public URL of the media file |
mediaType |
string | Yes | image, video, audio, or document |
caption |
string | No | Caption text (for images/videos/documents) |
filename |
string | No | Custom filename (for documents) |
Send Image
curl -X POST https://message.watext.me/api/sessions/my-session/send-media \
-H "Content-Type: application/json" \
-d '{
"to": "919876543210",
"mediaUrl": "https://example.com/photo.jpg",
"mediaType": "image",
"caption": "Check out this photo!"
}'
Send Document
curl -X POST https://message.watext.me/api/sessions/my-session/send-media \
-H "Content-Type: application/json" \
-d '{
"to": "919876543210",
"mediaUrl": "https://example.com/report.pdf",
"mediaType": "document",
"filename": "Monthly-Report.pdf",
"caption": "Here is the report"
}'
Utilities
Check if Number is on WhatsApp
Verify if a phone number is registered on WhatsApp.
curl https://message.watext.me/api/sessions/my-session/check/919876543210
Response:
{
"success": true,
"exists": true,
"jid": "919876543210@s.whatsapp.net"
}
Get Groups
List all WhatsApp groups the session is part of.
curl https://message.watext.me/api/sessions/my-session/groups
Response:
{
"success": true,
"groups": [
{
"id": "120363123456789@g.us",
"name": "Family Group",
"participants": 15
}
]
}
Phone Number Format
| Format | Example | Use Case |
|---|---|---|
| International (no +) | 919876543210 |
Individual messages |
| Group JID | 120363123456789@g.us |
Group messages |
- Always include country code (e.g.,
91for India,1for USA) - Do NOT include
+, spaces, or dashes - For groups, use the full group JID from the
/groupsendpoint
Error Handling
All endpoints return JSON with a success field:
Success Response
{
"success": true,
"messageId": "3EB0..."
}
Error Response
{
"success": false,
"error": "Session not found"
}
Common Errors
| Error | Cause | Solution |
|---|---|---|
Session not found |
Session doesn't exist | Create a new session |
Session is not connected |
WhatsApp disconnected | Session will auto-reconnect, retry the request |
Invalid phone number |
Wrong number format | Use format: 919876543210 |
Number not on WhatsApp |
Number not registered | Verify with /check endpoint first |
Rate Limits
- Avoid sending more than 1 message per second
- WhatsApp may temporarily block numbers that send too many messages
- For bulk messaging, add delays between messages
Code Examples
Node.js
const axios = require('axios');
const SESSION_ID = 'my-session';
const BASE_URL = 'https://message.watext.me';
// Send a message
async function sendMessage(to, message) {
const response = await axios.post(
`${BASE_URL}/api/sessions/${SESSION_ID}/send`,
{ to, message }
);
return response.data;
}
// Usage
sendMessage('919876543210', 'Hello from Node.js!')
.then(console.log)
.catch(console.error);
Python
import requests
SESSION_ID = 'my-session'
BASE_URL = 'https://message.watext.me'
def send_message(to, message):
response = requests.post(
f'{BASE_URL}/api/sessions/{SESSION_ID}/send',
json={'to': to, 'message': message}
)
return response.json()
# Usage
result = send_message('919876543210', 'Hello from Python!')
print(result)
PHP
<?php
$sessionId = 'my-session';
$baseUrl = 'https://message.watext.me';
$data = [
'to' => '919876543210',
'message' => 'Hello from PHP!'
];
$ch = curl_init("$baseUrl/api/sessions/$sessionId/send");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Terms of Use
- Do not use for spam or bulk unsolicited messaging
- Comply with WhatsApp's Terms of Service
- You are responsible for the content you send
- Rate limit your requests to avoid being blocked
For issues or questions, contact the API administrator.