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

# Initialize a transaction

> Initializes a new transaction for an existing user



## OpenAPI

````yaml openapi-passkeys post /{tenant_id}/transaction/initialize
openapi: 3.1.0
info:
  version: '1.2'
  title: passkey-server
  description: >-
    This API shall represent the private and public endpoints for passkey
    registration, management and authentication
  termsOfService: https://www.hanko.io/terms
  contact:
    email: developers@hanko.io
    url: https://www.hanko.io
    name: Hanko Dev Team
  license:
    url: https://www.gnu.org/licenses/gpl-3.0.de.html
    name: GPLv3
servers:
  - url: https://passkeys.hanko.io
security: []
tags:
  - name: credentials
    description: Represents all objects which are related to WebAuthn credentials
  - name: mfa
    description: Represents all objects which are related to MFA in common
  - name: webauthn
    description: Represents all objects which are related to WebAuthn in common
  - name: audit_logs
    description: Represents all objects which are related to audit logs
paths:
  /{tenant_id}/transaction/initialize:
    post:
      summary: Initialize a transaction
      description: Initializes a new transaction for an existing user
      operationId: post-tenant_id-transaction-initialize
      parameters:
        - $ref: '#/components/parameters/X-API-KEY'
        - $ref: '#/components/parameters/tenant_id'
      requestBody:
        $ref: '#/components/requestBodies/post-transaction-initialize'
      responses:
        '200':
          $ref: '#/components/responses/post-login-initialize'
        '400':
          $ref: '#/components/responses/error'
        '401':
          $ref: '#/components/responses/error'
        '404':
          $ref: '#/components/responses/error'
        '409':
          $ref: '#/components/responses/error'
        '500':
          $ref: '#/components/responses/error'
      servers:
        - url: https://passkeys.hanko.io
components:
  parameters:
    X-API-KEY:
      name: apiKey
      in: header
      description: Secret API key
      required: true
      schema:
        type: string
        minLength: 32
    tenant_id:
      name: tenant_id
      in: path
      description: UUID of the tenant
      required: true
      schema:
        type: string
        format: uuid
        minLength: 36
        maxLength: 36
        example:
          - 1f496bcd-49da-4839-a02f-7ce681ccb488
  requestBodies:
    post-transaction-initialize:
      content:
        application/json:
          schema:
            type: object
            properties:
              user_id:
                type: string
              transaction_id:
                type: string
                maxLength: 128
                description: Needs to be a tenant-wide unique identifier
              transaction_data:
                type: object
            required:
              - user_id
              - transaction_id
              - transaction_data
  responses:
    post-login-initialize:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            properties:
              publicKey:
                type: object
                properties:
                  challenge:
                    type: string
                  timeout:
                    type: integer
                  rpId:
                    type: string
                  allowCredentials:
                    type: array
                    items:
                      $ref: '#/components/schemas/credential-descriptor-entity'
                  userVerification:
                    type: string
                    enum:
                      - discouraged
                      - preferred
                      - required
                  extensions:
                    type: object
                    properties:
                      appid:
                        type: boolean
                      appidExclude:
                        type: boolean
                      credProps:
                        type: object
                        properties:
                          rk:
                            type: boolean
                required:
                  - challenge
              mediation:
                type: string
                enum:
                  - optional
                  - required
                  - silent
    error:
      description: Error Response with detailed information
      content:
        application/json:
          schema:
            type: object
            properties:
              title:
                type: string
                example:
                  - explanatory title
              details:
                type: string
                example:
                  - Information which helps resolving the problem
              status:
                type: integer
  schemas:
    credential-descriptor-entity:
      type: object
      title: credential-descriptor-entity
      properties:
        type:
          enum:
            - public-key
        id:
          type: string
        transports:
          type: array
          uniqueItems: true
          items:
            type: string
            enum:
              - ble
              - hybrid
              - internal
              - nfc
              - usb
      required:
        - type
        - id

````