Introduction
Welcome to the SmartWats API documentation. This API allows you to integrate WhatsApp messaging capabilities into your applications with support for text, media, audio, location, contacts, albums, interactive buttons, OTP copy buttons, carousels, and more.
https://app.smartwats.com/api/
You'll need an Instance ID and Access Token to use the API.
Get them here: https://app.smartwats.com/whatsapp_profile
What Can You Do?
- Text Messages: Send plain text messages with formatting support
- Media Messages: Send images, videos, documents, and files with captions
- Audio & Voice: Send audio files and voice messages (PTT)
- Albums/Carousels: Send multiple photos or videos grouped together (up to 10 items)
- Location Sharing: Send geographical coordinates with location names and addresses
- Contact Sharing: Share vCard contact information
- Copy Buttons: Send OTP codes, voucher codes, or any text with one-tap copy functionality
- URL Buttons: Send messages with clickable buttons that open websites
- Reply Buttons: Create interactive messages with up to 3 quick reply buttons
- Carousels: Send product catalogs with multiple cards, images, and action buttons
- Group Management: Get groups list and send messages to groups
- Phone Validation: Check if phone numbers are registered on WhatsApp (single or batch)
- Webhooks: Receive real-time notifications for incoming messages, status updates, and events
- Instance Management: Create, manage, and monitor multiple WhatsApp instances
Authentication
All API requests require authentication using an access token and instance ID. These credentials are required for every API call.
How to Get Your Credentials
- Login to SmartWats: https://app.smartwats.com/whatsapp_profile
- Create a new instance or select existing one
- Scan the QR code with your WhatsApp mobile app
- After successful connection, your Instance ID and Access Token will appear on the page
- Copy both credentials and use them in your API requests
Required Parameters
Parameter | Type | Required | Description |
---|---|---|---|
access_token |
string | Yes | Your unique authentication token (available after QR scan) |
instance_id |
string | Yes | WhatsApp instance identifier (available after QR scan) |
Quick Start
Get started with the SmartWats API in just a few minutes:
Step 1: Get Your Credentials
- Visit SmartWats WhatsApp Profile
- Login to your account
- Create a new WhatsApp instance
- Scan the QR code with your WhatsApp mobile app
- Copy your Instance ID and Access Token that appear after successful connection
Step 2: Test Your First API Call
Try sending a test message using cURL:
curl -X POST "https://app.smartwats.com/api/send" \
-H "Content-Type: application/json" \
-d '{
"number": "9665XXXXXXX",
"type": "text",
"message": "Hello from SmartWats API!",
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_ACCESS_TOKEN"
}'
Step 3: Explore More Features
Once your first message is sent successfully, explore other features:
- Send media files (images, videos, documents)
- Send audio messages and voice notes
- Send interactive buttons and carousels
- Configure webhooks to receive incoming messages
- Manage groups and send bulk messages
Create Instance
POSTCreate a new WhatsApp instance to start sending messages.
Endpoint
POST https://app.smartwats.com/api/create_instance
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
access_token |
string | Yes | Your authentication token |
Example Request
curl -X POST "https://app.smartwats.com/api/create_instance?access_token=YOUR_TOKEN"
Get QR Code
GETDisplay QR code to login to WhatsApp web. Scan this code with your WhatsApp mobile app.
Endpoint
GET https://app.smartwats.com/api/get_qrcode
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Example Request
curl -X GET "https://app.smartwats.com/api/get_qrcode?instance_id=INSTANCE_ID&access_token=YOUR_TOKEN"
Get Pair Code
GETGet a pairing code to login to WhatsApp web as an alternative to QR code scanning.
Endpoint
GET https://app.smartwats.com/api/get_paircode
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
phone |
string | Yes | Phone number (e.g., 9665XXXXXXX) |
Example Request
curl -X GET "https://app.smartwats.com/api/get_paircode?instance_id=INSTANCE_ID&access_token=YOUR_TOKEN&phone=9665XXXXXXX"
Logout
POSTLogout from WhatsApp web and clear the session.
Endpoint
POST https://app.smartwats.com/api/logout
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Set Webhook
POSTConfigure webhook URL to receive real-time WhatsApp events and messages.
Endpoint
POST https://app.smartwats.com/api/set_webhook
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
webhook_url |
string | Yes | HTTPS URL to receive webhooks |
enable |
boolean | Yes | Enable/disable webhook (true/false or 1/0) |
allowed_events |
string/array | No | Comma-separated list or array of event types to receive |
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Allowed Events
Event Type | Description |
---|---|
received_message |
Triggered when a new message is received |
capturer |
Triggered when connection status changes |
messages.upsert |
Triggered when messages are added or updated |
contacts.update |
Triggered when contact information is updated |
contacts.upsert |
Triggered when new contacts are added |
messages.update |
Triggered when message status changes (sent, delivered, read) |
groups.update |
Triggered when group information changes |
new_subscriber |
Triggered when someone joins a group |
Example Request - All Events
{
"webhook_url": "https://your-domain.com/webhook",
"enable": true,
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
Example Request - Specific Events
{
"webhook_url": "https://your-domain.com/webhook",
"enable": true,
"allowed_events": "received_message,messages.update,contacts.update",
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
Example Request - Array Format
{
"webhook_url": "https://your-domain.com/webhook",
"enable": true,
"allowed_events": ["received_message", "messages.update", "groups.update"],
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
- Webhook URL must use HTTPS protocol
- Cannot point to localhost or private IP addresses
- Must be a publicly accessible URL
allowed_events
is not specified or is empty, all event types will be sent to your webhook URL.
Send Text Message
POSTSend a text message to a WhatsApp number.
Endpoint
POST https://app.smartwats.com/api/send
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
number |
string | Yes | Recipient phone number (e.g., 9665XXXXXXX) |
type |
string | Yes | Message type: "text" |
message |
string | Yes | Text message content |
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Example Request
{
"number": "9665XXXXXXX",
"type": "text",
"message": "Hello from SmartWats API!",
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
curl -X POST "https://app.smartwats.com/api/send" \
-H "Content-Type: application/json" \
-d '{
"number": "9665XXXXXXX",
"type": "text",
"message": "Hello from SmartWats API!",
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}'
Send Media Message
POSTSend images, videos, or documents with optional caption.
Endpoint
POST https://app.smartwats.com/api/send
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
number |
string | Yes | Recipient phone number |
type |
string | Yes | Message type: "media" |
media_url |
string | Yes | Full URL to media file |
message |
string | No | Caption for the media |
filename |
string | No | Filename (required for documents) |
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Example Request
{
"number": "9665XXXXXXX",
"type": "media",
"media_url": "https://example.com/image.jpg",
"message": "Check this out!",
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
Send Location
POSTSend geographical location with coordinates and optional name.
Endpoint
POST https://app.smartwats.com/api/send_location
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
number |
string | Yes | Recipient phone number |
latitude |
number | Yes | Location latitude |
longitude |
number | Yes | Location longitude |
name |
string | No | Location name/title |
address |
string | No | Location address |
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Example Request
{
"number": "9665XXXXXXX",
"latitude": 24.7136,
"longitude": 46.6753,
"name": "Riyadh",
"address": "Riyadh, Saudi Arabia",
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
Send Contact
POSTSend contact vCard information to WhatsApp.
Endpoint
POST https://app.smartwats.com/api/send_contact
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
number |
string | Yes | Recipient phone number |
contact_name |
string | Yes | Contact full name |
contact_phone |
string | Yes | Contact phone number |
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Example Request
{
"number": "9665XXXXXXX",
"contact_name": "John Doe",
"contact_phone": "9665YYYYYYY",
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
Send Audio Message
POSTSend audio files or voice messages (PTT) via URL. The API automatically converts audio files for WhatsApp compatibility.
Endpoint
POST https://app.smartwats.com/api/send_audio
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
number |
string | Yes | Recipient phone number |
audio_url |
string | Yes | Full URL to audio file (e.g., https://example.com/audio.mp3) |
ptt |
boolean | No | Send as voice message (default: true) |
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Example Request - Voice Message
{
"number": "9665XXXXXXX",
"audio_url": "https://example.com/voice.mp3",
"ptt": true,
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
Example Request - Audio File
{
"number": "9665XXXXXXX",
"audio_url": "https://example.com/song.mp3",
"ptt": false,
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
cURL Example
curl -X POST "https://app.smartwats.com/api/send_audio" \
-H "Content-Type: application/json" \
-d '{
"number": "9665XXXXXXX",
"audio_url": "https://example.com/audio.mp3",
"ptt": true,
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}'
Send Album (Multiple Media)
POSTSend multiple images or videos grouped together as an album/carousel (up to 10 items). WhatsApp displays one caption for the entire album.
Endpoint
POST https://app.smartwats.com/api/send_album
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
number |
string | Yes | Recipient phone number |
album |
array | Yes | Array of media objects (max 10 items) |
caption |
string | No | Single caption for the entire album |
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Album Item Structure
Field | Type | Description |
---|---|---|
type |
string | "image" or "video" |
url |
string | Full URL to media file |
Example Request - Image Album
{
"number": "9665XXXXXXX",
"caption": "Check out these photos!",
"album": [
{
"type": "image",
"url": "https://example.com/photo1.jpg"
},
{
"type": "image",
"url": "https://example.com/photo2.jpg"
},
{
"type": "image",
"url": "https://example.com/photo3.jpg"
}
],
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
Example Request - Mixed Album
{
"number": "9665XXXXXXX",
"caption": "Photos and videos from our event",
"album": [
{
"type": "image",
"url": "https://example.com/photo1.jpg"
},
{
"type": "video",
"url": "https://example.com/video1.mp4"
},
{
"type": "image",
"url": "https://example.com/photo2.jpg"
}
],
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
cURL Example
curl -X POST "https://app.smartwats.com/api/send_album" \
-H "Content-Type: application/json" \
-d '{
"number": "9665XXXXXXX",
"caption": "Check out these photos!",
"album": [
{"type": "image", "url": "https://example.com/photo1.jpg"},
{"type": "image", "url": "https://example.com/photo2.jpg"}
],
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}'
Send Carousel Message
POSTSend an interactive carousel with multiple cards containing images, text, and buttons. Each card can have multiple buttons of different types.
Endpoint
POST https://app.smartwats.com/api/send_carousel
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
number |
string | Yes | Recipient phone number (with @s.whatsapp.net suffix) |
text |
string | No | Main message text |
title |
string | No | Carousel title |
footer |
string | No | Footer text (displayed at bottom of carousel) |
cards or templateCarousel |
array | Yes | Array of card objects (use either parameter name) |
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Card Object Structure
Field | Type | Required | Description |
---|---|---|---|
title |
string | Yes | Card title |
body |
string | Yes | Card description/body text |
footer |
string | No | Card footer text (e.g., price, subtitle) |
image |
object | Yes | Image object with "url" property |
buttons |
array | Yes | Array of button objects (supports all button types) |
Available Button Types
- URL Button: Opens a website link
- Copy Button: Copies text (perfect for OTP codes, vouchers)
- Call Button: Makes a phone call
- Quick Reply Button: Sends a predefined response
Button Types Examples
// URL Button
{
"urlButton": {
"displayText": "Visit Website",
"url": "https://example.com"
}
}
// Copy Button (for OTP, vouchers, etc.)
{
"copyButton": {
"displayText": "Copy Code",
"copyCode": "DISCOUNT50"
}
}
// Call Button
{
"callButton": {
"displayText": "Call Us",
"phoneNumber": "+966534874887"
}
}
// Quick Reply Button
{
"quickReplyButton": {
"displayText": "More Info",
"id": "btn_info"
}
}
Example Request - URL Buttons
{
"number": "9665XXXXXXX",
"text": "Check out our products",
"title": "Product Catalog",
"footer": "SmartWats Shop",
"cards": [
{
"title": "Product 1",
"body": "Amazing product with great features",
"image": "https://example.com/product1.jpg",
"buttons": [
{
"urlButton": {
"displayText": "Buy Now",
"url": "https://shop.com/product1"
}
}
]
},
{
"title": "Product 2",
"body": "Another great product",
"image": "https://example.com/product2.jpg",
"buttons": [
{
"urlButton": {
"displayText": "View Details",
"url": "https://shop.com/product2"
}
}
]
}
],
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
Example Request - Mixed Button Types
{
"number": "9665XXXXXXX",
"text": "Exclusive offers just for you!",
"title": "Special Deals",
"footer": "Limited Time Offer",
"cards": [
{
"title": "Get 50% OFF",
"body": "Use this code at checkout",
"image": "https://example.com/offer1.jpg",
"buttons": [
{
"copyButton": {
"displayText": "Copy Code",
"copyCode": "SAVE50"
}
},
{
"urlButton": {
"displayText": "Shop Now",
"url": "https://shop.com/offers"
}
}
]
},
{
"title": "Need Help?",
"body": "Contact our support team",
"image": "https://example.com/support.jpg",
"buttons": [
{
"callButton": {
"displayText": "Call Support",
"phoneNumber": "+966534874887"
}
},
{
"quickReplyButton": {
"displayText": "Chat Now",
"id": "btn_chat"
}
}
]
}
],
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
Complete Real-World Example
This comprehensive example shows a carousel with 4 cards using all button types, Arabic text support, and proper image structure:
{
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_ACCESS_TOKEN",
"number": "9665XXXXXXX@s.whatsapp.net",
"text": "Choose from the following cards",
"title": "Welcome to SmartWats",
"footer": "smartwats.com",
"templateCarousel": [
{
"title": "First Product Card",
"body": "Description of the first product with important details",
"footer": "Price: 100 SAR",
"image": {
"url": "https://example.com/product1.png"
},
"buttons": [
{
"quickReplyButton": {
"displayText": "Select Product",
"id": "select_product_1"
}
},
{
"urlButton": {
"displayText": "View Details",
"url": "https://example.com/product1"
}
}
]
},
{
"title": "Second Product Card",
"body": "Description of the second product with special features",
"footer": "Price: 150 SAR",
"image": {
"url": "https://example.com/product2.png"
},
"buttons": [
{
"quickReplyButton": {
"displayText": "Select Product",
"id": "select_product_2"
}
},
{
"callButton": {
"displayText": "Call Us",
"phoneNumber": "+966534874887"
}
}
]
},
{
"title": "Premium Service Card",
"body": "Our premium services for valued customers with quality guarantee",
"footer": "Free Service",
"image": {
"url": "https://example.com/service.gif"
},
"buttons": [
{
"copyButton": {
"displayText": "Copy Discount Code",
"copyCode": "SERVICE2024"
}
},
{
"urlButton": {
"displayText": "More Services",
"url": "https://smartwats.com/services"
}
}
]
},
{
"title": "Special Offer Card",
"body": "Limited time special offer - Don't miss out!",
"footer": "Save 30%",
"image": {
"url": "https://example.com/offer.jpg"
},
"buttons": [
{
"quickReplyButton": {
"displayText": "Get Offer",
"id": "get_offer_id"
}
},
{
"urlButton": {
"displayText": "View Details",
"url": "https://smartwats.com/offers"
}
}
]
}
]
}
- Number Format: Include
@s.whatsapp.net
suffix for individual chats - Image Structure: Use object format with
{"url": "..."}
- Parameter Names: Use either
cards
ortemplateCarousel
(both work) - Card Footer: Each card can have its own footer (price, subtitle, etc.)
- Carousel Footer: Main footer appears at the bottom of entire carousel
- Arabic Support: Full Unicode/RTL text support for all languages
- Image Formats: Supports JPG, PNG, GIF (animated GIFs supported!)
- Mix different button types in the same carousel for maximum flexibility
- Use copy buttons for promotional codes, OTP verification, or referral links
- Add call buttons for customer support or sales inquiries
- Combine URL buttons with quick reply buttons for seamless user experience
- Each card can have 1-3 buttons (recommended: 2 buttons per card for best UX)
- Use high-quality images (minimum 640x640px recommended)
- Keep card titles concise (max 24 characters for best display)
Get Groups
GETRetrieve all WhatsApp groups from your instance.
Endpoint
GET https://app.smartwats.com/api/get_groups
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Example Request
curl -X GET "https://app.smartwats.com/api/get_groups?instance_id=YOUR_INSTANCE_ID&access_token=YOUR_TOKEN"
Send Message to Group
POSTSend messages to WhatsApp groups. Supports text, media, and templates.
Endpoint
POST https://app.smartwats.com/api/send_group
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
group_id |
string | Yes | Group ID (format: XXXXXXXXXX@g.us) |
type |
string | Yes | "text", "media", "button", "list", or "poll" |
message |
string | Yes | Message content |
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Example Request
{
"group_id": "1234567890@g.us",
"type": "text",
"message": "Hello group!",
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}
Validate Phone Number
GETCheck if a phone number is registered on WhatsApp.
Endpoint
GET https://app.smartwats.com/api/check_phone
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
phone |
string | Yes | Phone number to validate |
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Batch Phone Validation
POSTValidate multiple phone numbers at once.
Endpoint
POST https://app.smartwats.com/api/check_phones_batch
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
phones |
array | Yes | Array of phone numbers |
instance_id |
string | Yes | Your instance identifier |
access_token |
string | Yes | Your authentication token |
Example Request
{
"phones": ["9665XXXXXXX", "9665YYYYYYY", "9665ZZZZZZZ"],
"instance_id": "YOUR_INSTANCE_ID",
"access_token": "YOUR_TOKEN"
}