List WhatsApp Numbers
This endpoint will help you list the numbers you have connected to 2Chat.
Invocation
- cURL
- Python
- NodeJS
curl -L -G 'https://api.p.2chat.io/open/whatsapp/get-numbers' \
--header 'X-User-API-Key: your_api_key_here'
import requests
url = "https://api.p.2chat.io/open/whatsapp/get-numbers"
payload = ""
headers = {
'X-User-API-Key': 'your_api_key_here'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = '';
var config = {
method: 'get',
url: 'https://api.p.2chat.io/open/whatsapp/get-numbers',
headers: {
'X-User-API-Key': 'your_api_key_here'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Response
The API will return an array of numbers based on the numbers you have connected to 2Chat. In the example below, only 1 number is returned.
{
"success": true,
"numbers": [
{
"uuid": "WPN95841312-b54d-46e3-b0bc-6414f4a5296b",
"friendly_name": "my testing number",
"phone_number": "+595981048477",
"iso_country_code": "PY",
"pushname": "✌️",
"server": "595981048477@c.us",
"platform": "iphone",
"connection_status": "C",
"enabled": true,
"is_business_profile": false,
"channel_type": "WW",
"sync_contacts": true,
"created_at": "2022-10-31 22:05:44",
"updated_at": "2022-12-01 21:40:04"
}
]
}
Field | Description | Example values |
---|---|---|
uuid | The unique identifier of the number | WPN95841312-b54d-46e3-b0bc-6414f4a5296b |
friendly_name | the friendly name you chose for your number | my number . |
phone_number | the phone number in international format | +595981048477 |
iso_country_code | the two-letter country code of the number | US |
pushname | the nickname you chose on WhatsApp | My business |
server | WhatsApp-specific value | 595981048477@c.us |
platform | The mobile device your WhatsApp app is running on | android |
connection_status | 2Chat value indicating the connection status to WhatsApp | C = connected , D = disconnected , F = failure |
enabled | Whether the number is enabled or not on 2Chat | true |
is_business_profile | Whether the number is on Regular WhatsApp or WhatsApp for Business | false |
channel_type | The type of channel | WW = WhatsApp Web , IG = Instagram , SMS = Phone Text Messages . |
sync_contacts | Whether you have enabled importing your phone directory to 2Chat | true |