WhatsApp accounts API
List WhatsApp accounts API
Use this API to get a complete list of all your WhatsApp numbers and their connection status, in one call. Unlike List connected numbers, it includes numbers that are disconnected.
https://wbiztool.com/api/v1/whatsapp/accounts/Body: JSON or form fields
| Difference | List accounts | List connected numbers |
|---|---|---|
| Includes disconnected and deleted numbers | Yes | No |
| Item keys | whatsapp_client_id, whatsapp_number, status | id, whatsapp_client_id, whatsapp_client_number, is_connected |
message on success | Not included | okay |
Quick example#
curl -X POST https://wbiztool.com/api/v1/whatsapp/accounts/ \
-H "Content-Type: application/json" \
-d '{
"client_id": 12345,
"api_key": "YOUR_API_KEY"
}'import requests
response = requests.post(
"https://wbiztool.com/api/v1/whatsapp/accounts/",
json={
"client_id": 12345,
"api_key": "YOUR_API_KEY",
},
timeout=30,
)
result = response.json() # read the body even when the HTTP code is 400 or 403
if result.get("status") == 1:
for account in result["whatsapp_clients"]:
print(account["whatsapp_client_id"], account["whatsapp_number"], account["status"])
else:
print("Failed:", result.get("message", "no response"))// Node.js 18+ (built-in fetch). Save as .mjs to use top-level await.
const response = await fetch("https://wbiztool.com/api/v1/whatsapp/accounts/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
client_id: 12345,
api_key: "YOUR_API_KEY",
}),
});
const result = await response.json(); // read the body even when the HTTP code is 400 or 403
if (result.status === 1) {
for (const account of result.whatsapp_clients) {
console.log(account.whatsapp_client_id, account.whatsapp_number, account.status);
}
} else {
console.error("Failed:", result.message ?? "no response");
}<?php
$payload = [
'client_id' => 12345,
'api_key' => 'YOUR_API_KEY',
];
$ch = curl_init('https://wbiztool.com/api/v1/whatsapp/accounts/');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
if (($result['status'] ?? 0) === 1) {
foreach ($result['whatsapp_clients'] as $account) {
echo $account['whatsapp_client_id'] . ' ' . $account['whatsapp_number'] . ' ' . $account['status'] . PHP_EOL;
}
} else {
echo 'Failed: ' . ($result['message'] ?? 'no response');
}Replace 12345 and YOUR_API_KEY with your own values. See Authentication for where to find them.
Neither official client has a method for this endpoint, so call it directly as in the examples.
Request parameters#
client_idintegerrequiredYour API Client ID from Settings → API keys.
api_keystringrequiredYour API key from the same page. The list is for the workspace this key was created in.
Response#
A successful request returns HTTP 200:
{
"whatsapp_clients": [
{
"whatsapp_client_id": 678,
"whatsapp_number": "919876543210",
"status": "connected"
},
{
"whatsapp_client_id": 702,
"whatsapp_number": "919812345678",
"status": "not_connected"
}
],
"status": 1
}
| Field | Type | Description |
|---|---|---|
status | integer | 1 on success, 0 if the request failed. |
whatsapp_clients | array | Every WhatsApp number ever added to this workspace. Only present on success. |
whatsapp_clients[].whatsapp_client_id | integer | The number's ID. Pass it as whatsapp_client in other API calls. |
whatsapp_clients[].whatsapp_number | string | The phone number as it was saved when it was added. |
whatsapp_clients[].status | string | connected or not_connected. |
The list isn't sorted in any guaranteed order. Sort by whatsapp_client_id if order matters.
A successful response has no message field, so read it with a fallback as in the examples.
Errors#
| Message | HTTP | How to fix it |
|---|---|---|
Auth Error | 200 | Send both client_id and api_key in a POST body, as valid JSON or form fields. |
Invalid Client Id | 403 | Send client_id as a whole number, such as 12345. |
Auth Error: invalid api key | 400 | Check the key exists, hasn't been deleted and belongs to this client_id. |
If the server hits an unexpected problem, or the request isn't a POST, the response is an empty object: {}. Treat a missing status as a failure.
Tips#
- Reconnecting a number: a
not_connectednumber can be reconnected in WhatsApp settings or with Connect a number. - One number only: to check a single number, use Connection status.
- Several workspaces: the API key decides which workspace is listed. Use a key created in the workspace you want.
