BlindInsight token API

The token API from BlindInsight — 3 operation(s) for token.

OpenAPI Specification

blindinsight-token-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Blind Insight REST accounts token API
  version: 10.22.0
  description: End-to-end encrypted datastore
tags:
- name: token
paths:
  /api/token/:
    post:
      operationId: token_create
      description: 'Create a new token for the user with the given email and password. On success,

        returns a JSON web token which can be used in the `Authorization` header to make

        API requests.


        The response will be an JSON object with the access and refresh tokens.


        **On the command line:**


        ```bash

        blind token create --data ''{"email": "demo@example.com", "password": "pass1234"}''

        ```'
      summary: Create a new token
      tags:
      - token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenObtainPair'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TokenObtainPair'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TokenObtainPair'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenObtainPair'
          description: ''
  /api/token/refresh/:
    post:
      operationId: token_refresh
      description: 'Refresh an existing token. On success, returns a JSON web token which can be

        used in the `Authorization` header to make API requests.


        The response will be an JSON object with the new access token.


        **On the command line:**


        ```bash

        blind token refresh --data ''{"refresh": "<refresh-token>"}''

        ```'
      summary: Refresh a token
      tags:
      - token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenRefresh'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TokenRefresh'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TokenRefresh'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenRefresh'
          description: ''
  /api/token/verify/:
    post:
      operationId: token_verify
      description: 'Verify an access or refresh token is valid.


        The response will be an empty object if it is valid, or a 401 unauthorized error

        if it is not.


        **On the command line:**


        ```bash

        blind token verify --data ''{"token": "<access-or-refresh-token>"}''

        ```'
      summary: Verify a token
      tags:
      - token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenVerify'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TokenVerify'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TokenVerify'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenVerify'
          description: ''
components:
  schemas:
    TokenVerify:
      type: object
      properties:
        token:
          type: string
          writeOnly: true
      required:
      - token
    TokenRefresh:
      type: object
      properties:
        access:
          type: string
          readOnly: true
        refresh:
          type: string
          writeOnly: true
      required:
      - access
      - refresh
    TokenObtainPair:
      type: object
      properties:
        email:
          type: string
          writeOnly: true
        password:
          type: string
          writeOnly: true
        access:
          type: string
          readOnly: true
        refresh:
          type: string
          readOnly: true
      required:
      - access
      - email
      - password
      - refresh
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
    cookieAuth:
      type: apiKey
      in: cookie
      name: sessionid
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT