Delete a collection
This endpoint will let you delete an existing collection using its ID.
info
To use this API, you must connect a number that uses the free version of WhatsApp Business. This API does not need a WhatsApp Business API account to work.
Invocation
Make a DELETE
request to https://api.p.2chat.io/open/whatsapp/catalog/collection/<collection-id>
, where:
collection-id
: is the ID of the collection you want to delete. You can obtain it using the List Collections endpoint.
Request body
For each request, you must specify the phone number you connected to 2Chat that you want to use as the client.
{
"from_number": "+595981461442"
}
In the following examples, we are using 268305749345797
as the collection ID.
- cURL
- Python
- NodeJS
curl --location --request DELETE 'https://api.p.2chat.io/open/whatsapp/catalog/collection/268305749345797' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"from_number": "+595981461442"
}'
import requests
url = "https://api.p.2chat.io/open/whatsapp/catalog/collection/268305749345797"
payload = json.dumps({
"from_number": "+595981461442"
})
headers = {
'X-User-API-Key': 'your_api_key_here'
}
response = requests.request("DELETE", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
let data = JSON.stringify({
"from_number": "+595981461442"
});
var config = {
method: 'DELETE',
url: 'https://api.p.2chat.io/open/whatsapp/catalog/collection/268305749345797',
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
{
"success": true
}