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

# Initiate WebAuthn Authentication (beta)

> Initiate a WebAuthn authentication request. This endpoint requires that a user has at least one WebAuthn credential attached for the provided `domain` from a successful `CreateWebAuthnRegistration`. Pass the JSON object in `public_key_credential_request_options` property into `await get(options)` as `options` if you are using [webauthn-json](https://github.com/github/webauthn-json) or to [navigator.credentials.get(options)](https://w3c.github.io/webappsec-credential-management/#dom-credentialscontainer-get).
## Returns

A successful response returns a `public_key_credential_request_options` property and `user_id` property.



## OpenAPI

````yaml post /v1/auth/webauthn/authentication/begin
openapi: 3.1.0
info:
  title: MoonKey Auth API
  description: >-
    Explore all the details of MoonKey Auth API. All of our APIs are RESTful and
    accept and return JSON.
  version: v1
servers:
  - url: https://api.moonkey.fun
    description: Production
    variables: {}
security:
  - Authorization: []
tags:
  - name: Users
    description: User management API
  - name: Magic Links
    description: ''
  - name: OTPs
    description: >-
      Send OTP (One-time passcodes) by all the supported delivery methods such
      as SMS, email.
  - name: OAuth
    description: ''
  - name: Wallets Login
    description: ''
  - name: Managed Wallets
    description: ''
  - name: Wallet Import
    description: >-
      Import existing wallets into the platform using secure HPKE encryption.
      This flow ensures raw entropy (seed phrases or private keys) never touches
      the server in plaintext.
externalDocs:
  url: ''
  description: ''
paths:
  /v1/auth/webauthn/authentication/begin:
    parameters: []
    post:
      tags:
        - WebAuthn
      summary: Initiate WebAuthn Authentication (beta)
      description: >-
        Initiate a WebAuthn authentication request. This endpoint requires that
        a user has at least one WebAuthn credential attached for the provided
        `domain` from a successful `CreateWebAuthnRegistration`. Pass the JSON
        object in `public_key_credential_request_options` property into `await
        get(options)` as `options` if you are using
        [webauthn-json](https://github.com/github/webauthn-json) or to
        [navigator.credentials.get(options)](https://w3c.github.io/webappsec-credential-management/#dom-credentialscontainer-get).

        ## Returns


        A successful response returns a `public_key_credential_request_options`
        property and `user_id` property.
      operationId: BeginWebAuthnAuthentication
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BeginWebAuthnAuthenticationRequest'
            examples:
              CreateWebAuthnAuthenticationReq:
                value:
                  domain: localhost
                  user_id: user_24wFP9pDa9YiMJLun94iKykoZs2
        description: ''
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                description: ''
                type: object
                properties:
                  public_key_credential_request_options:
                    type: object
                    properties:
                      publicKey:
                        type: object
                        properties:
                          challenge:
                            type: string
                            minLength: 1
                          timeout:
                            type: number
                          rpId:
                            type: string
                            minLength: 1
                          allowCredentials:
                            type: array
                            uniqueItems: true
                            minItems: 1
                            items:
                              required:
                                - type
                                - id
                              properties:
                                type:
                                  type: string
                                  minLength: 1
                                id:
                                  type: string
                                  minLength: 1
                          userVerification:
                            type: string
                            minLength: 1
                        required:
                          - challenge
                          - timeout
                          - rpId
                          - allowCredentials
                          - userVerification
                    required:
                      - publicKey
                  user_id:
                    type: string
                    minLength: 1
                required:
                  - public_key_credential_request_options
                  - user_id
              examples:
                CreateWebAuthnRegistrationResp:
                  value:
                    public_key_credential_request_options:
                      publicKey:
                        challenge: D9qznnlmk+o70AZ4IFF7zG1jUaRYzW1Z0dqZ2OEDGU4=
                        timeout: 60000
                        rpId: localhost
                        allowCredentials:
                          - type: public-key
                            id: >-
                              AQfPElkPCEeuVoNqtVNAqi8nUNlE3gLKTZKzH9hTt0YQMCPGkRpMAV8ECi1Oexr1hBPYHj6B8E5O6n8Wqhu4Tkkq75wFIrmhnz5CB9NhSeIZZlzmeg==
                          - type: public-key
                            id: >-
                              AWvXz2Dx+I+te0xgEFpnYRFvakhELv/tEmlQ68137Rlcl6+ZN0/8PIqN6e+lN5sXFUy5+HJsdDFUaYgQoVf0ORLF1UIQnuthZi9a742mCzR9G72Bjg==
                          - type: public-key
                            id: >-
                              Aex6qH/dUebV6v43lypXMBWzi8Okem5kik0iL9IYAX3ixRcBrCqIiJR3lhzK2rnAV0jY9IcWQe3sGEeP9vLm6J/lzs9JwRMpZ2pa8aT8db6YiQFeOg==
                        userVerification: discouraged
                    user_id: user_24wFP9pDa9YiMJLun94iKykoZs2
components:
  schemas:
    BeginWebAuthnAuthenticationRequest:
      description: ''
      type: object
      properties:
        domain:
          type: string
          minLength: 1
          description: >-
            `Required` Domain of the app that will be using WebAuthn to
            authenticate user.
        user_id:
          type: string
          minLength: 1
          description: >-
            `Required` User ID of the user to initiate WebAuthn credential
            authentication.
      required:
        - domain
        - user_id
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      description: >-
        Auth Platform API includes all the Auth related features. All Users,
        Phone Numbers, Emails, and OTPs are associated with an `App` as the
        container.


        Endpoints only accept App's `Secret API keys` other than certain
        endpoints that are used client side or via SDK that accept the
        `public_token`.


        ## Authentication using App Api Key


        ## Header:


        ```

        Authorization: Bearer {api_key}

        ```


        ## Authenticated Request


        ```curl

        curl \
          -X GET https://api.moonkey.fun/v1/auth/users/user_24wFP9pDa9YiMJLun94iKykoZs2 \
          -H "Authorization: Bearer sk_test_pRqweh3wvWmJAAVYv7Z0T5iPLzFM4ql0muoyQcjOxGeN3p1r"
        ```

````