Number on WhatsApp?
curl --request GET \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/phone-exists/{phone} \
--header 'Client-Token: <api-key>'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/phone-exists/{phone}"
headers = {"Client-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'Client-Token': '<api-key>'}};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/phone-exists/{phone}', 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}/phone-exists/{phone}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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}/phone-exists/{phone}"
req, _ := http.NewRequest("GET", 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.get("https://api.z-api.io/instances/{instanceId}/token/{token}/phone-exists/{phone}")
.header("Client-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/phone-exists/{phone}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Client-Token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"exists": true,
"phone": "<string>",
"lid": "<string>"
}Contacts
Number on WhatsApp?
Check if a number has a WhatsApp account
GET
/
instances
/
{instanceId}
/
token
/
{token}
/
phone-exists
/
{phone}
Number on WhatsApp?
curl --request GET \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/phone-exists/{phone} \
--header 'Client-Token: <api-key>'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/phone-exists/{phone}"
headers = {"Client-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'Client-Token': '<api-key>'}};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/phone-exists/{phone}', 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}/phone-exists/{phone}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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}/phone-exists/{phone}"
req, _ := http.NewRequest("GET", 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.get("https://api.z-api.io/instances/{instanceId}/token/{token}/phone-exists/{phone}")
.header("Client-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/phone-exists/{phone}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Client-Token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"exists": true,
"phone": "<string>",
"lid": "<string>"
}Overview
This method returns whether a number has WhatsApp or not.Use this API whenever you want to check if a number has WhatsApp, usually for form validation. Do not use this API if you want to verify before sending a message, as Z-API already validates the number’s existence for each message sent.
Attributes
Header
string
required
Your instance ID. Available in the Z-API panel under Instances.
string
required
Your Z-API instance token.
Query Parameters
string
required
Contact phone number in DDI DDD NUMBER format. E.g.: 551199999999
Response
200
boolean
Whether the number has WhatsApp
string
Formatted number per WhatsApp’s response
string
WhatsApp’s unique private identifier (null if exists = false)
[
{
"exists": true,
"phone": "5544999999999",
"lid": "999999999@lid"
}
]