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

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

```js
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.




## OpenAPI

````yaml /openapi/wsapi-api.yaml post /session/passkey
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:
    post:
      tags:
        - Session
      summary: Submit passkey assertion
      description: >
        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.:


        ```js

        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.
      operationId: submitPasskey
      parameters:
        - $ref: '#/components/parameters/XInstanceId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PasskeyAssertion'
      responses:
        '200':
          description: Assertion forwarded to WhatsApp
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PasskeyState'
        '400':
          description: >
            Malformed assertion, or `clientDataJSON` failed a local check (wrong
            `type`, wrong

            `origin`, or a challenge other than the pending one). The step stays
            `required`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: 400
                detail: >-
                  the passkey was used on "https://example.com"; it must be used
                  on https://web.whatsapp.com
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/NoPasskeyPending'
        '413':
          description: Request body too large (limit 64 KB)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: WhatsApp rejected the passkey response. The state becomes `error`.
          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:
    PasskeyAssertion:
      type: object
      description: >
        WebAuthn assertion as produced by `PublicKeyCredential.toJSON()` in the
        browser.

        Binary fields are base64url-encoded.
      properties:
        id:
          type: string
          description: Credential ID
        rawId:
          type: string
          description: Raw credential ID (base64url)
        type:
          type: string
          example: public-key
        response:
          type: object
          properties:
            clientDataJSON:
              type: string
              description: Client data JSON (base64url)
            authenticatorData:
              type: string
              description: Authenticator data (base64url)
            signature:
              type: string
              description: Assertion signature (base64url)
            userHandle:
              type: string
              nullable: true
              description: User handle (base64url), if returned by the authenticator
          required:
            - clientDataJSON
            - signature
      required:
        - rawId
        - response
    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
    NoPasskeyPending:
      description: No matching passkey verification step is pending (or it has expired).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 409
            detail: no passkey verification pending
    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.