WhatsApp API Gateway
REST · Bearer token · Read and write
Manage WhatsApp message templates, send approved template messages
to recipients, and receive delivery, read and inbound-message
webhook events.
- Message template management
- Send template messages
- Message status webhooks
- Incoming customer messages
Open the Gateway docs Business API v1
REST · API key · Read-only
Pull your enterprise's contacts and leads, and the full conversation
history for any contact, into your CRM, data warehouse or reporting
tools.
- List contacts and leads
- Retrieve conversation history
- Rich media, templates and call events
- Self-service API keys
Open the Business API docs Which API do I need?
| What you want to do | Use this API |
|---|
| Send a WhatsApp message to a customer | WhatsApp API Gateway |
| Create, edit or delete a message template | WhatsApp API Gateway |
| Be notified the moment a message is delivered or read | WhatsApp API Gateway (webhooks) |
| React to an incoming customer message in real time | WhatsApp API Gateway (webhooks) |
| Export your leads into a CRM | Business API v1 |
| Read the full chat transcript for a contact | Business API v1 |
| Back-fill past conversations for reporting | Business API v1 |
The two APIs are separate products with separate base URLs and separate
credentials. Neither one replaces the other.
Getting Started
- Choose your API Use the table above, or the menu beside this page.
- Get your credentials Request a bearer token for the Gateway, or create an API key for the
Business API from the Sprout admin UI.
- Make your first call Copy a cURL example from any endpoint page and replace the
placeholder values with your own.
Sprout WhatsApp API Gateway
Integrate WhatsApp messaging capabilities into external systems
using a simplified REST API.
The Sprout WhatsApp API Gateway allows developers to manage
WhatsApp message templates, send approved template messages,
receive message-status updates and process incoming customer
messages.
Main Capabilities
Message Template Management
Retrieve, create, edit and delete WhatsApp message templates.
Send Template Messages
Send approved WhatsApp message templates to recipients.
Message Status Updates
Receive asynchronous updates when messages are sent,
delivered or read.
Incoming Customer Messages
Receive customer replies and message details through webhook
events.
Getting Started
- Configure the Base URL Use the Sprout WhatsApp API Gateway base URL.
- Add Authentication Include the bearer token in the authorization header.
- Identify the Required IDs Use the WABA ID, phone number ID and template ID in the
relevant endpoints.
- Manage Templates Retrieve, create, edit or delete WhatsApp templates.
- Send a Template Message Send an approved template using the phone number ID.
- Receive Webhook Events Receive status updates and incoming customer messages.
Looking for contact and conversation data?
To read your contacts or pull chat transcripts into another system,
use the Business API instead.
Go to the Business API
Base URL
All API requests must be sent through the Sprout WhatsApp API
Gateway.
Host
app.hellosprout.ai
API Path
/whatsapp-gw/api
Full Base URL
https://app.hellosprout.ai/whatsapp-gw/api
All endpoint paths shown in this documentation must be added after
the base URL.
Authentication
All API endpoints require bearer token authentication.
Required Headers
Authorization
Authorization: Bearer <AUTH_TOKEN>
Content Type
Content-Type: application/json
Request Authentication Tokencurl 'https://app.hellosprout.ai/whatsapp-gw/api/<ENDPOINT>' \
-H 'Authorization: Bearer <AUTH_TOKEN>' \
-H 'Content-Type: application/json'
Identifiers and Terminology
The WhatsApp API Gateway uses the following identifiers in endpoint
paths and request details.
WABA_IDWhatsApp Business Account ID
Identifies the WhatsApp Business Account that owns the templates.
PHONE_NUMBER_IDWhatsApp Business Phone Number ID
Identifies the connected business phone number used to send messages.
TEMPLATE_IDMessage Template ID
Identifies an individual WhatsApp message template.
Your own WABA ID and phone number ID are provided together with your
authentication token.
List Templates
Retrieve the message templates available under a WhatsApp Business
Account.
GET /<WABA_ID>/message_templates
Required Information
- WhatsApp Business Account ID
- Authorization bearer token
Response Information
The response may include:
Template name
Parameter format
Template components
Header details
Body text
Example parameter values
Buttons
Language
Status
Category
Template ID
Pagination cursors
Common Values
Languageen_US
StatusAPPROVED
CategoryMARKETING
Paging
Pagination information may include:
- Before cursor
- After cursor
Example Request
curl 'https://app.hellosprout.ai/whatsapp-gw/api/<WABA_ID>/message_templates' \
-H 'Authorization: Bearer <AUTH_TOKEN>'
Example Response
{
"data": [
{
"name": "text_params_button",
"parameter_format": "NAMED",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "sample_text"
},
{
"type": "BODY",
"text": "O {{name}}, chosen of fortune, Emrys and Morgana do summon thee...",
"example": {
"body_text_named_params": [
{
"param_name": "name",
"example": "Arthur"
},
{
"param_name": "bell_location",
"example": "Avalon Tower"
}
]
}
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Turn Away"
},
{
"type": "PHONE_NUMBER",
"text": "Heed the Summons",
"phone_number": "+94716925097"
}
]
}
],
"language": "en_US",
"status": "APPROVED",
"category": "MARKETING",
"id": "1308035194697923"
}
],
"paging": {
"cursors": {
"before": "cursor-string",
"after": "cursor-string"
}
}
}
Create Template
Create a new WhatsApp message template under a WhatsApp Business
Account.
POST /<WABA_ID>/message_templates
Request Body Fields
| Field | Type | Required | Description |
|---|
name | string | Yes | Template name |
category | string | Yes | UTILITY or MARKETING |
language | string | Yes | Language code, for example en_US |
parameter_format | string | Yes | NAMED |
components | array | Yes | Template content |
Supported Template Components
Header
Body
- Message text
- Named parameters
- Example parameter values
Footer
Includes footer text
Buttons
Quick reply button
Response
The response includes:
- Template ID
- Status
- Category
A newly created template may return the status PENDING.
Example Request
{
"name": "sample_text_template",
"category": "UTILITY",
"language": "en_US",
"parameter_format": "NAMED",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "Sample Header"
},
{
"type": "BODY",
"text": "Hello {{name}}, your order is ready.",
"example": {
"body_text_named_params": [
{
"param_name": "name",
"example": "John"
}
]
}
},
{
"type": "FOOTER",
"text": "Thank you"
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Quick Reply Button"
}
]
}
]
}
Example Response
{
"id": "987654321",
"status": "PENDING",
"category": "UTILITY"
}
Edit Template
Edit an existing WhatsApp message template.
POST /<TEMPLATE_ID>
Eligible Template Statuses
APPROVED REJECTED PAUSED
Editable Properties
- Category
- Components
- Time-to-live
Important Editing Rules
- Individual template components cannot be edited separately.
- All components are replaced by the components included in the edit request.
- The category of an approved template cannot be edited.
- Approved templates can be edited up to 10 times within a 30-day period.
- Approved templates can be edited once within a 24-hour period.
- Rejected or paused templates can be edited an unlimited number of times.
- After editing an approved or paused template, it will automatically be
approved unless it fails template review.
Response
- Success status
- Template ID
- Template name
- Template category
Example Request
{
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "A Proclamation of Hidden Sorcery"
},
{
"type": "BODY",
"text": "Sample Edited Text."
}
]
}
Example Response
{
"success": true,
"id": "889288737024431",
"name": "text_only",
"category": "MARKETING"
}
Delete Template
Delete a WhatsApp message template using its ID and name.
DELETE /<WABA_ID>/message_templates?hsm_id=<TEMPLATE_ID>&name=<TEMPLATE_NAME>
Required Query Information
hsm_idMessage Template ID
The unique ID of the message template.
nameTemplate Name
The name assigned to the message template.
Required Information
- WhatsApp Business Account ID
- Template ID
- Template name
- Authorization bearer token
Example Request
curl -X DELETE \
'https://app.hellosprout.ai/whatsapp-gw/api/<WABA_ID>/message_templates?hsm_id=<TEMPLATE_ID>&name=<TEMPLATE_NAME>' \
-H 'Authorization: Bearer <AUTH_TOKEN>'
Example Response
Send Template Message
Send a WhatsApp template message using the connected WhatsApp
business phone number.
POST /<PHONE_NUMBER_ID>/messages
Request Body Fields
| Field | Type | Required | Description |
|---|
messaging_product | string | Yes | Must be whatsapp |
to | string | Yes | Recipient number in E.164 format |
type | string | Yes | Must be template |
template | object | Yes | Template configuration |
Template Configuration
NameThe approved template name.
Languageen_US
ComponentsContains the dynamic values required by the template.
Named Parameters
The documented body parameter includes:
- Type
- Parameter name
- Text value
Named parameters allow the template to insert customer-specific
content.
Response
- Messaging product: the messaging platform used.
- Contacts: the original recipient input and WhatsApp ID.
- Messages: the message ID and message status.
The example message status is accepted. An accepted
response means the gateway has taken the message. Actual delivery is
confirmed later through webhook events.
Example Payload
{
"messaging_product": "whatsapp",
"to": "+94712345678",
"type": "template",
"template": {
"name": "sample_text_template",
"language": {
"code": "en_US"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"parameter_name": "name",
"text": "John"
},
{
"type": "text",
"parameter_name": "name",
"text": "sample_text"
}
]
}
]
}
}
Example Response
{
"messaging_product": "whatsapp",
"contacts": [
{
"input": "+94716935097",
"wa_id": "94716935097"
}
],
"messages": [
{
"id": "wamid.HBgLOTQ3MTY5MzUwOTcVAgARGBI4NkVDOTIzRjdCREFDNDRBRDUA",
"message_status": "accepted"
}
]
}
Reading this message back later
A template you send here appears in the Business API conversation
history with the content type TEMPLATE_MESSAGE.
View content types
Message Status Updates
The gateway sends asynchronous webhook updates for WhatsApp
message events.
Documented Events
Sent
Delivered
Read
Incoming customer messages
Each webhook payload uses the whatsapp_business_account object and includes an entry array containing message-related changes.
Select an event from the sidebar to view the information contained
in its documented payload.
Sent Webhook Event
The sent event is generated when a WhatsApp message reaches the
sent status.
Status value sent
Payload Information
- Object type:
whatsapp_business_account - WhatsApp Business Account entry ID
- Messaging product
- Display phone number
- Phone number ID
- Message ID
- Status
- Timestamp
- Recipient phone number
- Billable value
- Pricing model
- Message category
- Pricing type
- Webhook field:
messages
Documented Pricing Values
Pricing modelPMP
Categorymarketing
Typeregular
Example Webhook Payload
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "1435343061523969",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "<DISPLAY_PHONE_NUMBER>",
"phone_number_id": "<PHONE_NUMBER_ID>"
},
"statuses": [
{
"id": "<MESSAGE_ID>",
"status": "sent",
"timestamp": "1770893055",
"recipient_id": "<RECIPIENT_PHONE_NUMBER>",
"pricing": {
"billable": true,
"pricing_model": "PMP",
"category": "marketing",
"type": "regular"
}
}
]
},
"field": "messages"
}
]
}
]
}
Delivered Webhook Event
The delivered event is generated when a WhatsApp message reaches
the delivered status.
Status value delivered
Payload Information
- Object type:
whatsapp_business_account - WhatsApp Business Account entry ID
- Messaging product
- Display phone number
- Phone number ID
- Message ID
- Status
- Timestamp
- Recipient phone number
- Billable value
- Pricing model
- Message category
- Pricing type
- Webhook field:
messages
Documented Pricing Values
Pricing modelPMP
Categorymarketing
Typeregular
Example Webhook Payload
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "1435343061523969",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "<DISPLAY_PHONE_NUMBER>",
"phone_number_id": "<PHONE_NUMBER_ID>"
},
"statuses": [
{
"id": "<MESSAGE_ID>",
"status": "delivered",
"timestamp": "1770893055",
"recipient_id": "<RECIPIENT_PHONE_NUMBER>",
"pricing": {
"billable": true,
"pricing_model": "PMP",
"category": "marketing",
"type": "regular"
}
}
]
},
"field": "messages"
}
]
}
]
}
Read Webhook Event
The read event is generated when a WhatsApp message reaches the
read status.
Status value read
Payload Information
- Object type:
whatsapp_business_account - WhatsApp Business Account entry ID
- Messaging product
- Display phone number
- Phone number ID
- Message ID
- Status
- Timestamp
- Recipient phone number
- Billable value
- Pricing model
- Message category
- Pricing type
- Webhook field:
messages
Documented Pricing Values
Pricing modelPMP
Categorymarketing
Typeregular
Example Webhook Payload
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "1435343061523969",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "<DISPLAY_PHONE_NUMBER>",
"phone_number_id": "<PHONE_NUMBER_ID>"
},
"statuses": [
{
"id": "<MESSAGE_ID>",
"status": "read",
"timestamp": "1770892507",
"recipient_id": "<RECIPIENT_PHONE_NUMBER>",
"pricing": {
"billable": true,
"pricing_model": "PMP",
"category": "marketing",
"type": "regular"
}
}
]
},
"field": "messages"
}
]
}
]
}
Incoming Customer Messages
This webhook event is delivered when a customer replies to one of your
WhatsApp messages.
Payload Information
- Object type:
whatsapp_business_account - WhatsApp Business Account entry ID
- Messaging product
- Display phone number
- Phone number ID
- Contact profile name
- Contact WhatsApp ID
- Message context
- Context sender
- Context message ID
- Sender phone number
- Incoming message ID
- Timestamp
- Text body
- Message type
- Webhook field:
messages
Documented Example Values
Message typetext
Text bodyHi
Example Webhook Payload
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "1435343061523969",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "<DISPLAY_PHONE_NUMBER>",
"phone_number_id": "<PHONE_NUMBER_ID>"
},
"contacts": [
{
"profile": {
"name": "<REPLIED_CONTACT_NAME>"
},
"wa_id": "<RECIPIENT_PHONE_NUMBER>"
}
],
"messages": [
{
"context": {
"from": "<DISPLAY_PHONE_NUMBER>",
"id": "<CONTEXT_MESSAGE_ID>"
},
"from": "<RECIPIENT_PHONE_NUMBER>",
"id": "<INCOMING_MESSAGE_ID>",
"timestamp": "1770892557",
"text": {
"body": "Hi"
},
"type": "text"
}
]
},
"field": "messages"
}
]
}
]
}
Need past conversations instead?
Webhooks push messages to you as they arrive. To read historical
conversations on demand, use the Business API.
Get conversation history
Sandbox Account Access
Request access to the Sprout sandbox environment to view and manage
WhatsApp message templates.
Before Requesting Access
A WhatsApp number must be integrated before you can access the
portal and manage message templates.
Request Sandbox Access
Portal Login
Access the Sprout template portal to view and manage WhatsApp
message templates.
Login URL
https://app.hellosprout.ai/promotion/templates
Your WhatsApp number must be integrated before you can access the
portal.
Open Template Portal
Sprout Business API v1
Retrieve your enterprise's contacts and their conversation history
through a read-only REST API.
The Business API gives external systems such as a CRM, a data
warehouse or a reporting tool direct access to the leads captured by
your Sprout agents and to the messages exchanged with them. Every
response is automatically limited to your own enterprise's data.
Main Capabilities
List Contacts
Retrieve contacts and leads captured by your agents, newest first,
including any custom fields collected during the conversation.
Conversation History
Retrieve the full message history for a contact, grouped by session,
in the same order as the admin Conversations screen.
Rich Content Support
Text, rich media, template messages, emoji reactions and voice-call
events are all represented in the response.
Self-Service API Keys
Create and revoke API keys yourself from the Sprout admin UI, with
up to five active keys per enterprise.
Important Characteristics
Versionv1
MethodsGET only. Version 1 is read-only.
AuthenticationX-API-Key
Rate limit60 requests per minute per key, by default.
Message retentionThe last 3 months of messages.
Getting Started
- Create an API Key Generate a key from Integrations, then Sprout API, in the admin UI.
- Add the Authentication Header Send the key in the
X-API-Key header on every request. - List Your Contacts Call the contacts endpoint and store the contact IDs you receive.
- Retrieve Conversations Use a contact ID to pull that contact's full message history.
- Poll Incrementally Use the timestamp filter so you only fetch what has changed.
Need to send messages instead?
The Business API is read-only. To send WhatsApp messages or manage
templates, use the WhatsApp API Gateway.
Go to the WhatsApp API Gateway
Create an API Key
API keys are created and revoked by you, from within the Sprout admin
UI.
Steps
- Open the Integrations Page In the Sprout admin UI, go to Integrations, then Sprout API, and
select
sprout-api. - Create the Key Each enterprise can hold a maximum of five keys at a time.
- Copy It Immediately The full key is shown only once, at creation. It cannot be
retrieved afterwards. Only a name and an identifier are stored.
- Revoke When No Longer Needed Revoke a key at any time from the same page. Revoked keys stop
working immediately.
Key Format
A key has two parts separated by a dot: a key ID and a secret. Send the
whole value, including the dot, in the authentication header.
<keyId>.<secret>
Scope
Each key is scoped to your enterprise. All API responses are
automatically limited to your enterprise's data, so you never pass an
enterprise ID yourself.
Treat your key like a password Anyone holding the key can read your contacts and conversation
history. Never publish it, never commit it to a repository, and
revoke it immediately if it is exposed.
Do Not Have Access Yet?
If the Sprout API integration is not enabled on your account, or you
cannot see the Integrations page, contact us and our team will get in touch.
Request Business API Access
Base URL and Conventions
All Business API requests are sent to a versioned base path over HTTPS.
Base URL
https://<gateway-host>/business-api/v1
Your gateway host is confirmed together with your API access. Replace <gateway-host> with the value supplied for your
account.
Conventions
| Item | Value |
|---|
| Transport | HTTPS only |
| Methods | GET only. Version 1 is read-only. |
| Authentication header | X-API-Key: <keyId>.<secret>, required on every request |
| Content type | application/json in responses |
| Timestamps | ISO-8601 in UTC, for example 2026-07-20T10:15:00Z |
| IDs | Opaque strings. Do not attempt to parse them. |
| Correlation | Every response carries X-Correlation-ID. Include it when reporting an issue. |
Pagination
Both endpoints use offset pagination through the page and limit query parameters, and return a pagination object in the response.
| Field | Description |
|---|
page | The page that was returned |
limit | The page size that was applied |
total | Total number of records available |
totalPages | Total number of pages available |
hasMore | Whether a further page exists |
Authentication
Every Business API request must include your enterprise API key in the X-API-Key header.
Required Header
X-API-Key: <keyId>.<secret>
How the Key Is Validated
The gateway validates the key, enforces the key's rate limit and
endpoint allowlist, and resolves your enterprise before the request
reaches the service.
A missing, malformed, revoked or out-of-scope key is rejected at the
edge with a 401 INVALID_API_KEY response.
Example Request
curl -s 'https://<gateway-host>/business-api/v1/contacts?limit=50&page=1' \
-H 'X-API-Key: <keyId>.<secret>'
Request Business API Access
List Contacts
Returns your enterprise's contacts and leads, newest first by creation
time.
GET /business-api/v1/contacts
Query Parameters
| Parameter | Type | Default | Constraints and notes |
|---|
limit | integer | 50 | Clamped to a value between 1 and 100 |
page | integer | 1 | Must be 1 or greater. Offset pagination using page and limit. |
updatedSince | ISO-8601 | — | Optional. Returns contacts created at or after this instant, for incremental polling. |
Example Request
curl -s 'https://<gateway-host>/business-api/v1/contacts?limit=50&page=1' \
-H 'X-API-Key: <keyId>.<secret>'
Example Response
{
"data": [
{
"id": "665f2b8c9a1e4f0012ab34cd",
"name": "Jane Doe",
"email": "jane@example.com",
"phone": "+94771234567",
"source": "WEB",
"customFields": {
"company": "Acme",
"budget": "5000"
},
"createdOn": "2026-07-20T10:15:00Z",
"lastUpdatedOn": "2026-07-21T08:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 50,
"total": 1234,
"totalPages": 25,
"hasMore": true
}
}
Contact Object
| Field | Type | Nullable | Description |
|---|
id | string | No | Stable contact ID. Use this as the contactId for the messages endpoint. |
name | string | Yes | Contact name, if collected. |
email | string | Yes | Email address, if collected. |
phone | string | Yes | Phone number in E.164 form, if collected. |
source | string | No | Acquisition channel: WEB, WHATSAPP, FB or IG. Version 1 returns the
channel only, not the specific web page URL. |
customFields | object | No | Key and value map of extra fields the agent collected during the
conversation. May be an empty object. Values are strings. |
createdOn | string | No | When the contact was first recorded, in ISO-8601 UTC. This is the sort key. |
lastUpdatedOn | string | Yes | The last time the contact record changed. |
Notes
- Results are sorted by
createdOn in descending order. -
customFields is derived from the contact's collected
data. Malformed data yields an empty object rather than failing the
whole row. - To poll incrementally, store the highest
createdOn you
have seen and pass it as updatedSince on the next call.
Incremental polling is the recommended pattern. It keeps you well
inside the rate limit and avoids re-fetching unchanged data.
Get Conversation History
Returns the conversation history for one contact, grouped by session.
Sessions are returned in the same order as the admin Conversations
screen: the newest session first, with messages inside each session
running oldest to newest.
GET /business-api/v1/messages
Query Parameters
| Parameter | Type | Default | Constraints and notes |
|---|
contactId | string | — | Required. An ID returned by the contacts endpoint. |
limit | integer | 50 | Clamped to a value between 1 and 100. Paginates over session
groups, not individual messages. |
page | integer | 1 | Must be 1 or greater. |
Pagination works on sessions A limit of 50 returns up to 50 conversation sessions, each of which
may contain many messages. It does not return 50 messages.
Example Request
curl -s 'https://<gateway-host>/business-api/v1/messages?contactId=665f2b8c9a1e4f0012ab34cd&limit=50' \
-H 'X-API-Key: <keyId>.<secret>'
Example Response
{
"contactId": "665f2b8c9a1e4f0012ab34cd",
"data": [
{
"sessionId": "sess_abc",
"personaName": "Sales Bot",
"messages": [
{
"messageId": "6690aa11bb22cc33dd44ee55",
"sender": "visitor",
"content": "Hi",
"contentType": "TEXT",
"createdOn": "2026-07-20T10:15:00Z"
},
{
"messageId": "6690aa11bb22cc33dd44ee56",
"sender": "bot",
"content": "Hello! How can I help?",
"contentType": "TEXT",
"createdOn": "2026-07-20T10:15:03Z"
},
{
"messageId": "6690aa11bb22cc33dd44ee57",
"sender": "agent",
"content": "This is Sam, taking over.",
"contentType": "TEXT",
"createdOn": "2026-07-20T10:16:00Z"
}
]
}
],
"pagination": {
"page": 1,
"limit": 50,
"total": 3,
"totalPages": 1,
"hasMore": false
}
}
The structure of each object in the response is described on the
Response Objects page.
Response Objects
The messages endpoint returns session blocks, each containing messages,
which may in turn carry reactions or call details.
Session Block Object
| Field | Type | Nullable | Description |
|---|
sessionId | string | No | Conversation or session identifier. |
personaName | string | Yes | Name of the agent persona for the session, if known. |
messages | array | No | Messages in the session, ascending by createdOn. |
Message Object
| Field | Type | Nullable | Description |
|---|
messageId | string | No | Message identifier. |
sender | string | No | visitor, bot, agent or system. |
content | string | No | Message text. For non-text content types the payload is carried as-is. |
contentType | string | No | TEXT, JSON, REACT, TEMPLATE_MESSAGE or CALL. |
createdOn | string | No | Message timestamp in ISO-8601 UTC. |
reactions | array | Yes | Emoji reactions applied to this message. Omitted or null when there are none. |
callDetails | object | Yes | Present only when contentType is CALL. Otherwise omitted or null. |
Reaction Object
Each entry in a message's reactions array:
| Field | Type | Nullable | Description |
|---|
emoji | string | No | The reaction emoji character. |
sender | string | No | Who reacted: visitor for the end user or agent for a human agent. |
createdOn | string | No | When the reaction was added, in ISO-8601 UTC. |
A standalone message with content type REACT is an event
marker with empty content. The emoji itself is carried in the reactions array of the message it reacts to.
Call Details Object
Present on CALL messages:
| Field | Type | Nullable | Description |
|---|
callId | string | No | Call identifier. |
direction | string | No | USER_INITIATED or AGENT_INITIATED. |
status | string | No | One of RINGING, INITIATING, CONNECTING, CONNECTED, ACCEPTED, TERMINATED, REJECTED, MISSED, FAILED, AI_CONNECTED or UNKNOWN. |
consumerPhone | string | No | End user's phone number in E.164 form. |
businessPhone | string | No | Business phone number in E.164 form. |
startedAt | string | Yes | Call start time in ISO-8601 UTC, if known. |
endedAt | string | Yes | Call end time in ISO-8601 UTC, if known. |
duration | string | Yes | Call duration in seconds, if known. |
Content Types
The content field is always a string. Its meaning depends
on the contentType.
| Content type | What content holds |
|---|
TEXT | Plain UTF-8 text. This is the default and covers the vast majority of messages. |
JSON | A stringified JSON payload, typically rich media such as an
image, video, document, audio clip or sticker, or an
interactive menu. |
TEMPLATE_MESSAGE | A stringified JSON WhatsApp template or promotion message, with
a header, body, footer, buttons and optional carousel cards. |
REACT | An empty string. The message records an emoji reaction to an
earlier message. There is no inline text payload. |
CALL | An empty string. The message marks a voice-call event, for
example a WhatsApp call. There is no inline text payload. |
Sample: TEXT
{
"messageId": "6690aa11bb22cc33dd44ee55",
"sender": "visitor",
"content": "Hi there, I need help with my order",
"contentType": "TEXT",
"createdOn": "2026-07-20T10:15:00Z"
}
Sample: JSON
{
"messageId": "6690aa11bb22cc33dd44ee58",
"sender": "bot",
"content": "{\"type\":\"RICH_CONTENT\",\"image\":\"https://cdn.example.com/p.jpg\",\"caption\":\"Our new arrival\"}",
"contentType": "JSON",
"createdOn": "2026-07-20T10:16:10Z"
}
Sample: TEMPLATE_MESSAGE
{
"messageId": "6690aa11bb22cc33dd44ee59",
"sender": "bot",
"content": "{\"header\":{\"type\":\"IMAGE\",\"mediaUrl\":\"https://cdn.example.com/promo.jpg\"},\"body\":\"Flash sale today!\",\"footer\":\"Reply STOP to opt out\",\"buttons\":[{\"type\":\"URL\",\"text\":\"Shop now\",\"url\":\"https://shop.example.com\"}]}",
"contentType": "TEMPLATE_MESSAGE",
"createdOn": "2026-07-20T10:17:00Z"
}
Sample: REACT
The reaction event itself carries empty content:
{
"messageId": "6690aa11bb22cc33dd44ee5a",
"sender": "agent",
"content": "",
"contentType": "REACT",
"createdOn": "2026-07-20T10:18:00Z"
}
The earlier message it applies to then carries the emoji in its reactions array:
{
"messageId": "6690aa11bb22cc33dd44ee55",
"sender": "visitor",
"content": "Hi there, I need help with my order",
"contentType": "TEXT",
"createdOn": "2026-07-20T10:15:00Z",
"reactions": [
{
"emoji": "<EMOJI_CHARACTER>",
"sender": "agent",
"createdOn": "2026-07-20T10:18:00Z"
}
]
}
Sample: CALL
{
"messageId": "6690aa11bb22cc33dd44ee5b",
"sender": "system",
"content": "",
"contentType": "CALL",
"createdOn": "2026-07-20T10:19:00Z",
"callDetails": {
"callId": "wacid.HBgL...",
"direction": "USER_INITIATED",
"status": "TERMINATED",
"consumerPhone": "+94771234567",
"businessPhone": "+94112000000",
"startedAt": "2026-07-20T10:19:05Z",
"endedAt": "2026-07-20T10:21:35Z",
"duration": "150"
}
}
Senders, Ordering and Retention
Three behaviours determine how a conversation transcript should be read
and displayed.
Sender Mapping
| Internal role | API sender | Meaning |
|---|
user | visitor | Message from the end user or contact. |
assistant | bot | Automated persona reply. |
agent | agent | Human agent reply. |
reader | system | Rare system or internal marker. |
Ordering
- Within a session, messages are ascending by
createdOn, oldest first. - Across sessions, ordering is descending by the session's latest
message, so the most recent conversation comes first.
- Pagination through
page and limit is applied
over session groups, not over individual messages.
Retention
Retention window Last 3 months
Only messages from the last three months are returned. This matches the
admin Conversations screen.
Plan for the retention window If you need a permanent archive of conversations, export and store
them in your own system on a regular schedule. Messages older than
three months are not available through this API.
Errors
All errors return a JSON body with a machine-readable code and a
human-readable message.
Error Response Shape
{
"error": {
"code": "INVALID_API_KEY",
"message": "The provided API key is missing or invalid."
}
}
Status Codes
| HTTP code | Code | When it happens |
|---|
400 | BAD_REQUEST | An invalid or missing query parameter, for example a missing contactId or a non-integer page. |
401 | INVALID_API_KEY | A missing, malformed, revoked or unscoped API key. |
403 | FORBIDDEN | The key is not permitted for this endpoint, method or enterprise. |
404 | CONTACT_NOT_FOUND | The contactId does not exist within your enterprise. |
429 | RATE_LIMITED | The per-key rate limit has been exceeded. |
500 | INTERNAL_ERROR | An unexpected server error. |
Cross-tenant access is treated as not found, returning 404 rather than 403, so keys cannot be used
to probe for other enterprises' contact IDs.
When reporting an issue, include the X-Correlation-ID header returned with the failing response.
Rate Limiting
Each API key has a requests-per-minute limit, enforced at the gateway.
Default limit 60 requests per minute
When the Limit Is Exceeded
The API returns 429 RATE_LIMITED. Design your polling to
stay within the limit.
Recommended Approach
- Use
updatedSince on the contacts endpoint so you avoid
re-fetching unchanged data. - Store the highest
createdOn you have seen and send it on
the next call. - Request larger pages rather than more frequent calls. The maximum
page size is 100.
- Back off and retry after a short delay when you receive a
429 response.
Versioning
The API version appears in the request path.
/business-api/v1
What May Change Within v1
Additive, backward-compatible changes such as new fields or new
optional parameters may ship within version 1.
Breaking Changes
Breaking changes are introduced under a new version prefix, so your
existing integration continues to work against version 1.
What else should I read before I integrate?
Before you write code, see the ready-made integrations, compare what each pricing plan includes (custom API integration is part of the Enterprise plan). To ask about API access, contact our team.