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.
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.
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.
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).
List All WhatsApp Instances
Returns an array of all WhatsApp instance slots provisioned under your account, along with their live socket connectivity state and paired phone numbers.
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"
}
]
}
Create Instance Slot
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"). |
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"
}
}
Connect & Generate QR Code
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.
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
}
}
Check Instance Connection Status
Polls the live socket state of an instance to verify whether WhatsApp web multi-device is currently active, pairing, or disconnected.
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"
}
}
Fetch Live QR Code
Retrieves the current active Base64 QR code image payload for a pairing session if it has not yet completed authentication.
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
}
}
Logout & Unlink WhatsApp Device
Terminates the WhatsApp multi-device session, closes socket handles, and clears persisted device keys from storage.
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"
}
}
Send WhatsApp Text Message
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. |
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"
}
}
Send WhatsApp Document & Media
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. |
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"
}
}
Send GPS Location Pin
Dispatches a native WhatsApp interactive Google Maps / OpenStreetMap GPS coordinate pin with place name and street address.
Request Body Parameters
| Field | Type | Status | Description |
|---|---|---|---|
| instance_key | string | Required | Your WhatsApp instance key. |
| phone | string | Required | Recipient phone number with country code. |
| latitude | float | Required | Latitude coordinate (e.g. 28.613939). |
| longitude | float | Required | Longitude coordinate (e.g. 77.209021). |
| name | string | Optional | Venue, office, or store location name. |
| address | string | Optional | Street address details. |
curl -X POST "https://www.wasetu.hostgeeks.in/api/v1/messages/send-location" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "instance_key": "inst_7fa289e", "phone": "919876543210", "latitude": 28.613939, "longitude": 77.209021, "name": "Wasetu Corporate HQ", "address": "Connaught Place, New Delhi 110001, India" }'
WhatsApp Number Registration Checker
Checks whether one or multiple phone numbers are registered and active on WhatsApp before broadcasting campaigns.
curl -X POST "https://www.wasetu.hostgeeks.in/api/v1/numbers/check" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "instance_key": "inst_7fa289e", "numbers": [ "919876543210", "919999888777", "918888777666" ] }'
{
"success": true,
"total_checked": 3,
"registered_count": 2,
"data": [
{ "phone": "919876543210", "exists": true, "jid": "919876543210@s.whatsapp.net" },
{ "phone": "919999888777", "exists": true, "jid": "919999888777@s.whatsapp.net" },
{ "phone": "918888777666", "exists": false, "jid": "918888777666@s.whatsapp.net" }
]
}
{
"success": true,
"total_checked": 3,
"registered_count": 2,
"data": [
{ "phone": "919876543210", "exists": true, "jid": "919876543210@s.whatsapp.net" },
{ "phone": "919999888777", "exists": true, "jid": "919999888777@s.whatsapp.net" },
{ "phone": "918888777666", "exists": false, "jid": "918888777666@s.whatsapp.net" }
]
}
Send Interactive Lists & Catalogs
Dispatches multi-section interactive product menus, department lists, or service catalogs.
curl -X POST "https://www.wasetu.hostgeeks.in/api/v1/messages/send-lists" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "instance_key": "inst_7fa289e", "phone": "919876543210", "title": "Wasetu Cloud Services", "message": "Please choose a department below to connect with an executive:", "button_text": "View Departments", "footer": "Available 24/7 Support", "sections": [ { "title": "Customer Support", "rows": [ { "id": "sec_billing", "title": "Billing & Invoices", "description": "Payment issues and upgrades" }, { "id": "sec_tech", "title": "Technical Support", "description": "API integration help" } ] }, { "title": "Sales & Growth", "rows": [ { "id": "sec_enterprise", "title": "Enterprise Plans", "description": "High volume custom plans" } ] } ] }'
Sample Success Response (200 OK)
{
"success": true,
"message_id": 106,
"wa_message_id": "wamid.HBgMOTE5ODc2NTQzMjEw...",
"phone": "919876543210",
"status": "sent"
}
Send Contact Card (vCard)
Dispatches a native WhatsApp contact card / vCard 3.0 with full name, phone number, and organization name, enabling the recipient to save or message the contact in 1 click.
Request Body Parameters
| Field | Type | Status | Description |
|---|---|---|---|
| instance_key | string | Required | Your connected WhatsApp instance key. |
| phone | string | Required | Recipient phone number with country code. |
| name | string | Required | Full display name of the contact. |
| contact_phone | string | Optional | Phone number of the contact card (defaults to recipient if omitted). |
| organization | string | Optional | Company or business affiliation name. |
curl -X POST "https://www.wasetu.hostgeeks.in/api/v1/messages/send-contact" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "instance_key": "inst_7fa289e", "phone": "919876543210", "name": "Alex Morgan", "contact_phone": "919876543210", "organization": "HostGeeks Cloud Services" }'
Sample Success Response (200 OK)
{
"success": true,
"message_id": 107,
"wa_message_id": "wamid.HBgMOTE5ODc2NTQzMjEw...",
"phone": "919876543210",
"status": "sent"
}
Query Message History & Logs
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). |
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
}
}
List Participating WhatsApp Groups
Retrieves all active WhatsApp groups that the connected instance is a participating member of, including group IDs, subjects, participant counts, creation timestamps, and owner JIDs.
Query Parameters
| Field | Type | Status | Description |
|---|---|---|---|
| instance_key | string | Required | Unique identifier of your connected WhatsApp instance slot. |
curl -X GET "https://www.wasetu.hostgeeks.in/api/v1/groups?instance_key=inst_7fa289e" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Accept: application/json"
Sample Success Response (200 OK)
{
"success": true,
"total": 2,
"groups": [
{
"id": "120363421634618099@g.us",
"subject": "Executive Management & Operations",
"participantsCount": 24,
"creation": 1788078000,
"owner": "919958240463@s.whatsapp.net",
"desc": "Official coordination channel for operations and field dispatch."
},
{
"id": "120363389145672101@g.us",
"subject": "DevOps & Infrastructure Alerts",
"participantsCount": 12,
"creation": 1787954000,
"owner": "919876543210@s.whatsapp.net",
"desc": "Automated incident notices and build monitoring."
}
]
}
Send WhatsApp Group Message
Dispatches announcements, status updates, notifications, or document attachments directly to any WhatsApp Group. Supports full WhatsApp markdown formatting (*bold*, _italic_, ~strikethrough~, bullet lists, numbered lists, and quotes).
Request Body Parameters
| Field | Type | Status | Description |
|---|---|---|---|
| instance_key | string | Required | Unique identifier of your connected WhatsApp instance slot. |
| group_id | string | Required | Target WhatsApp Group JID ending with @g.us (e.g. 120363421634618099@g.us) or 18-digit group number. |
| message | string | Required | Message text content. Full WhatsApp markdown is enabled. Max 4096 characters. |
| media_url | string | Optional | Publicly accessible direct HTTPS URL to an image, document, audio, or video attachment. |
curl -X POST "https://www.wasetu.hostgeeks.in/api/v1/messages/send-group" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "instance_key": "inst_7fa289e", "group_id": "120363421634618099@g.us", "message": "*Important Announcement:* \nScheduled maintenance has completed successfully! 🚀", "media_url": "https://example.com/release-notes.pdf" }'
Sample Success Response (200 OK)
{
"success": true,
"message": "Group message dispatched successfully to 120363421634618099@g.us",
"data": {
"id": 1089,
"instance_key": "inst_7fa289e",
"group_id": "120363421634618099@g.us",
"message": "*Important Announcement:* \nScheduled maintenance has completed successfully! 🚀",
"media_url": "https://example.com/release-notes.pdf",
"status": "sent",
"created_at": "2026-09-04T00:10:00Z"
}
}
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. |