✅ WhatsApp Number Verification API
Verify if a phone number is active on WhatsApp — Single or Bulk.
This endpoint is part of the Baileys REST Mongo API and is secured using Hybrid Authentication, meaning it supports both API Keys and JWT tokens.
Internally, this API uses the Baileys function:
sock.onWhatsApp(jid)
to check whether a number exists on WhatsApp and automatically logs verification history into the database (VerifiedNumber model).
🔗 Endpoints
1️⃣ Verify Single Number
POST https://api.walytic.com/api/verify/:sessionId/verify-single
2️⃣ Bulk Number Verification (Excel / CSV Upload)
POST https://api.walytic.com/api/verify/:sessionId/bulk-verify
3️⃣ Fetch Verification History
GET https://api.walytic.com/api/verify/history
4️⃣ Export Verification History (CSV / XLSX)
GET https://api.walytic.com/api/verify/export?format=csv
5️⃣ Clear Verification History
DELETE https://api.walytic.com/api/verify/clear
🔐 Required Headers
Header |
Type |
Required |
Description |
|---|---|---|---|
|
String |
✅ Yes |
Your API key |
|
String |
Optional |
Bearer JWT token |
|
String |
Required for single verify |
|
|
Multipart |
Required for bulk verify |
|
📤 Single Number Verification
POST /verify/:sessionId/verify-single
Request Body
Field |
Type |
Description |
|---|---|---|
|
String |
Phone number with country code (e.g., |
✅ Example Request (Node.js)
const axios = require("axios");
async function verifyNumber() {
const res = await axios.post(
"https://api.walytic.com/api/verify/session-919876543210/verify-single",
{
number: "919812345678"
},
{
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
}
);
console.log(res.data);
}
verifyNumber();
📦 Success Response
{
"number": "919812345678",
"status": "Valid"
}
❌ Error Response
{
"error": "Number is required"
}
📥 Bulk Verification (Excel / CSV File)
POST /verify/:sessionId/bulk-verify
Upload a .xlsx or .csv file containing a column of phone numbers.
Form Data
Key |
Type |
Required |
|---|---|---|
|
File |
Yes |
📤 Example (cURL)
$curl -X POST https://api.walytic.com/api/verify/session-919876543210/bulk-verify \
-H "x-api-key: YOUR_API_KEY" \
-F "file=@numbers.xlsx"
📦 Sample Response
{
"results": [
{ "number": "919812345678", "status": "Valid" },
{ "number": "918888888888", "status": "Invalid" },
{ "number": "12345", "status": "Error" }
]
}
📊 Verification History API
GET /verify/history
Query |
Description |
|---|---|
|
Optional filter by sessionId |
Example Response
[
{
"_id": "67123kd91",
"sessionId": "session-919876543210",
"number": "919812345678",
"status": "Valid",
"timestamp": "2024-01-10T12:44:22.123Z"
}
]
📤 Export Verification Log (CSV / XLSX)
GET /verify/export?session=ID&format=csv
Supported formats:
csvxlsx
Example:
https://api.walytic.com/api/verify/export?session=session-919876543210&format=xlsx
🗑️ Clear Verification History
DELETE /verify/clear?session=session-919876543210
Response
{
"success": true,
"message": "Cleared history for session session-919876543210",
"deletedCount": 20
}
🧠 Internal Workflow (For Developers)
When a number is verified:
The route calls:
→getSession(sessionId)-
Extracts the active WhatsApp socket:
const sock = session?.sock; -
Formats JID:
const jid = `${number.replace(/\D/g, '')}@s.whatsapp.net`; -
Baileys checks:
const exists = await sock.onWhatsApp(jid); Result saved into DB:
→VerifiedNumber.create({ sessionId, number, status })Response returned to client.
🔒 Authentication Flow
External apps → use x-api-key
Dashboard users → use JWT
Middleware:
→hybridAuthvalidates automatically
(supports both methods)
⚙️ Notes
WhatsApp session must be connected.
Works with multi-device sessions.
-
Bulk verification supports:
.csv.xlsxcolumn-based input
Maximum performance depends on Baileys rate limits.