Reset the Challenge
curl --request POST \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/reset-passkey-challenge \
--header 'Client-Token: <api-key>'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/reset-passkey-challenge"
headers = {"Client-Token": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'Client-Token': '<api-key>'}};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/reset-passkey-challenge', 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}/reset-passkey-challenge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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}/reset-passkey-challenge"
req, _ := http.NewRequest("POST", 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.post("https://api.z-api.io/instances/{instanceId}/token/{token}/reset-passkey-challenge")
.header("Client-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/reset-passkey-challenge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Client-Token"] = '<api-key>'
response = http.request(request)
puts response.read_bodyInstance
Reset the Challenge
Resets the current passkey challenge, allowing a new QR Code to be generated
POST
/
instances
/
{instanceId}
/
token
/
{token}
/
reset-passkey-challenge
Reset the Challenge
curl --request POST \
--url https://api.z-api.io/instances/{instanceId}/token/{token}/reset-passkey-challenge \
--header 'Client-Token: <api-key>'import requests
url = "https://api.z-api.io/instances/{instanceId}/token/{token}/reset-passkey-challenge"
headers = {"Client-Token": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'Client-Token': '<api-key>'}};
fetch('https://api.z-api.io/instances/{instanceId}/token/{token}/reset-passkey-challenge', 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}/reset-passkey-challenge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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}/reset-passkey-challenge"
req, _ := http.NewRequest("POST", 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.post("https://api.z-api.io/instances/{instanceId}/token/{token}/reset-passkey-challenge")
.header("Client-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.z-api.io/instances/{instanceId}/token/{token}/reset-passkey-challenge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Client-Token"] = '<api-key>'
response = http.request(request)
puts response.read_bodyOverview
On some devices, WhatsApp has started requiring an additional verification step when attempting to connect to WhatsApp Web, called Passkey. Because of this, devices that try to read the QR Code via the API may receive a Challenge in return.
This endpoint invalidates the current passkey flow. After a successful call, the qr-code endpoint must be called again to obtain the new QR Code.
Attributes
Required
string
required
Your instance ID. Available in the Z-API panel under Instances.
string
required
Your Z-API instance token.
Response
200
Returns the result of the processing by the instance. There are two possible variations: Success — challenge reset:{ "success": true }
{ "success": false, "error": "Failed to restart instance after challenge reset" }
On success, call the qr-code endpoint again to obtain the new QR Code.
400
Returned in the following cases:- Instance not found for the
instanceId+tokenpair:
{ "error": "Instance not found", "value": null }