Skip to content

Devices API

The Devices API allows you to manage WhatsApp devices connected to your account.

Connect Device

Connect a WhatsApp device and get a QR code for scanning.

Endpoint

GET /connect/{device}

Path Parameters

ParameterTypeRequiredDescription
devicestringYesThe mobile number of the device

Example Request

bash
curl -X GET \
  https://{subdomain}.whatsgate.net/api/connect/123456789 \
  -H 'Access-Token: {api_token}'

Example Response

json
{
  "success": true,
  "qrCode": "data:image/png;base64,..."
}

Error Response

json
{
  "success": false,
  "message": "device not found!"
}

Get Device Status

Get the connection status of a WhatsApp device.

Endpoint

GET /status/{device}

Path Parameters

ParameterTypeRequiredDescription
devicestringYesThe mobile number of the device

Example Request

bash
curl -X GET \
  https://{subdomain}.whatsgate.net/api/status/123456789 \
  -H 'Access-Token: {api_token}'

Example Response

json
{
  "success": true,
  "message": "connected"
}

INFO

The status can be one of the following:

  • "connected"
  • "disconnected"
  • "not connected"
  • "not initialized"

Delete Device

Delete a WhatsApp device connection.

Endpoint

POST /delete

Request Parameters

ParameterTypeRequiredDescription
sender_devicestringYesThe mobile number of the device to delete

Example Request

bash
curl -X POST \
  https://{subdomain}.whatsgate.net/api/delete \
  -H 'Access-Token: {api_token}' \
  -H 'Content-Type: application/json' \
  -d '{
    "sender_device": "123456789"
}'

Example Response

json
{
  "success": true,
  "message": "Device deleted successfully"
}

Error Response

json
{
  "success": false,
  "message": "The selected sender device is invalid."
}

Error Handling

If there's an error with your request, you'll receive a response with a success field set to false and a message field describing the error.

Common error messages include:

  • "device not found!"
  • "device is already connected"
  • "The selected sender device is invalid."

List Devices Status

Get the connection status of all devices in your tenant account.

Endpoint

GET /devices/status

Example Request

bash
curl -X GET \
  https://{subdomain}.whatsgate.net/api/devices/status \
  -H 'Access-Token: {api_token}'

Example Response

json
{
  "success": true,
  "data": [
    {
      "mobile": "123456789",
      "name": "Support",
      "instance": "device-instance",
      "status": "connected",
      "connected": true
    }
  ],
  "total": 1
}

Released under the MIT License.