Hanko Sessions API

The Sessions API from Hanko — 1 operation(s) for sessions.

OpenAPI Specification

hanko-sessions-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  version: 1.2.0
  title: Hanko Admin Audit Logs Sessions 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: Sessions
paths:
  /sessions:
    post:
      summary: Create a new session token for a user
      security:
      - BearerApiKeyAuth: []
      operationId: post_sessions
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSession'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSessionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
      tags:
      - Sessions
components:
  schemas:
    CreateSession:
      type: object
      properties:
        user_id:
          type: string
          format: uuid
        user_agent:
          type: string
        ip_address:
          type: string
          format: ip_address
      required:
      - user_id
    Error:
      type: object
      required:
      - code
      - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
    CreateSessionResponse:
      type: object
      properties:
        session_token:
          type: string
          format: JWT
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 400
            message: Bad Request
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 404
            message: Not found
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 500
            message: Internal Server Error
  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