Hanko Transaction API

The Transaction API from Hanko — 2 operation(s) for transaction.

OpenAPI Specification

hanko-transaction-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  version: 1.2.0
  title: Hanko Admin Audit Logs Transaction API
  description: '## Introduction


    This is the OpenAPI specification for the [Hanko Admin API](https://github.com/teamhanko/hanko/blob/main/backend/README.md#start-private-api).


    ## Authentication


    The Admin API must be protected by an access management system.


    ---

    '
  contact:
    email: developers@hanko.io
  license:
    name: AGPL-3.0-or-later
    url: https://www.gnu.org/licenses/agpl-3.0.txt
servers:
- url: https://{tenant_id}.hanko.io/admin
  variables:
    tenant_id:
      default: ''
      description: The (UU)ID of a tenant. Replace the default value with your tenant ID.
tags:
- name: Transaction
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
      tags:
      - Transaction
  /{tenant_id}/transaction/finalize:
    post:
      summary: Finalize transaction
      description: Finalize a transaction
      operationId: post-tenant_id-transaction-finalize
      parameters:
      - $ref: '#/components/parameters/X-API-KEY'
      - $ref: '#/components/parameters/tenant_id'
      requestBody:
        $ref: '#/components/requestBodies/post-login-finalize'
      responses:
        '200':
          $ref: '#/components/responses/token'
        '400':
          $ref: '#/components/responses/error'
        '401':
          $ref: '#/components/responses/error'
        '404':
          $ref: '#/components/responses/error'
        '500':
          $ref: '#/components/responses/error'
      servers:
      - url: https://passkeys.hanko.io
      tags:
      - Transaction
components:
  responses:
    token:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            properties:
              token:
                type: string
            minProperties: 1
    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
    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
  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
    post-login-finalize:
      content:
        application/json:
          schema:
            allOf:
            - $ref: '#/components/schemas/public-key-credential'
            - type: object
              properties:
                response:
                  $ref: '#/components/schemas/autenticator-assertion-response'
                clientExtensionResults:
                  type: object
                  properties:
                    appid:
                      type: boolean
                    appidExclude:
                      type: boolean
                    credProps:
                      type: object
                      properties:
                        rk:
                          type: boolean
              required:
              - response
              - clientExtensionResults
  schemas:
    authenticator-response:
      type: object
      title: authenticator-response
      properties:
        clientDataJSON:
          type: string
      required:
      - clientDataJSON
    autenticator-assertion-response:
      title: autenticator-assertion-response
      allOf:
      - $ref: '#/components/schemas/authenticator-response'
      - type: object
        properties:
          authenticatorData:
            type: string
          signature:
            type: string
          userHandle:
            type: string | null
        required:
        - authenticatorData
        - signature
    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
    credential:
      type: object
      title: credential
      properties:
        id:
          type: string
        type:
          enum:
          - public-key
      required:
      - id
      - type
    public-key-credential:
      title: public-key-credential
      allOf:
      - $ref: '#/components/schemas/credential'
      - type: object
        properties:
          rawId:
            type: string
          authenticatorAttachment:
            type: string
            enum:
            - cross-platform
            - platform
            - null
        required:
        - rawId
  parameters:
    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
    X-API-KEY:
      name: apiKey
      in: header
      description: Secret API key
      required: true
      schema:
        type: string
        minLength: 32
  securitySchemes:
    BearerApiKeyAuth:
      description: Bearer authentication header of the form `Bearer <token>`, where `<token>` is your API key. Must only be used when using Hanko Cloud.
      type: http
      scheme: bearer
      bearerFormat: API Key
externalDocs:
  description: More about Hanko
  url: https://github.com/teamhanko/hanko