Supprimer plusieurs contacts
curl --request DELETE \
--url https://api.wachap.com/v1/contact-groups/{id}/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contactIndexes": [
123
]
}
'const options = {
method: 'DELETE',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({contactIndexes: [123]})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'DELETE',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({contactIndexes: [123]})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/contact-groups/{id}/contacts"
payload = { "contactIndexes": [123] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/contact-groups/{id}/contacts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'contactIndexes' => [
123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wachap.com/v1/contact-groups/{id}/contacts"
payload := strings.NewReader("{\n \"contactIndexes\": [\n 123\n ]\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}Listes de contacts
Supprimer plusieurs contacts
Supprimez plusieurs contacts (Bulk Delete) en une seule requête. Utile pour nettoyer des listes ou supprimer des contacts en masse
DELETE
/
contact-groups
/
{id}
/
contacts
Supprimer plusieurs contacts
curl --request DELETE \
--url https://api.wachap.com/v1/contact-groups/{id}/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contactIndexes": [
123
]
}
'const options = {
method: 'DELETE',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({contactIndexes: [123]})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'DELETE',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({contactIndexes: [123]})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/contact-groups/{id}/contacts"
payload = { "contactIndexes": [123] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/contact-groups/{id}/contacts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'contactIndexes' => [
123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wachap.com/v1/contact-groups/{id}/contacts"
payload := strings.NewReader("{\n \"contactIndexes\": [\n 123\n ]\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}Endpoint
Headers
string
requis
Bearer token avec votre Secret Key (format:
Bearer sk_...)URL Parameters
string
requis
L’identifiant de la liste
Body Parameters
array
requis
Tableau des index des contacts à supprimer
Exemples de requêtes
curl -X DELETE https://api.wachap.com/v1/contact-groups/65f1234567890abcdef12345/contacts \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token" \
-d '{
"contactIndexes": [0, 1, 2, 5, 8, 12]
}'
const response = await fetch('https://api.wachap.com/v1/contact-groups/65f1234567890abcdef12345/contacts', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer token',
'Content-Type': 'application/json'
},
body: JSON.stringify({
contactIndexes: [0, 1, 2, 5]
})
});
const data = await response.json();
console.log(data);
Exemple de réponse
{
"success": true,
"message": "6 contact(s) supprimé(s) avec succès",
"deletedContacts": 6,
"deletedColumns": 42
}
Notes importantes
- Suppression multiple : Tous les contacts spécifiés sont supprimés en une seule transaction
- Tous les champs : Tous les champs personnalisés de chaque contact sont supprimés
- Irréversible : Cette action ne peut pas être annulée
- Index conservés : Les autres contacts conservent leurs index originaux
Codes d’erreur
| Code | Description |
|---|---|
400 | INVALID_INDEXES - contactIndexes doit être un tableau non vide |
401 | INVALID_SECRET_KEY - Clé secrète invalide |
404 | Liste non trouvée |
500 | DELETE_MULTIPLE_CONTACTS_ERROR - Erreur lors de la suppression |
