> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wsapi.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.




## OpenAPI

````yaml /openapi/wsapi-api.yaml post /session/passkey/request
openapi: 3.0.3
info:
  title: WSAPI - WhatsApp API
  description: >-
    RESTful HTTP API for WhatsApp via whatsmeow. Supports multi-instance
    connections, connections, webhook event delivery, and HMAC-SHA256 signing.
    Includes self-service instance management endpoints served by the API
    Gateway.
  version: 2.0.0
servers:
  - url: https://api.wsapi.chat
    description: WSAPI API
security:
  - ApiKeyAuth: []
tags:
  - name: Account
    description: >-
      Customer account management — instances, subscriptions, and default
      settings (CustomerApiKey auth)
  - name: Session
    description: WhatsApp session management (login, logout, status)
  - name: Messages
    description: Send and manage WhatsApp messages
  - name: Groups
    description: Group management
  - name: Communities
    description: Community management
  - name: Contacts
    description: Contact lookup and management
  - name: Users
    description: Own account management, user lookup, and profile information
  - name: Media
    description: Media download
  - name: Chats
    description: Chat listing, info, settings, and management
  - name: Calls
    description: Call management
  - name: Newsletters
    description: Newsletter/channel management
  - name: Status
    description: Status/stories posting
paths:
  /session/passkey/request:
    post:
      tags:
        - Session
      summary: Request passkey challenge
      description: >
        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.
      operationId: requestPasskey
      parameters:
        - $ref: '#/components/parameters/XInstanceId'
      responses:
        '200':
          description: Pending passkey challenge
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PasskeyState'
        '400':
          description: The device is already registered (paired)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: 400
                detail: device already registered
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          description: >-
            Could not connect to WhatsApp to request the passkey challenge. Try
            again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: 409
                detail: >-
                  could not connect to whatsapp to request the passkey
                  challenge; try again
        '502':
          description: >
            WhatsApp did not return a passkey challenge (the account may not use
            a passkey).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  parameters:
    XInstanceId:
      name: X-Instance-Id
      in: header
      required: true
      description: The ID of the WhatsApp instance to use
      schema:
        type: string
        default: '{{instanceId}}'
  schemas:
    PasskeyState:
      type: object
      properties:
        status:
          type: string
          enum:
            - none
            - required
            - submitted
            - confirmation_required
            - error
          description: Current passkey verification state
        source:
          type: string
          enum:
            - notification
            - requested
          description: >
            Where the challenge came from: `notification` (WhatsApp pushed it
            after the QR scan

            or pair code) or `requested` (fetched via `POST
            /session/passkey/request`, which

            usually leads to `confirmation_required`). Omitted when no step is
            in progress.
        challenge:
          type: object
          description: >
            WebAuthn `PublicKeyCredentialRequestOptionsJSON` sent by WhatsApp,
            with binary fields

            base64url-encoded (accepted by
            `PublicKeyCredential.parseRequestOptionsFromJSON`).

            Pass it to `navigator.credentials.get()` on `origin`. Only set while
            `status` is `required`.
          properties:
            challenge:
              type: string
              description: Challenge bytes (base64url, unpadded)
            timeout:
              type: integer
              description: Timeout in milliseconds
            rpId:
              type: string
              description: Relying party ID
            allowCredentials:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: Credential ID (base64url, unpadded)
                  type:
                    type: string
                    example: public-key
                  transports:
                    type: array
                    items:
                      type: string
            userVerification:
              type: string
              example: required
            extensions:
              type: object
              additionalProperties: true
        origin:
          type: string
          description: >-
            Origin the challenge must be signed on. Only set while `status` is
            `required`.
          example: https://web.whatsapp.com
        confirmationCode:
          type: string
          description: >
            Code to show the user while `status` is `confirmation_required`.
            They must check it

            matches the code on their phone and approve the link there.
        confirmationSent:
          type: boolean
          description: >
            `true` once the confirmation has been sent to WhatsApp (sent
            automatically when

            `status` becomes `confirmation_required`). Omitted until then.
        error:
          type: string
          description: Failure reason when `status` is `error`
        requestedAt:
          type: string
          format: date-time
          description: When WhatsApp requested the passkey verification
        expiresAt:
          type: string
          format: date-time
          description: When the step expires (5 minutes after `requestedAt`)
      required:
        - status
    Error:
      type: object
      description: Standard error response returned by all API endpoints
      required:
        - detail
        - status
      properties:
        detail:
          type: string
          description: Human-readable error message
          example: invalid request body
        status:
          type: integer
          description: HTTP status code
          example: 400
  responses:
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 401
            detail: unauthorized
    ServiceUnavailable:
      description: Instance not available (not connected or service is nil)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 503
            detail: instance not available
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        Instance or customer-level API key. Either the instance's own API key or
        the customer's API key is accepted. Must be paired with the
        X-Instance-Id header to identify the target instance.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.