Remove contacts
curl --request DELETE \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove \
--header 'Client-Token: <api-key>'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove"
headers = {"Client-Token": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'Client-Token': '<api-key>'}};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Client-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Client-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove")
.header("Client-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Client-Token"] = '<api-key>'
response = http.request(request)
puts response.read_bodyContacts
Remove contacts
Remove WhatsApp contacts from the phone’s contact list
DELETE
/
instances
/
{instanceId}
/
token
/
{token}
/
contacts
/
remove
Remove contacts
curl --request DELETE \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove \
--header 'Client-Token: <api-key>'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove"
headers = {"Client-Token": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'Client-Token': '<api-key>'}};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Client-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Client-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove")
.header("Client-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/contacts/remove")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Client-Token"] = '<api-key>'
response = http.request(request)
puts response.read_bodyOverview
This method is responsible for removing WhatsApp contacts from your phone’s contact list.About this featureThe method for removing contacts from the WhatsApp list will only work for accounts that have already received the necessary update. Make sure your WhatsApp account has received the update before using this feature. Otherwise, the operation will not be completed successfully.
Attributes
Header
Your instance ID. Available in the Z-API panel under Instances.
Your Z-API instance token.
Request Body
["554499999999", "554499998888"]
Response
200
{
"success": true,
"errors": []
}
405
Make sure you are correctly sending the method specification, that is, verify that you sent DELETE as specified at the beginning of this topic.415
If you receive a 415 error, make sure to add the “Content-Type” header to your request, which in most cases is “application/json”.⌘I