API Documentation

Integrate the WhatsApp Session Manager into your own applications using HTTP REST APIs

Authentication

All private endpoints under /api/sessions and /api/messages require a secure JWT authorization token. Send the token in the Authorization header of your HTTP request.

🔑 Your API Token

Here is your current API authorization token. Copy this token to authenticate your REST calls:

Loading token...
GET /api/token Public

Retrieve the application authorization token securely. Mostly used inside local admin integrations.

Response (200 OK)

{
  "success": true,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

List Sessions

Fetch all active, inactive, and registering WhatsApp sessions in the database.

GET /api/sessions Requires Token

Response (200 OK)

{
  "success": true,
  "sessions": [
    {
      "sessionId": "qr_1781332832910_5eab537f",
      "mobid": "726757093511112",
      "mobile_number": "917012729389",
      "status": "READY",
      "createdAt": "2026-06-26T06:00:00.000Z"
    }
  ]
}

Create Session

Initialize a brand-new WhatsApp connection flow in the manager.

POST /api/sessions Requires Token

Request Body (JSON)

Field Type Requirement Description
name string Optional A custom name label for the session.
method string Optional Linkage method. Use "qr" (default) or "phone".

Response (201 Created)

{
  "success": true,
  "message": "Session initialized",
  "session": {
    "sessionId": "qr_1782473171252_bb1a0195",
    "status": "REGISTERING",
    "method": "qr"
  }
}

Session Info

Get current health, database info, and settings of a single session.

GET /api/sessions/:sessionId Requires Token

URL Parameters

Param Type Description
:sessionId string The unique ID of the session (e.g., qr_1781332832910_5eab537f).

Response (200 OK)

{
  "success": true,
  "session": {
    "sessionId": "qr_1781332832910_5eab537f",
    "mobid": "726757093511112",
    "mobile_number": "917012729389",
    "status": "READY",
    "method": "qr"
  }
}

Delete Session

Logs out the session, deletes session auth files locally, and marks the database status as inactive.

DELETE /api/sessions/:sessionId Requires Token

Response (200 OK)

{
  "success": true,
  "message": "Session deleted and logged out successfully"
}

Send Message

Send text messages, images, documents, audio, videos, or AI text-to-speech voice notes through any connected session.

POST /api/messages/send Requires Token

Request Body (JSON)

Field Type Requirement Description
sessionId string Required The active session ID.
to string Required Phone number with country code (e.g. "919846303025").
type string Required Message type: "text", "image", "pdf", "video", "voice".
text string Optional Message content. Required for text, or for voice if triggering AI TTS generation.
url string Optional Public URL of media file (Required for image, pdf, video, and non-TTS voice notes).
caption string Optional Media text caption (for image or video).
voice string Optional AI voice actor (e.g. "coral", "alloy", "nova") for TTS.

Code Examples

curl -X POST "http://localhost:4002/api/messages/send" \
  -H "Authorization: Bearer " \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "qr_1781332832910_5eab537f",
    "to": "919846303025",
    "type": "text",
    "text": "Hello from API Docs!"
  }'

Meta Cloud API Compatible Format

This manager features a drop-in replacement endpoint matching Facebook's official WhatsApp Cloud API structure. You can route existing CRM plugins and software directly to this local endpoint by replacing the Facebook API base URL with your server address.

POST /api/messages/:phoneNumberId/messages Requires Token

The parameter :phoneNumberId in the URL can be either the session_id, the mobile_number, or the mobid! The server automatically resolves the target connection based on your DB sessions.

Request Body (Meta Cloud API Format)

{
  "messaging_product": "whatsapp",
  "to": "919846303025",
  "type": "text",
  "text": {
    "body": "Hello from Cloud API compatible endpoint!"
  }
}

Response (Meta Cloud API Format)

{
  "messaging_product": "whatsapp",
  "contacts": [
    {
      "input": "919846303025",
      "wa_id": "919846303025"
    }
  ],
  "messages": [
    {
      "id": "wamid.HBgLOTE5ODQ2MzAzMDI1FQIAERg2Q..."
    }
  ]
}

TTS Voices

Retrieve all AI voices and audio speed parameters supported by the Text-to-Speech audio pipeline.

GET /api/messages/tts/voices Requires Token

Response (200 OK)

{
  "success": true,
  "voices": [
    { "id": "nova", "name": "Nova" },
    { "id": "alloy", "name": "Alloy" },
    { "id": "coral", "name": "Coral" }
  ],
  "speeds": [
    { "value": "0.75", "label": "Slow" },
    { "value": "1.00", "label": "Normal" }
  ]
}

âš¡ Developer Playground

Send a live API test request directly from your browser to your running server!

No request sent yet. Click "Send Test Message" to execute.