Delete an existing channel
Agent Skill
Automate this endpoint with an AI agent using the 2chat-whatsapp skill:
npx skills add 2ChatCo/agent-skills -s 2chat-whatsapp
With this endpoint you can delete a channel you connected to 2Chat.
API costโ
1API credit
Each call to this endpoint deducts 1 API credit from your plan's API credit pool.
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
- JavaScript
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
}