WaSetu
REST API v1.0 • Multi-Device Baileys Engine

Developer API Reference & Webhooks

Integrate programmatic WhatsApp messaging, automated OTP dispatch, session management, and bi-directional conversational webhooks into your applications with standard JSON payloads.

Latency < 350ms Fast Dispatch
Authentication Bearer Token / API Key
Data Format JSON UTF-8 Payload
Event Streaming Real-Time Webhooks
1

Overview & Base URL

API architecture, environments, and REST conventions

The OpenWA REST API enables programmatic interaction with WhatsApp. You can provision multi-device slots, generate dynamic QR codes, dispatch high-throughput transactional alerts, send rich media, and capture inbound replies via real-time webhooks.

// Production API Base Endpoint
https://www.wasetu.hostgeeks.in/api/v1
2

Authentication & Headers

Securing your API requests with Bearer Tokens

Every REST API request must authenticate by providing your Secret API Key in the Authorization header as a Bearer token, or alternatively via X-API-Key.

Authorization: Bearer wa_live_9a7e8b61c4d290fa
Content-Type: application/json
Accept: application/json
3

Anti-Ban Pacing & Rate Limits

Humanized typing delay engine and quota enforcement

To protect your connected numbers against WhatsApp spam filters, our socket gateway enforces automated human typing jitter (800ms – 2400ms delay between dispatches).

Burst Rate Limit Up to 30 requests/second per API token. Extra requests are held in priority FIFO queue.
Instance Pacing Outbound messages per instance are throttled with randomized jitter to simulate organic human typing.
GET /api/v1/instances

List All WhatsApp Instances

Slot Inventory

Returns an array of all WhatsApp instance slots provisioned under your account, along with their live socket connectivity state and paired phone numbers.

7-LANGUAGE CODE EXAMPLES Request
curl -X GET "https://www.wasetu.hostgeeks.in/api/v1/instances" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"

Sample Success Response (200 OK)

{
  "success": true,
  "data": [
    {
      "instance_key": "inst_7fa289e",
      "name": "Support Line 1",
      "phone": "919876543210",
      "status": "connected",
      "created_at": "2026-08-30T10:15:00Z"
    }
  ]
}
POST /api/v1/instances

Create Instance Slot

Slot Allocation

Provisions a new WhatsApp multi-device slot in your workspace. Once created, you can immediately initiate QR pairing to link any mobile device.

Request Body Parameters

Field Type Status Description
name string Required Friendly label for the instance slot (e.g. "Sales WhatsApp 01").
7-LANGUAGE CODE EXAMPLES JSON Payload
curl -X POST "https://www.wasetu.hostgeeks.in/api/v1/instances" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Customer Care Desk"
  }'

Sample Success Response (201 Created)

{
  "success": true,
  "message": "WhatsApp instance slot created successfully.",
  "data": {
    "instance_key": "inst_92bc401",
    "name": "Customer Care Desk",
    "status": "disconnected"
  }
}
POST /api/v1/instances/{instanceKey}/connect

Connect & Generate QR Code

Session Initializer

Spawns a multi-device WhatsApp Baileys socket session and generates a real-time QR code. Returns the QR code in Base64 Data URI format ready to display in your user interface.

7-LANGUAGE CODE EXAMPLES Request
curl -X POST "https://www.wasetu.hostgeeks.in/api/v1/instances/inst_7fa289e/connect" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"

Sample Success Response (200 OK)

{
  "success": true,
  "message": "QR Code generated. Scan with WhatsApp to pair.",
  "data": {
    "instance_key": "inst_7fa289e",
    "status": "pairing",
    "qr_code": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA...",
    "expires_in": 45
  }
}
GET /api/v1/instances/{instanceKey}/status

Check Instance Connection Status

Socket Health

Polls the live socket state of an instance to verify whether WhatsApp web multi-device is currently active, pairing, or disconnected.

7-LANGUAGE CODE EXAMPLES Request
curl -X GET "https://www.wasetu.hostgeeks.in/api/v1/instances/inst_7fa289e/status" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"

Sample Success Response (200 OK)

{
  "success": true,
  "data": {
    "instance_key": "inst_7fa289e",
    "name": "Customer Care Desk",
    "phone": "919876543210",
    "status": "connected",
    "platform": "Baileys MD v6.5",
    "updated_at": "2026-08-30T17:45:00Z"
  }
}
GET /api/v1/instances/{instanceKey}/qr

Fetch Live QR Code

QR Polling

Retrieves the current active Base64 QR code image payload for a pairing session if it has not yet completed authentication.

7-LANGUAGE CODE EXAMPLES Request
curl -X GET "https://www.wasetu.hostgeeks.in/api/v1/instances/inst_7fa289e/qr" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"

Sample Success Response (200 OK)

{
  "success": true,
  "data": {
    "instance_key": "inst_7fa289e",
    "status": "pairing",
    "qr_code": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
    "expires_in": 30
  }
}
POST /api/v1/instances/{instanceKey}/logout

Logout & Unlink WhatsApp Device

Session Teardown

Terminates the WhatsApp multi-device session, closes socket handles, and clears persisted device keys from storage.

7-LANGUAGE CODE EXAMPLES Request
curl -X POST "https://www.wasetu.hostgeeks.in/api/v1/instances/inst_7fa289e/logout" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"

Sample Success Response (200 OK)

{
  "success": true,
  "message": "WhatsApp instance unlinked and logged out successfully.",
  "data": {
    "instance_key": "inst_7fa289e",
    "status": "disconnected"
  }
}
POST /api/v1/messages/send

Send WhatsApp Text Message

Outbound Transactional

Dispatches a plain or markdown-formatted WhatsApp text message to any international mobile number.

Request Body Parameters

Field Type Status Description
instance_key string Required Unique identifier of your connected WhatsApp instance slot.
phone string Required Recipient phone number with country code (e.g. 919876543210). No leading + or dashes.
message string Required Text message body (supports *bold*, _italic_, ~strike~, and emojis). Max 4096 chars.
7-LANGUAGE CODE EXAMPLES JSON Payload
curl -X POST "https://www.wasetu.hostgeeks.in/api/v1/messages/send" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instance_key": "inst_7fa289e",
    "phone": "919876543210",
    "message": "Hello! Your appointment is confirmed for *3:00 PM* today. - OpenWA"
  }'

Sample Success Response (200 OK)

{
  "success": true,
  "message": "WhatsApp message dispatched successfully.",
  "data": {
    "message_id": 1042,
    "wa_message_id": "3EB0F429A71",
    "phone": "919876543210",
    "status": "sent"
  }
}
POST /api/v1/messages/send-media

Send WhatsApp Document & Media

PDF / Image / Video / Audio

Dispatches a PDF invoice, document file, JPEG/PNG image, MP4 video, or audio file via a public HTTPS URL with an optional caption.

Request Body Parameters

Field Type Status Description
instance_key string Required Target instance key.
phone string Required Recipient phone number with country code.
media_url url Required Publicly accessible direct HTTPS URL to the media file.
caption string Optional Text caption displayed under the media attachment.
media_type string Optional Explicit media type: "document", "image", "video", "audio". Auto-detected if omitted.
7-LANGUAGE CODE EXAMPLES JSON Payload
curl -X POST "https://www.wasetu.hostgeeks.in/api/v1/messages/send-media" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instance_key": "inst_7fa289e",
    "phone": "919876543210",
    "media_url": "https://yourdomain.com/invoices/INV-1092.pdf",
    "caption": "Here is your monthly invoice receipt. Thank you!"
  }'

Sample Success Response (200 OK)

{
  "success": true,
  "message": "Media message dispatched successfully.",
  "data": {
    "message_id": 1043,
    "wa_message_id": "3EB0D498C29",
    "phone": "919876543210",
    "media_type": "document",
    "status": "sent"
  }
}
GET /api/v1/messages/history

Query Message History & Logs

Audit & Telemetry

Retrieves paginated historical outbound and inbound messages filtered by instance slot, recipient phone number, or date range.

Query Parameters

Field Type Status Description
instance_key string Optional Filter logs strictly for a specific instance slot.
phone string Optional Filter messages sent to or received from a specific phone.
limit integer Optional Results per page (default: 50, maximum: 200).
page integer Optional Page offset number for pagination (default: 1).
7-LANGUAGE CODE EXAMPLES Request
curl -X GET "https://www.wasetu.hostgeeks.in/api/v1/messages/history?instance_key=inst_7fa289e&limit=20" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"

Sample Success Response (200 OK)

{
  "success": true,
  "data": [
    {
      "id": 1042,
      "instance_key": "inst_7fa289e",
      "phone": "919876543210",
      "message": "Hello! Your appointment is confirmed for *3:00 PM* today.",
      "status": "delivered",
      "created_at": "2026-08-30T17:40:12Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "per_page": 20,
    "total": 148
  }
}

Real-Time Inbound Webhooks

Receive customer replies and real-time delivery acknowledgments

Configure your webhook endpoint URL inside your Client Portal. Whenever an inbound message arrives or an outbound message transitions status (sent → delivered → read), our gateway dispatches an HTTP POST JSON event directly to your server.

EVENT Inbound Message Event (messages.upsert)

{
  "event": "messages.upsert",
  "instance_key": "inst_7fa289e",
  "phone": "919876543210",
  "sender_name": "Sarah Connor",
  "message_body": "Hi! I would like to book a demo coaching session for tomorrow.",
  "message_type": "text",
  "timestamp": 1788092058
}

EVENT Delivery Status Receipt (messages.update)

{
  "event": "messages.update",
  "instance_key": "inst_7fa289e",
  "wa_message_id": "3EB0F429A71",
  "phone": "919876543210",
  "status": "read",
  "timestamp": 1788092062
}

HTTP Error Codes & Resolutions

Standard status codes returned by the API

Code Meaning Resolution Guide
200 OK Success Request processed and WhatsApp message sent or session updated.
400 Bad Request Instance Disconnected Device is not connected. Scan QR in portal or use /instances/{key}/connect.
401 Unauthorized Invalid API Token Ensure your Bearer token is passed correctly in the Authorization header.
403 Forbidden Feature Locked Your subscription plan does not include REST API access. Upgrade your plan.
422 Unprocessable Validation Error One or more required fields are missing or invalid (e.g. invalid phone number format).
429 Rate Limit Quota Exceeded Daily or monthly message limit exhausted, or burst rate exceeded. Upgrade to higher tier.
500 Server Error Internal Failure WhatsApp socket engine failure or internal exception. Verify gateway daemon is running.
Cookie & Privacy Choices

We use essential cookies to maintain secure authentication and analytical cookies to improve platform performance.