API Documentation • Self-hosted WhatsApp API • Built on waha.devlike.pro

Sunsal Documentation API

🏠/Documentation API
🚀

Documentation API Gateway

Last updated: September 8th, 2025

Complete reference for integrating Sunsal Wapim WhatsApp API into your applications. Manage sessions, send messages, and automate WhatsApp communications.

Authentication

All API requests require authentication using X-Session-Id & X-Session-Secret-Token. Include your token in the header:

X-Session-Id: {{ SESSION_ID }}
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }}

Base URL

{{ API_URL }}

Accept

application/json
GET /devices

Get All Devices

Fetch a list of all devices registered in the system. Useful for dashboards or monitoring multiple WhatsApp devices.

Response

JSON
{
    "status": true,
    "message": "",
    "data": {
        "list": [
            {
                "id": 1,
                "name": "WAPI Test",
                "session_id": "wapi-test",
                "phone_number": "62811010010010",
                "status": "scan_qr_code",
                "secret_token": "9f13a714ce15ddeb1e02835772b53fcc5de6355f05204354bbbc0023601816ee",
                "webhook_status": 1,
                "webhook_url": "https://f947f32ac09a.ngrok-free.app/api/v1/waha-webhook",
                "webhook_options": "[\"message\",\"message.ack\",\"message.waiting\"]",
                "opening_message": "Hello",
                "closing_message": "Hola",
                "auto_reply": "Hai",
                "auto_forward": "Hei",
                "auto_forward_number": "62811010010010"
            }
        ],
        "meta": {
            "links": [
                "http://127.0.0.1:8000/api/devices?sort=id%20DESC&page=1"
            ],
            "total": 1
        }
    }
}
GET /devices/:id

Get Detail Device

Retrieve complete information about a single device by ID. Returns metadata such as device name, status, and linked account.

Response

JSON
{
    "status": true,
    "message": "",
    "data": {
        "id": 1,
        "name": "WAPI Test",
        "session_id": "wapi-test",
        "phone_number": "62811010010010",
        "status": "scan_qr_code",
        "secret_token": "9f13a714ce15ddeb1e02835772b53fcc5de6355f05204354bbbc0023601816ee",
        "webhook_status": 1,
        "webhook_url": "https://f947f32ac09a.ngrok-free.app/api/v1/waha-webhook",
        "webhook_options": "[\"message\",\"message.ack\",\"message.waiting\"]",
        "opening_message": "Hello",
        "closing_message": "Hola",
        "auto_reply": "Hai",
        "auto_forward": "Hei",
        "auto_forward_number": "62811010010010"
    }
}
POST /devices

Create Device

Add a new device entry into the system. Often used when setting up a new WhatsApp client.

Request Body

JSON
{
    "name": "WAPI Test",
    "phone_number": "0811010010010",
    "secret_token": "9f13a714ce15ddeb1e02835772b53fcc5de6355f05204354bbbc0023601816ee",
    "webhook_status": true,
    "webhook_url": "https://f947f32ac09a.ngrok-free.app/api/v1/waha-webhook",
    "webhook_options": [
        "message",
        "message.ack",
        "message.waiting"
    ],
    "opening_message": "Hello",
    "closing_message": "Hola",
    "auto_reply": "Hai",
    "auto_forward": "Hei",
    "auto_forward_number": "811010010010"
}

Response

JSON
{
    "status": true,
    "message": "Data successfully added",
    "data": {
        "id": 1,
        "name": "WAPI Test",
        "session_id": "wapi-test",
        "phone_number": "62811010010010",
        "status": "scan_qr_code",
        "secret_token": "9f13a714ce15ddeb1e02835772b53fcc5de6355f05204354bbbc0023601816ee",
        "webhook_status": true,
        "webhook_url": "https://f947f32ac09a.ngrok-free.app/api/v1/waha-webhook",
        "webhook_options": "[\"message\",\"message.ack\",\"message.waiting\"]",
        "opening_message": "Hello",
        "closing_message": "Hola",
        "auto_reply": "Hai",
        "auto_forward": "Hei",
        "auto_forward_number": "62811010010010"
    }
}
PUT /devices/:id

Update Device

Modify device details (name, configuration, webhook URL, etc.).

Request Body

JSON
{
    "name": "WAPI Test",
    "phone_number": "0811010010010",
    "secret_token": "9f13a714ce15ddeb1e02835772b53fcc5de6355f05204354bbbc0023601816ee",
    "webhook_status": true,
    "webhook_url": "https://f947f32ac09a.ngrok-free.app/api/v1/waha-webhook",
    "webhook_options": [
        "message",
        "message.ack",
        "message.waiting"
    ],
    "opening_message": "Hello",
    "closing_message": "Hola",
    "auto_reply": "Hai",
    "auto_forward": "Hei",
    "auto_forward_number": "811010010010"
}

Response

JSON
{
    "status": true,
    "message": "Data successfully modified",
    "data": {
        "id": 1,
        "name": "WAPI Test",
        "session_id": "wapi-test",
        "phone_number": "62811010010010",
        "status": "scan_qr_code",
        "secret_token": "9f13a714ce15ddeb1e02835772b53fcc5de6355f05204354bbbc0023601816ee",
        "webhook_status": 1,
        "webhook_url": "https://f947f32ac09a.ngrok-free.app/api/v1/waha-webhook",
        "webhook_options": "[\"message\",\"message.ack\",\"message.waiting\"]",
        "opening_message": "Hello",
        "closing_message": "Hola",
        "auto_reply": "Hai",
        "auto_forward": "Hei",
        "auto_forward_number": "62811010010010"
    }
}
DELETE /devices/:id

Delete Device

Soft-delete a device. It will not be permanently erased, and can be restored later if needed.

Response

JSON
{
    "status": true,
    "message": "Data successfully deleted",
    "data": {
        "id": 1,
        "name": "WAPI Test",
        "session_id": "wapi-test",
        "phone_number": "62811010010010",
        "status": "scan_qr_code",
        "secret_token": "9f13a714ce15ddeb1e02835772b53fcc5de6355f05204354bbbc0023601816ee",
        "webhook_status": 1,
        "webhook_url": "https://f947f32ac09a.ngrok-free.app/api/v1/waha-webhook",
        "webhook_options": "[\"message\",\"message.ack\",\"message.waiting\"]",
        "opening_message": "Hello",
        "closing_message": "Hola",
        "auto_reply": "Hai",
        "auto_forward": "Hei",
        "auto_forward_number": "62811010010010"
    }
}
PUT /devices/:id/restore

Restore Device

Restore a previously deleted device back to active state. Useful for accidental deletions or temporary suspensions.

Response

JSON
{
    "status": true,
    "message": "Data successfully restored",
    "data": {
        "id": 1,
        "name": "WAPI Test",
        "session_id": "wapi-test",
        "phone_number": "62811010010010",
        "status": "scan_qr_code",
        "secret_token": "9f13a714ce15ddeb1e02835772b53fcc5de6355f05204354bbbc0023601816ee",
        "webhook_status": 1,
        "webhook_url": "https://f947f32ac09a.ngrok-free.app/api/v1/waha-webhook",
        "webhook_options": "[\"message\",\"message.ack\",\"message.waiting\"]",
        "opening_message": "Hello",
        "closing_message": "Hola",
        "auto_reply": "Hai",
        "auto_forward": "Hei",
        "auto_forward_number": "62811010010010"
    }
}
GET /messages

Get All Messages

Retrieve all messages stored in the system. Useful for logs, audit trails, or message dashboards.

Headers

X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Response

JSON
{
    "status": true,
    "message": "",
    "data": {
        "list": [
            {
                "id": 1,
                "device_id": 1,
                "session_id": "wapi-test",
                "is_queue": 1,
                "recipient": "62811010010010",
                "message_type": "text",
                "message": "Welcome home",
                "file_mimetype": null,
                "file_filename": null,
                "file_url": null,
                "calendar_type": "masehi",
                "schedule_at": "2025-09-08T02:44:00.000000Z",
                "status": "pending",
                "is_sent": 0,
                "provider_message_id": null,
                "api_response": null,
                "sent_at": null,
                "delivered_at": null,
                "read_at": null,
                "status_updated_at": null
            }
        ],
        "meta": {
            "links": [
                "http://127.0.0.1:8000/api/messages?sort=id%20DESC&page=1"
            ],
            "total": 1
        }
    }
}
GET /messages/:id

Get Detail Message

Fetch complete details of a specific message, including content, status, and recipient info.

Headers

X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Response

JSON
{
    "status": true,
    "message": "",
    "data": {
        "id": 1,
        "device_id": 1,
        "session_id": "wapi-test",
        "is_queue": 1,
        "recipient": "62811010010010",
        "message_type": "text",
        "message": "Welcome home",
        "file_mimetype": null,
        "file_filename": null,
        "file_url": null,
        "calendar_type": "masehi",
        "schedule_at": "2025-09-08T02:44:00.000000Z",
        "status": "pending",
        "is_sent": 0,
        "provider_message_id": null,
        "api_response": null,
        "sent_at": null,
        "delivered_at": null,
        "read_at": null,
        "status_updated_at": null
    }
}
POST /messages

Create Message

Store a new message record. Typically used before sending or for internal logging.

Headers

X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Request Body

JSON
{
    "session_id": "SESSION_ID",
    "is_queue": true,
    "recipient": "0811010010010",
    "message_type": "text",
    "message": "Welcome home",
    "file_url": "https://github.com/devlikeapro/waha/raw/core/examples/waha.jpg",
    "schedule_at": "2025-09-08 09:44:00"
}

Response

JSON
{
    "status": true,
    "message": "Data successfully added",
    "data": {
        "id": 1,
        "device_id": 1,
        "session_id": "wapi-test",
        "is_queue": true,
        "recipient": "62811010010010",
        "message_type": "text",
        "message": "Welcome home",
        "file_mimetype": null,
        "file_filename": null,
        "file_url": null,
        "calendar_type": null,
        "schedule_at": "2025-09-08T02:44:00.000000Z",
        "status": null,
        "is_sent": null,
        "provider_message_id": null,
        "api_response": null,
        "sent_at": null,
        "delivered_at": null,
        "read_at": null,
        "status_updated_at": null
    }
}
POST /messages-batch

Create Batch Message

Store multiple messages in a single request. Efficient for campaigns or bulk messaging where many recipients are targeted.

Headers

X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Request Body

JSON
{
    "items": [
        {
            "session_id": "SESSION_ID",
            "is_queue": false,
            "recipient": "62811010010010",
            "message_type": "text",
            "message": "Hai 1",
            "schedule_at": "2025-09-08 09:51:00"
        },
        {
            "session_id": "SESSION_ID",
            "is_queue": true,
            "recipient": "62811010010010",
            "message_type": "image",
            "message": "Cek gambar",
            "file_url": "https://github.com/devlikeapro/waha/raw/core/examples/waha.jpg",
            "schedule_at": "2025-09-08 09:52:00"
        },
        {
            "session_id": "SESSION_ID",
            "is_queue": true,
            "recipient": "62811010010010",
            "message_type": "file",
            "message": "PDF besok",
            "file_url": "https://api.rucika.co.id/price-list/16/download",
            "schedule_at": "2025-09-08 09:53:00"
        }
    ]
}

Response

JSON
{
    "status": true,
    "message": "Batch processed",
    "data": {
        "batch_id": "9fd352e1-a8bd-4bc7-a9cc-b9c9e1f47167",
        "items": [
            {
                "index": 0,
                "status": true,
                "message_id": "4"
            },
            {
                "index": 1,
                "status": true,
                "message_id": "5"
            },
            {
                "index": 2,
                "status": true,
                "message_id": "6"
            }
        ]
    }
}
PUT /messages/:id

Update Message

Edit message details or status. For example, mark a message as “processed” or update metadata.

Headers

X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Request Body

JSON
{
    "session_id": "SESSION_ID",
    "is_queue": false,
    "recipient": "0811010010010",
    "message_type": "text",
    "message": "Hola",
    "file_url": "https://github.com/devlikeapro/waha/raw/core/examples/waha.jpg",
    "schedule_at": "2025-09-08 10:00:00"
}

Response

JSON
{
    "status": true,
    "message": "Data successfully modified",
    "data": {
        "id": 1,
        "device_id": 1,
        "session_id": "wapi-test",
        "is_queue": 0,
        "recipient": "62811010010010",
        "message_type": "text",
        "message": "Hola",
        "file_mimetype": null,
        "file_filename": null,
        "file_url": null,
        "calendar_type": "masehi",
        "schedule_at": null,
        "status": "sent",
        "is_sent": 1,
        "provider_message_id": "true_62811010010010@c.us_3EB0A5E42732E237A42D7F",
        "api_response": null,
        "sent_at": "2025-09-08T02:44:36.000000Z",
        "delivered_at": null,
        "read_at": null,
        "status_updated_at": "2025-09-08T02:44:36.000000Z"
    }
}
DELETE /messages/:id

Delete Message

Soft-delete a message. It remains in the system but inactive.

Headers

X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Response

JSON
{
    "status": true,
    "message": "Data successfully deleted",
    "data": {
        "id": 1,
        "device_id": 1,
        "session_id": "wapi-test",
        "is_queue": 0,
        "recipient": "62811010010010",
        "message_type": "text",
        "message": "Hola",
        "file_mimetype": null,
        "file_filename": null,
        "file_url": null,
        "calendar_type": "masehi",
        "schedule_at": null,
        "status": "sent",
        "is_sent": 1,
        "provider_message_id": "true_62811010010010@c.us_3EB0A5E42732E237A42D7F",
        "api_response": null,
        "sent_at": "2025-09-08T02:44:36.000000Z",
        "delivered_at": null,
        "read_at": null,
        "status_updated_at": "2025-09-08T02:44:36.000000Z"
    }
}
PUT /messages/:id/restore

Restore Message

Restore a previously deleted message back into active records.

Headers

X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Response

JSON
{
    "status": true,
    "message": "Data successfully restored",
    "data": {
        "id": 1,
        "device_id": 1,
        "session_id": "wapi-test",
        "is_queue": 0,
        "recipient": "62811010010010",
        "message_type": "text",
        "message": "Hola",
        "file_mimetype": null,
        "file_filename": null,
        "file_url": null,
        "calendar_type": "masehi",
        "schedule_at": null,
        "status": "sent",
        "is_sent": 1,
        "provider_message_id": "true_62811010010010@c.us_3EB0A5E42732E237A42D7F",
        "api_response": null,
        "sent_at": "2025-09-08T02:44:36.000000Z",
        "delivered_at": null,
        "read_at": null,
        "status_updated_at": "2025-09-08T02:44:36.000000Z"
    }
}
GET /v1/waha/sessions/:session_id/me

Get Me Session

Retrieve details about the current authenticated WhatsApp account. Often used to confirm the number and profile of the logged-in account.

Headers

Accept: application/json // Instructs the server to return responses in JSON format.
X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Response

JSON
{
    "id": "62811010010010@c.us",
    "pushName": "User Guest",
    "jid": "62811010010010:89@s.whatsapp.net"
}
GET /v1/waha/:session_id/profile

Get Profile Session

Fetch the WhatsApp profile data of the connected session. Returns display name, profile picture, and other info.

Headers

Accept: application/json // Instructs the server to return responses in JSON format.
X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Response

JSON
{
    "id": "62811010010010@c.us",
    "name": "User Guest",
    "picture": "https://pps.whatsapp.net/v/t61.24694-24/534423495_2212800639238447_2813432646728527521_n.jpg"
}
POST /v1/waha/sessions/:session_id/restart

Restart Session

Restart a session if it becomes disconnected or unstable. Useful for automatic recovery without creating a new session.

Headers

Accept: application/json // Instructs the server to return responses in JSON format.
X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Response

JSON
{
    "name": "wapi-test",
    "status": "STARTING",
    "config": {
        "metadata": {
            "user.id": "1",
            "user.email": "userguest@gmail.com"
        },
        "proxy": null,
        "debug": false,
        "noweb": {
            "markOnline": true,
            "store": {
                "enabled": true,
                "fullSync": false
            }
        },
        "webhooks": [
            {
                "url": "https://f947f32ac09a.ngrok-free.app/api/v1/waha-webhook",
                "events": [
                    "session.status",
                    "message.ack",
                    "message.waiting"
                ],
                "hmac": null,
                "retries": null,
                "customHeaders": null
            }
        ]
    },
    "engine": {
        "grpc": {
            "client": "READY",
            "stream": "READY"
        },
        "gows": {
            "found": true,
            "connected": true
        }
    }
}
POST /v1/waha/sessions/:session_id/logout

Logout Session

Log out from the WhatsApp account but keep the session entry intact in the system.

Headers

Accept: application/json // Instructs the server to return responses in JSON format.
X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Response

JSON
{
    "name": "wapi-test",
    "status": "STARTING",
    "config": {
        "metadata": {
            "user.id": "1",
            "user.email": "userguest@gmail.com"
        },
        "proxy": null,
        "debug": false,
        "noweb": {
            "markOnline": true,
            "store": {
                "enabled": true,
                "fullSync": false
            }
        },
        "webhooks": [
            {
                "url": "https://f947f32ac09a.ngrok-free.app/api/v1/waha-webhook",
                "events": [
                    "session.status",
                    "message.ack",
                    "message.waiting"
                ],
                "hmac": null,
                "retries": null,
                "customHeaders": null
            }
        ]
    },
    "engine": {
        "grpc": {
            "client": "READY",
            "stream": "READY"
        },
        "gows": {
            "found": true,
            "connected": true
        }
    }
}
GET /v1/waha/:session_id/auth/qr.png?format=image

Generate QR Code

Generate a QR code to be scanned in WhatsApp mobile app for creating or reconnecting a session.

Headers

X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Parameters

format=image // Output format, e.g. image
GET /generate-token

Generate Secret Token

Generate an authentication token (Session Secret Token) for secure API calls.

Headers

Accept: application/json // Instructs the server to return responses in JSON format.

Response

JSON
{
    "secret_token": "9126751aaadb2fa796d969a41831ad9c1c36577e0d61572b89b75e5d64d75206"
}
GET /v1/waha/contacts/check-exists?phone=62895395151395&session=SESSION_ID

Check Phone Number

Validate whether a phone number is registered with WhatsApp. Prevents wasted API calls to numbers that don’t exist.

Headers

Accept: application/json // Instructs the server to return responses in JSON format.
X-Session-Id: {{ SESSION_ID }} // The target WhatsApp session ID.
X-Session-Secret-Token: {{ SESSION_SECRET_TOKEN }} // Secret token for session security.

Parameters

phone=62895395151395 // Recipient phone number in international format (string).
session={{ SESSION_ID }} // WhatsApp session identifier (string)

Response

JSON
{
    "numberExists": true,
    "chatId": "62895395151395@c.us"
}