📘 Developer Documentation

WhatsApp API Reference

Send WhatsApp messages programmatically via REST API. Complete documentation for session management, messaging, and utilities.

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:

1

Create a Session

BASH
curl -X POST https://login.watext.me/api/sessions \
  -H "Content-Type: application/json" \
  -d '{"sessionId": "my-session"}'

Response:

JSON
{
  "success": true,
  "sessionId": "my-session",
  "status": "qr",
  "qrDataUrl": "data:image/png;base64,..."
}
2

Scan QR Code

  1. Open the qrDataUrl value in your browser (it's a base64 image)
  2. Open WhatsApp on your phone
  3. Go to Settings → Linked Devices → Link a Device
  4. Scan the QR code
3

Verify Connection

BASH
curl https://message.watext.me/api/sessions/my-session/status

Wait until status is "connected".

4

Send Messages

BASH
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.

POST https://login.watext.me/api/sessions
Parameter Type Required Description
sessionId string No Custom session ID. Auto-generated if not provided.
Example
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.

GET https://message.watext.me/api/sessions/{sessionId}/status

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
Example
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.

DELETE https://message.watext.me/api/sessions/{sessionId}
Example
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.

POST https://message.watext.me/api/sessions/{sessionId}/send
Parameter Type Required Description
to string Yes Phone number with country code (e.g., 919876543210)
message string Yes Text message to send
Example
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:

JSON
{
  "success": true,
  "messageId": "3EB0ABC123..."
}

Send Media (Image, Video, Document, Audio)

Send media files via URL.

POST https://message.watext.me/api/sessions/{sessionId}/send-media
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

Example
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

Example
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.

GET https://message.watext.me/api/sessions/{sessionId}/check/{phoneNumber}
Example
curl https://message.watext.me/api/sessions/my-session/check/919876543210

Response:

JSON
{
  "success": true,
  "exists": true,
  "jid": "919876543210@s.whatsapp.net"
}

Get Groups

List all WhatsApp groups the session is part of.

GET https://message.watext.me/api/sessions/{sessionId}/groups
Example
curl https://message.watext.me/api/sessions/my-session/groups

Response:

JSON
{
  "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
Important:
  • Always include country code (e.g., 91 for India, 1 for USA)
  • Do NOT include +, spaces, or dashes
  • For groups, use the full group JID from the /groups endpoint

Error Handling

All endpoints return JSON with a success field:

Success Response

JSON
{
  "success": true,
  "messageId": "3EB0..."
}

Error Response

JSON
{
  "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

⚠️ Important Guidelines:
  • 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

JavaScript
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

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
<?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.

Ready to Get Started?

Create your first WhatsApp session and start sending messages in minutes.

🚀 Activate WAtext API ← Back to Gateway Overview