Delete an existing channel
With this endpoint you can delete a channel you connected to 2Chat.
Parameters
You will need to know the UUID
of the number you connected to 2Chat.
You can get it using the List Numbers Endpoint.
Invocation
For the following examples, we will use WPNf3ea6c85-0dca-4d8a-a9a6-2b918f59cc97
as the UUID
of the number we want to delete.
- cURL
- Python
- NodeJS
curl -X DELETE --location 'https://api.p.2chat.io/open/whatsapp/channel/WPNf3ea6c85-0dca-4d8a-a9a6-2b918f59cc97' \
--header 'Content-Type: application/json' \
--header 'X-User-API-Key: your_api_key_here'
import requests
import json
url = "https://api.p.2chat.io/open/whatsapp/channel/WPNf3ea6c85-0dca-4d8a-a9a6-2b918f59cc97"
headers = {
'Content-Type': 'application/json',
'X-User-API-Key': 'your_api_key_here'
}
response = requests.request("DELETE", url, headers=headers)
print(response.text)
const axios = require('axios');
let config = {
method: 'DELETE',
maxBodyLength: Infinity,
url: 'https://api.p.2chat.io/open/whatsapp/channel/WPNf3ea6c85-0dca-4d8a-a9a6-2b918f59cc97',
headers: {
'Content-Type': 'application/json',
'X-User-API-Key': 'your_api_key_here'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Response
If the deletion was successful, you will see the following output:
{
"success": true
}