Multi-device daemon
Runs standard WhatsApp Web socket connections in the background, with no browser instances on your servers.
Session-isolated API keys
Every paired device gets a unique session-scoped API key. Any request with that key sends through that phone.
No template approvals
Send freeform receipts, notifications, media, and interactive buttons without Meta review.
Base URLs
Quickstart
When you create a session slot and scan the QR code with WhatsApp on your phone, a dedicated session daemon starts and a unique session-scoped API key is generated for that phone.1
Create a session slot
Create a session in your dashboard or with
POST /api/whatsapp-sessions.2
Scan the QR code with your phone
Open WhatsApp on your phone, tap Linked Devices, and scan the QR code.
3
Use the session API key
Pass your session API key in the
x-api-key header to send messages through that phone.Minimal send message example
Authentication
Every request to the WhatsApp Gateway must be authenticated with either a session API key or account-wide credentials.Keys and identifiers
- Session-scoped key (recommended)
- Account-wide credentials
When you pair your WhatsApp device, a session-scoped key is generated for that session: either a
uga_wa_... key or a 64-character hexadecimal session token. Send it in the x-api-key header or as Authorization: Bearer <key>. The request is automatically scoped to that session, so you don’t need a sessionId in the body.Session API key credentials
The Session API Key Credentials panel in the dashboard lists every WhatsApp session slot on your account. For each slot it shows:- The linked phone number and push name, or
Pending Scanbefore pairing completes. - The session ID used in request paths such as
/api/whatsapp-sessions/{sessionId}/status. - The session-scoped API key, with a copy button.
- The connection status, and a control to choose which slot the documentation examples use.
A session API key only appears after a device is paired. If you have no session yet, open the WhatsApp Dashboard, start a session slot, and scan the QR code with your phone.
Sessions and devices
In the paths below,:whatsappSession is the session ID, for example wa_1711890000000_a1b2c3d4.
List sessions
GET /api/whatsapp-sessions
Returns all session slots, connection states, device battery levels, phone numbers, and associated API keys on your account.
Create a session slot
POST /api/whatsapp-sessions
Creates a new session. Returns the new session ID and a freshly generated API key for that slot.
data.id is the session ID and data.api_key is the session API key.
Get the QR code
GET /api/whatsapp-sessions/:whatsappSession/qrcode
Returns the current pairing QR code as a base64 data URL or raw string matrix. Display it in your application for the phone to scan.
Pair with a phone number
POST /api/whatsapp-sessions/:whatsappSession/pair
Links a device with an 8-digit pairing code instead of a QR code.
Request
Check device health
GET /api/whatsapp-sessions/:whatsappSession/status
Checks whether the device is linked, its battery level, phone platform, and whether the connection is ready to send messages.
status is qr_ready and qrCode contains a data:image/png;base64,... data URL.
Restart, disconnect, and rotate keys
Send messages
All messaging endpoints accept an optionalsessionId (wa_...). You only need it when you authenticate with account-wide credentials instead of a session API key.
Phone number format: every WhatsApp endpoint accepts international numbers with or without the leading
+ (256772123456 or +256772123456). Spaces, hyphens, and + are stripped automatically, and responses always return the digits-only number, for example "to": "256772123456". Examples on this page use digits-only.Text message
POST /api/whatsapp/send-message
Sends a formatted WhatsApp message to any valid phone number. Supports formatting, line breaks, and dynamic merge tags.
Media and files
POST /api/whatsapp/send-media
Sends images (PNG, JPEG, WebP), documents (PDF, DOCX, XLSX), voice notes, or video from a publicly accessible URL.
Request
Location pin
POST /api/whatsapp/send-location
Sends a clickable Google Maps pin with latitude, longitude, venue name, and address.
Request
Contact card (vCard)
POST /api/whatsapp/send-contact
Shares contact details that the recipient can save to their phonebook in one tap.
Request
Quick reply buttons
POST /api/whatsapp/send-buttons
Sends structured choices for confirmations, order approvals, or survey branches.
Request
Poll
POST /api/whatsapp/send-poll
Sends a native WhatsApp poll to a single recipient or a group. Votes arrive through the whatsapp.poll.vote webhook.
Request
Template message
POST /api/whatsapp/send-template
Sends a saved template from your UgaText Templates library, chosen by templateName or templateId, and fills its {{variable}} placeholders. If no saved template matches templateName, the API formats a structured notification on the fly, using templateName as its title.
If the recipient’s number exists in UgaText Contacts, their contact fields (firstName, lastName, name, phone, email, and custom fields) are merged into the placeholders automatically.
Check WhatsApp registration
GET /api/whatsapp/check-number
Checks whether a phone number has an active WhatsApp account before you send, to prevent failed deliveries.
Contacts and groups
Contacts
GET /api/whatsapp/contacts
Returns contacts synced from the connected phone, including names and JIDs.
Groups
GET /api/whatsapp/groups
Returns the groups the connected phone belongs to, with group JIDs, subjects, and participants.
id (ending in @g.us) as the to value to send to that group.
Webhooks
Receive real-time HTTP POST callbacks when inbound messages arrive, outbound messages are sent, or a session’s connection state changes. WhatsApp events are sent through the same webhook engine as SMS webhooks.Events
Every WhatsApp webhook uses the same top-level envelope as SMS and Wallet webhooks:id, event, created_at, mode, and data.
Inbound message payload
Poll vote payload
Verify signatures
WhatsApp webhooks use the same signature format as SMS webhooks:webhookSettings.secret) if one is set on that WhatsApp session. Otherwise, your workspace’s primary webhook signing secret (whsec_...).
1
Parse the header
Split
X-UgaText-Signature on , to get the timestamp t and the signature v1.2
Build the signed payload
Join the timestamp, a literal period, and the raw, unparsed request body:
<timestamp>.<raw_json_body>.3
Compute the digest
Compute an HMAC SHA-256 of that string with the signing secret, encoded as lowercase hex.
4
Compare
Compare your digest with
v1 using a constant-time function. Reject requests where t is more than 300 seconds old.Node.js
The diagnostic webhook tester (
POST /api/test-webhook) is the only exception. When a custom secret is provided, it sends a plain hex HMAC SHA-256 digest of the raw body, without the t=...,v1= prefix.Status codes and quotas
All endpoints return standard HTTP status codes. Rate limits apply per plan to protect device health.Testing tools
OpenAPI 3.0 specification
The complete machine-readable WhatsApp API spec. Import it into Swagger UI, Insomnia, or code generators.
Postman Collection v2.1
A preconfigured collection with environment variable placeholders for one-click testing.
Live API console
Live API console
The live API console on the ugatext.com documentation page calls real endpoints with your active session key from the browser. Requests go to the backend, so a paired device sends the message.Available endpoints:
POST /api/whatsapp/send-message, POST /api/whatsapp/send-media, GET /api/whatsapp/check-number, and GET /api/whatsapp-sessions.Enter a recipient phone (for example 256700000000), plus message content for text or a media URL and type (image, document, video, audio) for media. The console shows the HTTP status, round-trip time in milliseconds, and the JSON response.
