curl --request POST \
--url https://api.wsapi.chat/session/passkey \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Instance-Id: <x-instance-id>' \
--data '
{
"rawId": "<string>",
"response": {
"clientDataJSON": "<string>",
"signature": "<string>",
"authenticatorData": "<string>",
"userHandle": "<string>"
},
"id": "<string>",
"type": "public-key"
}
'import requests
url = "https://api.wsapi.chat/session/passkey"
payload = {
"rawId": "<string>",
"response": {
"clientDataJSON": "<string>",
"signature": "<string>",
"authenticatorData": "<string>",
"userHandle": "<string>"
},
"id": "<string>",
"type": "public-key"
}
headers = {
"X-Instance-Id": "<x-instance-id>",
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Instance-Id': '<x-instance-id>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
rawId: '<string>',
response: {
clientDataJSON: '<string>',
signature: '<string>',
authenticatorData: '<string>',
userHandle: '<string>'
},
id: '<string>',
type: 'public-key'
})
};
fetch('https://api.wsapi.chat/session/passkey', 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");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-Instance-Id", "<x-instance-id>");
request.AddHeader("X-Api-Key", "<api-key>");
request.AddJsonBody("{\n \"rawId\": \"<string>\",\n \"response\": {\n \"clientDataJSON\": \"<string>\",\n \"signature\": \"<string>\",\n \"authenticatorData\": \"<string>\",\n \"userHandle\": \"<string>\"\n },\n \"id\": \"<string>\",\n \"type\": \"public-key\"\n}", false);
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": "the passkey was used on \"https://example.com\"; it must be used on https://web.whatsapp.com"
}{
"status": 401,
"detail": "unauthorized"
}{
"status": 409,
"detail": "no passkey verification pending"
}{
"detail": "invalid request body",
"status": 400
}{
"detail": "invalid request body",
"status": 400
}{
"status": 503,
"detail": "instance not available"
}Submit passkey assertion
Forwards the WebAuthn assertion produced by the account owner’s passkey to WhatsApp.
The request body is the JSON from PublicKeyCredential.toJSON() (binary fields
base64url-encoded) after calling navigator.credentials.get() on
https://web.whatsapp.com with the challenge from GET /session/passkey, e.g.:
const options = PublicKeyCredential.parseRequestOptionsFromJSON(challenge);
const credential = await navigator.credentials.get({ publicKey: options });
const body = JSON.stringify(credential.toJSON());
Only valid while the status is required and the step has not expired (5 minutes
after it was requested); otherwise returns 409. On success the returned state is
usually submitted, or confirmation_required if WhatsApp wants the user to confirm
a code.
Before forwarding, the assertion’s clientDataJSON is checked locally: its type must
be webauthn.get, its origin must be https://web.whatsapp.com, and its challenge
must match the pending one. If any check fails the request returns 400 with a message
explaining the mismatch, nothing is sent to WhatsApp, and the step stays required so
the user can try again.
curl --request POST \
--url https://api.wsapi.chat/session/passkey \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Instance-Id: <x-instance-id>' \
--data '
{
"rawId": "<string>",
"response": {
"clientDataJSON": "<string>",
"signature": "<string>",
"authenticatorData": "<string>",
"userHandle": "<string>"
},
"id": "<string>",
"type": "public-key"
}
'import requests
url = "https://api.wsapi.chat/session/passkey"
payload = {
"rawId": "<string>",
"response": {
"clientDataJSON": "<string>",
"signature": "<string>",
"authenticatorData": "<string>",
"userHandle": "<string>"
},
"id": "<string>",
"type": "public-key"
}
headers = {
"X-Instance-Id": "<x-instance-id>",
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Instance-Id': '<x-instance-id>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
rawId: '<string>',
response: {
clientDataJSON: '<string>',
signature: '<string>',
authenticatorData: '<string>',
userHandle: '<string>'
},
id: '<string>',
type: 'public-key'
})
};
fetch('https://api.wsapi.chat/session/passkey', 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");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-Instance-Id", "<x-instance-id>");
request.AddHeader("X-Api-Key", "<api-key>");
request.AddJsonBody("{\n \"rawId\": \"<string>\",\n \"response\": {\n \"clientDataJSON\": \"<string>\",\n \"signature\": \"<string>\",\n \"authenticatorData\": \"<string>\",\n \"userHandle\": \"<string>\"\n },\n \"id\": \"<string>\",\n \"type\": \"public-key\"\n}", false);
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": "the passkey was used on \"https://example.com\"; it must be used on https://web.whatsapp.com"
}{
"status": 401,
"detail": "unauthorized"
}{
"status": 409,
"detail": "no passkey verification pending"
}{
"detail": "invalid request body",
"status": 400
}{
"detail": "invalid request body",
"status": 400
}{
"status": 503,
"detail": "instance not available"
}Authorizations
Body
Response
Assertion forwarded to WhatsApp