curl --request POST \
--url https://api.wsapi.chat/session/passkey/request \
--header 'X-Api-Key: <api-key>' \
--header 'X-Instance-Id: <x-instance-id>'import requests
url = "https://api.wsapi.chat/session/passkey/request"
headers = {
"X-Instance-Id": "<x-instance-id>",
"X-Api-Key": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Instance-Id': '<x-instance-id>', 'X-Api-Key': '<api-key>'}
};
fetch('https://api.wsapi.chat/session/passkey/request', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));using RestSharp;
var options = new RestClientOptions("https://api.wsapi.chat/session/passkey/request");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-Instance-Id", "<x-instance-id>");
request.AddHeader("X-Api-Key", "<api-key>");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"status": "none",
"source": "notification",
"challenge": {
"challenge": "<string>",
"timeout": 123,
"rpId": "<string>",
"allowCredentials": [
{
"id": "<string>",
"type": "public-key",
"transports": [
"<string>"
]
}
],
"userVerification": "required",
"extensions": {}
},
"origin": "https://web.whatsapp.com",
"confirmationCode": "<string>",
"confirmationSent": true,
"error": "<string>",
"requestedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"status": 400,
"detail": "device already registered"
}{
"status": 401,
"detail": "unauthorized"
}{
"status": 409,
"detail": "could not connect to whatsapp to request the passkey challenge; try again"
}{
"detail": "invalid request body",
"status": 400
}{
"status": 503,
"detail": "instance not available"
}Request passkey challenge
Asks WhatsApp for a passkey challenge for an unpaired device. Use it when the account is
known to use a passkey but WhatsApp’s own notification (which normally sets the status to
required after the QR scan or pair code) does not arrive, or to start a passkey-only
link with no QR or pair code at all.
No existing QR or pair-code connection is required: if the device is not connected, the
call opens a connection itself (without a QR channel), waits a few seconds, then requests
the challenge. Without a prior QR scan, WhatsApp returns a challenge for a discoverable
credential (empty allowCredentials, rpId whatsapp.com, timeout 600000), and the
passkey the user picks identifies the account. Returns 409 if that connection does not
come up. If a challenge is already pending (status required, not expired), it is
returned unchanged, so the call is idempotent. While a passkey step is active (from
either source), QR code rotation is stopped so the QR timeout no longer disconnects
the device mid-passkey.
On success the state is required with source: requested; sign the challenge and
submit it with POST /session/passkey.
Without the QR handoff proof that a notification-driven challenge carries, WhatsApp asks
the owner to approve the new device on their phone, so expect confirmation_required
after submitting the assertion. The confirmation is sent automatically; show
confirmationCode so the owner can compare it and approve on their phone.
curl --request POST \
--url https://api.wsapi.chat/session/passkey/request \
--header 'X-Api-Key: <api-key>' \
--header 'X-Instance-Id: <x-instance-id>'import requests
url = "https://api.wsapi.chat/session/passkey/request"
headers = {
"X-Instance-Id": "<x-instance-id>",
"X-Api-Key": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Instance-Id': '<x-instance-id>', 'X-Api-Key': '<api-key>'}
};
fetch('https://api.wsapi.chat/session/passkey/request', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));using RestSharp;
var options = new RestClientOptions("https://api.wsapi.chat/session/passkey/request");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-Instance-Id", "<x-instance-id>");
request.AddHeader("X-Api-Key", "<api-key>");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"status": "none",
"source": "notification",
"challenge": {
"challenge": "<string>",
"timeout": 123,
"rpId": "<string>",
"allowCredentials": [
{
"id": "<string>",
"type": "public-key",
"transports": [
"<string>"
]
}
],
"userVerification": "required",
"extensions": {}
},
"origin": "https://web.whatsapp.com",
"confirmationCode": "<string>",
"confirmationSent": true,
"error": "<string>",
"requestedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"status": 400,
"detail": "device already registered"
}{
"status": 401,
"detail": "unauthorized"
}{
"status": 409,
"detail": "could not connect to whatsapp to request the passkey challenge; try again"
}{
"detail": "invalid request body",
"status": 400
}{
"status": 503,
"detail": "instance not available"
}Authorizations
Response
Pending passkey challenge