openapi: "3.0.1"
info:
  title: "Rasa Platform - Admin"
  version: "1.0.0"
  description: >-
    Rasa Platform admin endpoints
servers:
  - url: http://demo-bot.rasa.com/api
    description: Demo
paths:
  /health:
    get:
      tags:
        - Status
      summary: Fetch status of services
      operationId: status
      responses:
        200:
          description: Status of services
          content:
            application/json:
              schema:
                type: object
                properties:
                  nlu:
                    type: string
                  core:
                    type: string
                    nullable: true
  /version:
    get:
      tags:
        - Version
      summary: Fetch versions of services
      operationId: versions
      responses:
        200:
          description: Versions of services
          content:
            application/json:
              schema:
                type: object
                properties:
                  nlu:
                    type: object
                    properties:
                      version:
                        type: string
                      minimum_compatible_version:
                        type: string
                  core:
                    type: string
                  platform:
                    type: string
  /auth:
    post:
      tags:
        - User
      summary: Perform authentication
      operationId: login
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - username
                - password
              properties:
                username:
                  type: string
                password:
                  type: string
      responses:
        200:
          description: Success status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        401:
          description: Wrong schema
          content:
            text/plain:
              schema:
                type: string
                enum:
                  - wrong schema
                  - unauthorized
  /users/me:
    get:
      tags:
        - User
      summary: Get information about this user
      operationId: getUserMe
      responses:
        200:
          description: Current user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
  /users:
    post:
      tags:
        - User
      summary: Create a new user
      operationId: getUsers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/User'
      responses:
        200:
          description: Created user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        401:
          description: wrong schema
  /users/{username}:
    delete:
      tags:
        - User
      summary: Delete a user
      operationId: deleteUser
      parameters:
        - in: path
          name: username
          schema:
            type: string
          required: true
      responses:
        200:
          description: Deleted user
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/User'
                  - type: object
                    properties:
                      error:
                        type: string
  /users/me/password:
    post:
      tags:
        - User
      summary: Change password
      operationId: changePassword
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - username
                - old_password
                - new_password
                - new_password_confirm
              properties:
                username:
                  type: string
                old_password:
                  type: string
                new_password:
                  type: string
                new_password_confirm:
                  type: string
      responses:
        200:
          description: User whose password was just changed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        401:
          description: wrong schema
        400:
          description: user not found, wrong password
components:
  schemas:
    User:
      type: object
      properties:
        username:
          type: string
        password:
          type: string
        role:
          type: string