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.

Base URL: https://app.smartwats.com/api/
API Version: v1.3
🔑 Before You Start:
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

📍 Get Your Access Token & Instance ID:
  1. Login to SmartWats: https://app.smartwats.com/whatsapp_profile
  2. Create a new instance or select existing one
  3. Scan the QR code with your WhatsApp mobile app
  4. After successful connection, your Instance ID and Access Token will appear on the page
  5. 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)
âš ī¸ Important: Keep your access token secure! Never share it publicly or commit it to version control systems. Anyone with your access token can send messages through your WhatsApp instance.

Quick Start

Get started with the SmartWats API in just a few minutes:

Step 1: Get Your Credentials

  1. Visit SmartWats WhatsApp Profile
  2. Login to your account
  3. Create a new WhatsApp instance
  4. Scan the QR code with your WhatsApp mobile app
  5. 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
💡 Tip: Use the navigation menu on the left to explore all available endpoints and features. Each endpoint includes detailed examples and parameter descriptions.

Create Instance

POST

Create 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

GET

Display 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

GET

Get 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

POST

Logout 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

POST

Configure 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"
}
Security Requirements:
  • Webhook URL must use HTTPS protocol
  • Cannot point to localhost or private IP addresses
  • Must be a publicly accessible URL
Note: If allowed_events is not specified or is empty, all event types will be sent to your webhook URL.

Send Text Message

POST

Send 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

POST

Send 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

POST

Send 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

POST

Send 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

POST

Send 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)

POST

Send 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"
  }'
Note: WhatsApp only displays one caption per album. The caption parameter applies to the entire album, not individual items.

Send Copy Button Message

POST

Send a message with a copy button that allows users to quickly copy text (e.g., OTP codes, voucher codes).

Endpoint

POST https://app.smartwats.com/api/send_button_copy

Parameters

Parameter Type Required Description
number string Yes Recipient phone number
text string Yes Message body text
code string Yes Text to be copied when button is clicked
textdisplay string Yes Button display text
footer string No Footer text
instance_id string Yes Your instance identifier
access_token string Yes Your authentication token

Example Request

{
  "number": "9665XXXXXXX",
  "text": "Your OTP code is ready",
  "code": "123456",
  "textdisplay": "Copy OTP",
  "footer": "SmartWats",
  "instance_id": "YOUR_INSTANCE_ID",
  "access_token": "YOUR_TOKEN"
}

cURL Example

curl -X POST "https://app.smartwats.com/api/send_button_copy" \
  -H "Content-Type: application/json" \
  -d '{
    "number": "9665XXXXXXX",
    "text": "Your OTP code is ready",
    "code": "123456",
    "textdisplay": "Copy OTP",
    "footer": "SmartWats",
    "instance_id": "YOUR_INSTANCE_ID",
    "access_token": "YOUR_TOKEN"
  }'

Send URL Button Message

POST

Send a message with a button that opens a URL when clicked. Optionally include an image.

Endpoint

POST https://app.smartwats.com/api/send_button_url

Parameters

Parameter Type Required Description
number string Yes Recipient phone number
text string Yes* Message text (required if no image)
url string Yes URL to open when button is clicked
textdisplay string Yes Button display text
footer string No Footer text
image string No Image URL (optional)
instance_id string Yes Your instance identifier
access_token string Yes Your authentication token

Example Request - Text Only

{
  "number": "9665XXXXXXX",
  "text": "Visit our website for more info",
  "url": "https://smartwats.com",
  "textdisplay": "Visit Website",
  "footer": "SmartWats",
  "instance_id": "YOUR_INSTANCE_ID",
  "access_token": "YOUR_TOKEN"
}

Example Request - With Image

{
  "number": "9665XXXXXXX",
  "text": "Check out our new products!",
  "url": "https://smartwats.com/shop",
  "textdisplay": "Shop Now",
  "footer": "SmartWats",
  "image": "https://example.com/banner.jpg",
  "instance_id": "YOUR_INSTANCE_ID",
  "access_token": "YOUR_TOKEN"
}

Send Reply Buttons Message

POST

Send a message with up to 3 quick reply buttons. Optionally include an image.

Endpoint

POST https://app.smartwats.com/api/send_button_reply

Parameters

Parameter Type Required Description
number string Yes Recipient phone number
text string Yes Message text
buttons array Yes Array of button objects (max 3)
footer string No Footer text
caption string No Caption for image (if image is included)
image string No Image URL (optional)
instance_id string Yes Your instance identifier
access_token string Yes Your authentication token

Button Object Structure

Field Type Description
displayText string Button text to display
id string Unique button identifier

Example Request

{
  "number": "9665XXXXXXX",
  "text": "How would you like to proceed?",
  "footer": "SmartWats",
  "buttons": [
    {
      "displayText": "✅ Accept",
      "id": "btn_accept"
    },
    {
      "displayText": "❌ Decline",
      "id": "btn_decline"
    },
    {
      "displayText": "â„šī¸ More Info",
      "id": "btn_info"
    }
  ],
  "instance_id": "YOUR_INSTANCE_ID",
  "access_token": "YOUR_TOKEN"
}

Alternative Format (URL Parameters)

{
  "number": "9665XXXXXXX",
  "text": "Choose an option",
  "button1_text": "Option 1",
  "button1_id": "opt1",
  "button2_text": "Option 2",
  "button2_id": "opt2",
  "button3_text": "Option 3",
  "button3_id": "opt3",
  "instance_id": "YOUR_INSTANCE_ID",
  "access_token": "YOUR_TOKEN"
}

Get Groups

GET

Retrieve 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

POST

Send 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

GET

Check 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

POST

Validate 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"
}