OpenApi

View spec in html.

openapi: 3.0.0
info:
  version: 'v.0.5.5'
  title: 'Luna-Streams API'
  description: |
     'VisionLabs Luna-Streams'

     Service is intended for creation and management streams. A Streams is an user logical entity.

components:
  headers:
    application_json:
      schema:
        type: string
        enum:
        - application/json
      required: true
      description: The content type of the response body.

    text_plain:
      schema:
        type: string
        enum:
        - text/plain
      required: true
      description: The content type of the response body.

    luna_request_id:
      schema:
        type: string
        format: timestamp,uuid
        example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a
        pattern: ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
      description: request id. Helps to uniquely identify messages that correspond to particular requests, in system logs.
      required: true

    docs_content_type:
      schema:
        type: string
        enum:
          - application/x-yaml
          - text/html
      required: true
      description: The content type of the response body.

    config_accept_content_type:
      schema:
        type: string
        enum:
          - application/json
          - text/plain
      required: false
      description: The content type of the response body.

    text_html:
      schema:
        type: string
        enum:
          - text/html
      required: true
      description: The content type of the response body.
  parameters:
    page:
      in: query
      name: page
      schema:
        type: integer
        minimum: 1
        default: 1
      description: a page number.

    page_size:
      in: query
      name: page_size
      schema:
        type: integer
        minimum: 1
        maximum: 1000
        default: 10
      description: the number of items on page.

    luna_request_id:
      in: header
      schema:
        type: string
        format: timestamp,uuid
        example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a
        pattern: ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
      description: |
        external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs.
        If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.
      name: Luna-Request-Id

    accept_docs_handler:
      in: header
      name: Accept
      schema:
        $ref: '#/components/schemas/accept_docs_handler'
      required: true
      description: acceptable type of receiving data

    accept_config_handler:
      in: header
      name: Accept
      schema:
        type: string
        enum:
          - application/json
          - text/plain
        description: One of application/json, text/plain
      required: false
      description: acceptable type of receiving data

    accept_content_type:
      in: header
      name: Accept
      schema:
        type: string
        enum:
          - application/json
          - application/msgpack
      description: Which content-type is requested. `application/json` by default

    Accept:
      in: header
      name: Accept
      schema:
        type: string
        enum:
          - application/json
          - application/msgpack
      description: Preferred response content type

    limit:
      in: query
      name: limit
      schema:
        type: integer
        minimum: 1
      description: Maximum number of the objects in the response.
      required: true

    stream_ids:
      in: query
      name: stream_ids
      schema:
        type: array
        items:
          $ref: '#/components/schemas/stream_id'
      explode: false
      description: Stream Id filter. Only streams with the specified ids will be returned in the response.
      example: 'ae09126e-70a6-49c7-923f-df2320f08639,68b363eb-600a-4e72-afb3-8c4196e385ce'

    stream_names:
      in: query
      name: names
      schema:
        type: array
        items:
          $ref: '#/components/schemas/stream_name'
      explode: false
      description: Stream Name filter. Only streams with the specified names will be returned in the response.
      example: 'name1,name2'

    stream_reference:
      in: query
      name: reference
      schema:
        $ref: '#/components/schemas/stream_reference'
      description: Stream Reference filter. Only streams with the specified reference will be returned in the response.

    stream_statuses:
      in: query
      name: statuses
      schema:
        type: array
        items:
          $ref: '#/components/schemas/stream_status'
      explode: false
      description: Stream Status filter - comma-separated list of status values. Only streams with the specified statuses will be returned in the response.
      example: 'pending,pause'

    stream_create_time__lt:
      in: query
      name: create_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: Stream create time upper excliding bound filter in RFC 3339 format. Only streams with the creation time lower than the specified boundary will be returned in the response.
      example: "2021-09-21T19:11:41.674Z"

    stream_create_time__gte:
      in: query
      name: create_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: Stream create time lower including bound filter in RFC 3339 format. Only streams with the creation time greater than or equal to the specified boundary will be returned in the response.
      example: "2021-09-21T11:11:41.674Z"

    log_time__lt:
      in: query
      name: log_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: Stream log record time upper excliding bound filter in RFC 3339 format. Only stream logs with the record time lower than the specified boundary will be returned in the response.
      example: "2021-09-21T19:11:41.674Z"

    log_time__lt_deleting:
      in: query
      name: log_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: Stream log record time upper excliding bound filter in RFC 3339 format. Only stream logs with the record time lower than the specified boundary will be deleted.
      example: "2021-09-21T19:11:41.674Z"

    log_time__gte:
      in: query
      name: log_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: Stream log record time lower including bound filter in RFC 3339 format. Only stream log with the record time greater than or equal to the specified boundary will be returned in the response.
      example: "2021-09-21T11:11:41.674Z"

    log_targets:
      in: query
      name: targets
      schema:
        type: array
        items:
          type: string
          enum: [ stream_id, status, error, video_info, log_time, version, preview ]
          description: stream log target
        example: [ status ]
        default: [ stream_id, status, error, video_info, log_time, version, preview ]
      description: List of comma-separated stream logs targets.

    account_id:
      in: query
      name: account_id
      schema:
        $ref: '#/components/schemas/account_id'
      description: account id
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb'

    account_id_required:
      required: true
      in: query
      name: account_id
      schema:
        $ref: '#/components/schemas/account_id'
      description: account id
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb'

    group_names:
      in: query
      name: group_names
      schema:
        type: array
        items:
          $ref: '#/components/schemas/group_name'
      description: group names
      example: "group1,group2"

    group_name:
      in: query
      name: group_name
      schema:
        $ref: '#/components/schemas/group_name'
      description: Group name filter. Only groups with the specified names will be returned in the response.
      example: "group1"

    group_ids:
      in: query
      name: group_ids
      schema:
        type: array
        items:
          $ref: '#/components/schemas/group_id'
      explode: false
      description: group ids
      example: 'ae09126e-70a6-49c7-923f-df2320f08639,68b363eb-600a-4e72-afb3-8c4196e385ce'

    stream_id_path:
      in: path
      name: stream_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: stream id

    include_luna_services:
      in: query
      name: include_luna_services
      schema:
        type: integer
        enum: [0, 1]
        default: 0
      description: Whether to perform healthchecks for dependent luna services.
  schemas:
    error:
      type: object
      properties:
        error_code:
          type: integer
          description: error code.
        desc:
          type: string
          description: short error description.
        detail:
          type: string
          description: error details.
        link:
          type: string
          description: Link to the documentation website with the error description.
      required: [error_code, detail, desc, link]
      example:
        error_code: 1
        detail: internal server error
        desc: internal server error
        link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-1

    int_version:
      type: integer
      minimum: 0

    accept_docs_handler:
      type: string
      enum:
        - application/x-yaml
        - text/html
      description: One of application/x-yaml, text/html

    version:
      type: object
      properties:
        Version:
          type: object
          properties:
            api:
              allOf:
                - $ref: '#/components/schemas/int_version'
              description: an api version of service.
            major:
              allOf:
                - $ref: '#/components/schemas/int_version'
              description: a major version of service.
            minor:
              allOf:
                - $ref: '#/components/schemas/int_version'
              description: a minor version of service.
            patch:
              allOf:
                - $ref: '#/components/schemas/int_version'
              description: a patch version of service.
          required: [ api, major, minor, patch ]
      required: [ Version ]

      example:
        Version:
          api: 1
          major: 0
          minor: 0
          patch: 0

    health_ok:
      description: successful healthcheck execution info
      type: object
      properties:
        execution_time:
          type: number
          format: float
          example: 0.123
          description: request execution time in seconds
      required: [ execution_time ]

    health_errors:
      type: object
      properties:
        errors:
          description: failed healthcheck execution info
          type: array
          items:
            type: object
            properties:
              component:
                description: component name
                type: string
              error:
                allOf:
                  - description: healthcheck error
                  - $ref: '#/components/schemas/error'
              status:
                description: component health status
                type: integer
                enum: [ 0, 1 ]
            required: [ component, error, status ]
      required: [ errors ]
      example:
        errors:
          - component: db
            error:
              error_code: 10017
              desc: Database error
              detail: Database connection timeout error
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-10017
            status: 0
          - component: db_migration
            error:
              error_code: 10017
              desc: Database error
              detail: Database connection timeout error
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-10017
            status: 0

    count:
      type: integer
      minimum: 0
      example: 146

    string36_nullable:
      type: string
      maxLength: 36
      nullable: true

    string128_default:
      type: string
      maxLength: 128
      default: ""

    string512_default:
      type: string
      maxLength: 512
      default: ""

    file_mask:
      type: string
      minLength: 0
      maxLength: 128
      example: "example1_%04d.jpg"
      description: file mask

    time:
      type: string
      format: date-time
      example: "2018-08-11T09:11:41.674Z"
      description: time in format RFC 3339

    uuid:
      type: string
      format: uuid
      pattern: '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$'
      example: "557d54ec-29ad-4f3c-93b4-c9092ef12515"

    stream_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - example: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
      description: stream ID

    group_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - example: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
      description: group ID

    account_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: account ID for authentication in Luna Platform

    stream_reference:
      type: string
      maxLength: 512
      description: |
        stream reference: URL, path, etc.
      example: https://upload.wikimedia.org/wikipedia/commons/2xQ2gprbMUePw1s9gw9fvA==

    roi:
      type: array
      items:
        type: integer
        minimum: 0
        maximum: 65536
      minItems: 4
      maxItems: 4
      default: [ 0, 0, 0, 0 ]
      description: region of interest of camera frame (left, top, width, height), by default [0 0 0 0] - full frame

    droi:
      type: array
      items:
        type: integer
        minimum: 0
        maximum: 65536
      minItems: 4
      maxItems: 4
      default: [ 0, 0, 0, 0 ]
      description: |
        region of interest within the ROI zone (left, top, width, height).
        Face detection is performed in ROI, but the best shot is selected only in the DROI area.
        Face detection must be completely within the DROI zone for the frame to be considered as a best shot.

    rotation:
      type: integer
      enum: [ 0, 90, 180, 270 ]
      default: 0
      description: angle of camera frame rotation

    preferred_program_stream_frame_width:
      type: integer
      minimum: 0
      default: 800
      description: frame width of the preferred program stream

    stream_data_common:
      type: object
      properties:
        type:
          type: string
          description: stream type
        reference:
          $ref: '#/components/schemas/stream_reference'
        roi:
          $ref: '#/components/schemas/roi'
        droi:
          $ref: '#/components/schemas/droi'
        rotation:
          $ref: '#/components/schemas/rotation'
        preferred_program_stream_frame_width:
          $ref: '#/components/schemas/preferred_program_stream_frame_width'
      required: [ type, reference ]

    stream_data_common_required:
      allOf:
        - $ref: '#/components/schemas/stream_data_common'
        - required: [type, reference, roi, droi, rotation, preferred_program_stream_frame_width]

    stream_data_udp:
      allOf:
        - $ref: '#/components/schemas/stream_data_common'
        - properties:
            type:
              enum: [ udp ]
            endless:
              $ref: '#/components/schemas/stream_endless'

    stream_data_udp_required:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_required'
        - properties:
            type:
              enum: [udp]
            endless:
              $ref: '#/components/schemas/stream_endless'
        - required: [endless]

    stream_data_tcp:
      allOf:
        - $ref: '#/components/schemas/stream_data_common'
        - properties:
            type:
              enum: [ tcp ]
            endless:
              $ref: '#/components/schemas/stream_endless'

    stream_data_tcp_required:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_required'
        - properties:
            type:
              enum: [tcp]
            endless:
              $ref: '#/components/schemas/stream_endless'
        - required: [endless]

    stream_data_videofile:
      allOf:
        - $ref: '#/components/schemas/stream_data_common'
        - properties:
            type:
              enum: [ videofile ]

    stream_data_videofile_required:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_required'
        - properties:
            type:
              enum: [videofile]

    stream_data_images:
      allOf:
        - $ref: '#/components/schemas/stream_data_common'
        - properties:
            type:
              enum: [ images ]
            mask:
              $ref: '#/components/schemas/file_mask'
          required: [ type, mask ]

    stream_data_images_required:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_required'
        - properties:
            type:
              enum: [ images ]
            mask:
              $ref: '#/components/schemas/file_mask'
          required: [type, mask]

    stream_data:
      oneOf:
        - $ref: '#/components/schemas/stream_data_udp'
        - $ref: '#/components/schemas/stream_data_tcp'
        - $ref: '#/components/schemas/stream_data_videofile'
        - $ref: '#/components/schemas/stream_data_images'
      discriminator:
        propertyName: type
        mapping:
          udp: '#/components/schemas/stream_data_udp'
          tcp: '#/components/schemas/stream_data_tcp'
          videofile: '#/components/schemas/stream_data_videofile'
          images: '#/components/schemas/stream_data_images'
      description: stream data

    stream_data_required:
      oneOf:
        - $ref: '#/components/schemas/stream_data_udp_required'
        - $ref: '#/components/schemas/stream_data_tcp_required'
        - $ref: '#/components/schemas/stream_data_videofile_required'
        - $ref: '#/components/schemas/stream_data_images_required'
      discriminator:
        propertyName: type
        mapping:
          udp: '#/components/schemas/stream_data_udp_required'
          tcp: '#/components/schemas/stream_data_tcp_required'
          videofile: '#/components/schemas/stream_data_videofile_required'
          images: '#/components/schemas/stream_data_images_required'
      description: stream data

    stream_endless:
      type: boolean
      default: true
      description: |
        Determines if stream is endless. True value means that the stream is endless and EOF value will be treated as error (stream processing will be restarted).
        Use False value if files are being transferred in the stream because it's not possible to determine whether file transfer ended or connection error occurred

    handler:
      type: object
      properties:
        handler_id:
          allOf:
          - $ref: '#/components/schemas/uuid'
          description: handler id in Luna Platform
      required: [ handler_id ]

    jwt_token:
      type: string
      example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k
      description: JWT token. It containts `token_id`, `expiration_time`, `account_id` and `visibility_area`

    token_authorization:
      type: object
      properties:
        token:
          $ref: "#/components/schemas/jwt_token"
      required: [token]

    account_authorization:
      type: object
      properties:
        account_id:
          allOf:
            - $ref: "#/components/schemas/account_id"
            - deprecated: true
      required: [account_id]

    stream_event_handler:
      type: object
      properties:
        origin:
          type: string
          example: http://127.0.0.1:5000
          description: event handler service origin
        api_version:
          type: integer
          example: 6
          description: event handler service api version
        bestshot_handler:
          allOf:
            - $ref: '#/components/schemas/handler'
          description: event bestshot handler
        detection_handler:
          allOf:
            - $ref: '#/components/schemas/handler'
            - nullable: true
          description: event detection handler
        frame_store:
          type: string
          example: http://127.0.0.1:5020/1/buckets/frames/images
          nullable: true
          description: frame store URL
        authorization:
          description: |
            Authorization for requests to luna-api. 
            If authorization not specified, the `account_id` from stream will be used
          oneOf:
            - $ref: "#/components/schemas/token_authorization"
            - $ref: "#/components/schemas/account_authorization"
      required: [ origin, api_version, bestshot_handler ]
      example:
        origin: http://127.0.0.1:5000
        api_version: 6
        bestshot_handler:
          handler_id: ee4c42b6-23ae-410e-a2aa-a4220e64ba4b
        detection_handler:
          handler_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
        frame_store: http://127.0.0.1:5020/1/buckets/frames/images
        authorization:
          token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k"
      description: stream event handler data

    stream_event_handler_response:
      allOf:
        - $ref: '#/components/schemas/stream_event_handler'
      required: [ origin, api_version, bestshot_handler, detection_handler, authorization ]

    stream_policies:
      type: object
      properties:
        sending:
          type: object
          properties:
            time_period_of_searching:
              type: integer
              default: -1
              minimum: -1
              description: interval in track after the end of which a best shot is sent to the server
            silent_period:
              type: integer
              default: 0
              minimum: -1
              description: interval between period. Once the analysis period is over, the system holds this silent-period before starting next period of frame analysis
            type:
              type: string
              enum: [sec, frames]
              default: sec
              description: sets the measurement metric for analysis periods and intervals between those (per frames or per seconds)
            number_of_bestshots_to_send:
              type: integer
              default: 1
              description: number of frames that the user sets to receive from the track or certain periods of this track
            send_only_full_set:
              type: boolean
              default: true
              description: enables to send data only if the required amount of data is available
            delete_track_after_sending:
              type: boolean
              default: false
              description: enables to delete track after sending
          description: stream sending parameters
        primary_track_policy:
          type: object
          properties:
            use_primary_track_policy:
              type: boolean
              default: false
              description: is used in cases of Access Control Systems (turnstiles/gates at the office/bank entrances) for easier control and face recognition implementation in a secured area
            best_shot_min_size:
              type: integer
              default: 70
              description: sets a minimal size for detections within Primary Track policy
            best_shot_proper_size:
              type: integer
              default: 140
              description: sets the size of detection for Primary Track policy. When a detection reaches the defined value, track immediately sends all its best shots to the server
          description: stream primary track policy parameters
        liveness:
          type: object
          properties:
            use_shoulders_liveness_filtration:
              type: boolean
              default: False
              description: enables checking the presence of a real person in the frame based on the head and shoulder areas
            use_mask_liveness_filtration:
              type: boolean
              default: False
              description: enables checking the presence of a real person in the frame based on backgrounds
            use_flying_faces_liveness_filtration:
              type: boolean
              default: False
              description: enables checking the presence of a real person in the frame based on the facial surrounding
            liveness_mode:
              type: integer
              enum: [0, 1, 2]
              default: 0
              description: |
                enables to specify which frames from a track will undergo Liveness check.
                There are three options for selecting a frame:
                  - 0 - first N frames
                  - 1 - last N frames before the best shot sending (recommended value)
                  - 2 - all frames in a track
            number_of_liveness_checks:
              type: integer
              default: 0
              example: 10
              description: enables to specify the number of frames to check for Liveness. The specified value is used in the liveness-mode parameter
            liveness_threshold:
              type: number
              format: float
              default: 0
              example: 0.6
              description: is used to define the presence of a real person in a frame. The system confirms that it is a real person in the frame, and not a photo, only if Liveness returned a value higher than the one specified in the parameter
            livenesses_weights:
              type: array
              items:
                type: number
                format: float
              minItems: 3
              maxItems: 3
              default: [0.0, 0.0, 0.0]
              example: [0.05, 0.45, 0.5]
              description: determines the involvement of each liveness check type (shoulders, mask, and flying_faces) in the resulting estimation of the presence of a human face in the frame
            mask_backgrounds_count:
              type: integer
              default: 0
              example: 300
              description: the number of background frames that are used for the corresponding checks
          description: stream liveness parameters
        filtering:
          type: object
          properties:
            min_score:
              type: number
              default: 0.5187
              description: score that defines detection quality, threshold for filtering detections sent to the server
            detection_yaw_threshold:
              type: number
              minimum: 0
              maximum: 180
              default: 40.0
              description: sets the maximum value of head yaw angle in relation to camera
            detection_pitch_threshold:
              type: number
              minimum: 0
              maximum: 180
              default: 40.0
              description: sets the maximum value of head pitch angle in relation to camera
            detection_roll_threshold:
              type: number
              minimum: 0
              maximum: 180
              default: 30.0
              description: detection-roll-threshold
            yaw_number:
              type: integer
              default: 1
              description: defines the number of frames for image filtration based on head tilt angle
            yaw_collection_mode:
              type: boolean
              default: false
              description: sets the number of frames the system must collect to analyze head yaw angle
            mouth_occlusion_threshold:
              type: number
              format: float
              default: 0.0
              example: 0.1
              description: determines how much the mouth can be obscured in the frame
            min_body_size_threshold:
              type: number
              format: float
              minimum: 0
              default: 0.0
              example: 0.1
              description: sets the body detection size, less than which it will not be sent for processing. It is calculated as the square root of the product of the body detection height (in pixels) by its width (in pixels).
          description: stream filtering parameters
        frame_processing_mode:
          type: string
          enum: [auto, full, scale]
          default: auto
          description: determines whether full or scaled frame will be processed (`auto` - depends on **convertFullFrame** *fs3Config* param)
        real_time_mode_fps:
          type: integer
          default: 0
          description: the video is processed with the specified number of FPS. The video can’t be processed with FPS higher than the one specified in this parameter
        ffmpeg_threads_number:
          type: integer
          default: 0
          description: number of threads for video decoding (0 - choosen by decoder library)
        healthcheck:
          type: object
          properties:
            max_error_count:
              type: integer
              default: 10
              description: error count limit in period to consider stream to be alive
            period:
              type: integer
              default: 3600
              description: see description of max_error_count, measured in seconds
            retry_delay:
              type: integer
              default: 5
              description: time gap between attempts to reopen not alive stream, in seconds
          description: stream health check parameters
      description: stream processing policies

    stream_policies_with_defaults:
      allOf:
        - $ref: '#/components/schemas/stream_policies'
        - properties:
            sending:
              required: [ time_period_of_searching, silent_period, type, number_of_bestshots_to_send, send_only_full_set, delete_track_after_sending ]
            primary_track_policy:
              required: [ use_primary_track_policy, best_shot_min_size, best_shot_proper_size ]
            liveness:
              required: [ use_shoulders_liveness_filtration, use_mask_liveness_filtration, use_flying_faces_liveness_filtration, liveness_mode, number_of_liveness_checks, liveness_threshold, livenesses_weights, mask_backgrounds_count ]
            filtering:
              required: [ min_score, detection_yaw_threshold, detection_pitch_threshold, detection_roll_threshold, yaw_number, yaw_collection_mode, mouth_occlusion_threshold ]
            healthcheck:
              required: [ max_error_count, period, retry_delay ]
          required: [ sending, primary_track_policy, liveness, filtering, frame_processing_mode, real_time_mode_fps, ffmpeg_threads_number, healthcheck ]

    longitude:
      type: number
      minimum: -180
      maximum: 180
      example: 36.616

    latitude:
      type: number
      minimum: -90
      maximum: 90
      example: 55.752

    geo_position:
      type: object
      nullable: true
      description: geo position specified by geographic coordinates - longitude and latitude.
      properties:
        longitude:
          allOf:
            - $ref: '#/components/schemas/longitude'
            - description: longitude in degrees
        latitude:
          allOf:
            - $ref: '#/components/schemas/latitude'
            - description: latitude in degrees
      required: [longitude, latitude]
      example:
        longitude: 36.616
        latitude: 55.752

    location_to_be_created:
      type: object
      properties:
        city:
          allOf:
            - $ref: '#/components/schemas/string36_nullable'
          example: Moscow
          description: city that stream belongs
        area:
          allOf:
            - $ref: '#/components/schemas/string36_nullable'
          example: Central
          description: area that stream belongs
        district:
          allOf:
            - $ref: '#/components/schemas/string36_nullable'
          example: Basmanny
          description: district that stream belongs
        street:
          allOf:
            - $ref: '#/components/schemas/string36_nullable'
          example: Podsosensky lane
          description: street that stream belongs
        house_number:
          allOf:
            - $ref: '#/components/schemas/string36_nullable'
          example: 23 bldg.3
          description: street that stream belongs
        geo_position:
          $ref: '#/components/schemas/geo_position'
      description: stream location info

    location:
      allOf:
        - $ref: '#/components/schemas/location_to_be_created'
      required: [city, area, district, street, house_number, geo_position]

    stream_autorestart:
      type: object
      properties:
        restart:
          type: integer
          enum: [ 0, 1 ]
          default: 0
          description: whether to allow autorestart
        attempt_count:
          type: integer
          minimum: 1
          default: 10
          description: stream autorestart attempt count
        delay:
          type: integer
          minimum: 1
          default: 60
          description: stream autorestart delay, in seconds
      description: stream autorestart policies

    stream_autorestart_response:
      allOf:
        - $ref: '#/components/schemas/stream_autorestart'
        - properties:
            current_attempt:
              type: integer
              minimum: 0
              nullable: true
              description: stream autorestart current attempt number | zero means no attempt was made
            last_attempt_time:
              allOf:
                - $ref: '#/components/schemas/time'
              nullable: true
              description: last autorestart attempt time | null means no attempt was made
            status:
              type: string
              nullable: false
              enum: [ disabled, enabled, in_progress, failed, denied ]
              description: |
                stream autorestart status
                
                | status   | description |
                |-------------|------------------------------------------|
                | disabled    | stream autorestart is disabled by user   |
                | enabled     | stream autorestart is enabled            |
                | in_progress | autorestart in progress                  |
                | failed      | autorestart failed                       |
                | denied      | autorestart is denied due to fatal error |

                > **WARNING**: stream autorestart status list may be expanded in the future

      required: [ restart, attempt_count, delay, current_attempt, last_attempt_time, status ]
      description: stream autorestart policies and status

    stream_version:
      type: integer
      minimum: 1
      description: Stream version. Increased when stream data is updated via PUT /streams/{stream_id} method.

    stream_status:
      type: string
      enum: [ pending, in_progress, done, pause, restart, cancel, failure, handler_lost, not_found ]
      description: |
        stream processing status.

        | status   | value |
        |-----------------|--------------------------------------------------------------------------|
        | pending         | stream is waiting for handler                                            |
        | in_progress     | stream processing is in progress                                         |
        | done            | stream processing is completed                                           |
        | pause           | stream processing is paused by user                                      |
        | restart         | stream processing is restarted by server                                 |
        | cancel          | stream processing is cancelled by user                                   |
        | failure         | stream processing is failed by handler                                   |
        | handler_lost    | stream processing handler is lost, needs to be passed to another handler |
        | not_found       | stream was removed during the processing                                 |
        | deleted         | stream was removed intentionally                                         |

        > **WARNING**: stream status list may be expanded in the future

    stream_to_be_created_base:
      type: object
      properties:
        account_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
          description: new stream account ID for authentication in Luna Platform
        name:
          allOf:
            - $ref: '#/components/schemas/string128_default'
          description: new stream name
          default: ""
        description:
          allOf:
            - $ref: '#/components/schemas/string512_default'
          description: new stream description
          default: ""
        data:
          $ref: '#/components/schemas/stream_data'
        event_handler:
          $ref: '#/components/schemas/stream_event_handler'
        policies:
          $ref: '#/components/schemas/stream_policies'
        location:
          $ref: '#/components/schemas/location_to_be_created'
        autorestart:
          $ref: '#/components/schemas/stream_autorestart'
        status:
          type: string
          enum: [ pending, pause ]
          default: pending
          description: processing initial status
      required: [ account_id, data, event_handler]

    stream_with_group_name:
      allOf:
        - $ref: '#/components/schemas/stream_to_be_created_base'
        - properties:
            group_name:
              $ref: '#/components/schemas/group_name'

    stream_with_group_id:
      allOf:
        - $ref: '#/components/schemas/stream_to_be_created_base'
        - properties:
            group_id:
              $ref: '#/components/schemas/group_id'

    stream_to_be_created:
      oneOf:
        - $ref: '#/components/schemas/stream_with_group_name'
        - $ref: '#/components/schemas/stream_with_group_id'

    stream_name:
      allOf:
        - $ref: '#/components/schemas/string128_default'
      description: stream name
      example: some name

    stream_error:
      type: string
      nullable: True
      description: |
        stream processing error description
        
        > **WARNING**: Fatal error prevent stream autorestart. Currently, fatal error is considered "Failed to authorize in Luna Platform".

        See developer documentation for more information.
      example: null

    video_info:
      type: object
      properties:
        width:
          type: integer
          description: stream source video width
          example: 1920
        height:
          type: integer
          description: stream source video height
          example: 1080
        frame_rate:
          type: integer
          description: stream source video frame rate
          example: 25
        bit_rate:
          type: integer
          description: stream source video bit rate
          example: 25
        gop_size:
          type: integer
          description: stream source video gop size
          example: 25
        start_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: start time of stream processing
        duration:
          type: number
          minimum: 0
          description: duration of the video in seconds
        progress:
          type: number
          minimum: 0
          maximum: 1
          description: video processing progress
      required: [ width, height, frame_rate, bit_rate, gop_size, start_time]
      nullable: True
      description: stream source video info

    stream_response:
      type: object
      properties:
        stream_id:
          $ref: '#/components/schemas/stream_id'
        account_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
          description: stream account ID
        name:
          $ref: '#/components/schemas/stream_name'
        description:
          allOf:
            - $ref: '#/components/schemas/string128_default'
          description: stream description
          example: some description
        data:
          $ref: '#/components/schemas/stream_data_required'
        event_handler:
          $ref: '#/components/schemas/stream_event_handler_response'
        policies:
          $ref: '#/components/schemas/stream_policies_with_defaults'
        location:
          $ref: '#/components/schemas/location'
        autorestart:
          $ref: '#/components/schemas/stream_autorestart_response'
        version:
          $ref: '#/components/schemas/stream_version'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: stream create time
        status:
          allOf:
            - $ref: '#/components/schemas/stream_status'
          enum: [ pending,in_progress,done,pause,cancel,failure]
          example: pending
        last_error:
          $ref: '#/components/schemas/stream_error'
        video_info:
          $ref: '#/components/schemas/video_info'
        groups:
          type: array
          items:
            $ref: '#/components/schemas/group_name'
          description: list of groups the stream belongs to
        preview:
          $ref: '#/components/schemas/preview_nullable'
      required: [ stream_id, account_id, name, description, data, event_handler, policies, location, autorestart, version, create_time, status, last_error, video_info, groups, preview ]

    stream_to_be_patched:
      type: object
      properties:
        description:
          allOf:
            - $ref: '#/components/schemas/string128_default'
          description: new stream description
        status:
          type: string
          enum: [ pending, pause, cancel ]
          description: new stream processing status
      minProperties: 1
      example:
        description: cancelled stream description
        status: cancel

    queue_streams_response_pending:
      description: Streams from the Stream Processing Queue.
      type: object
      properties:
        streams:
          description: Array of the streams. Ordered by status last update time (old first).
          type: array
          items:
            allOf:
             - $ref: '#/components/schemas/stream_response'
            properties:
              status:
                allOf:
                  - $ref: '#/components/schemas/stream_status'
                enum: [ pending ]
      required: [streams]

    queue_streams_response_in_progress:
      description: Streams from the Stream Processing Queue.
      type: object
      properties:
        streams:
          description: Array of the streams. Ordered by status last update time (old first).
          type: array
          items:
            allOf:
            - $ref: '#/components/schemas/stream_response'
            properties:
              data:
                $ref: '#/components/schemas/stream_data'
              status:
                allOf:
                  - $ref: '#/components/schemas/stream_status'
                enum: [in_progress]
                example: in_progress
            required: [ stream_id, name, description, data, event_handler, policies, location, autorestart, version, create_time, status, last_error, video_info, groups]
      required: [streams]

    post_streams_processing_queue_request_filters:
      properties:
        stream_ids:
          description: Stream Id filter. Only streams with the specified ids will be returned in the response.
          type: array
          items:
            $ref: '#/components/schemas/stream_id'
          maxItems: 1000
        names:
          description: Stream Name filter. Only streams with the specified names will be returned in the response.
          type: array
          items:
            $ref: '#/components/schemas/stream_name'
          maxItems: 1000
        group_ids:
          description: Group Id filter. Only streams with the specified ids will be returned in the response.
          type: array
          items:
            $ref: '#/components/schemas/group_id'
          maxItems: 1000
        group_names:
          description: Group name filter. Only streams with the specified names will be returned in the request.
          type: array
          items:
            $ref: '#/components/schemas/group_name'
          maxItems: 1000

    post_streams_processing_queue_request:
      description: Request data. Query for the streams queue.
      type: object
      properties:
        filters:
          $ref: '#/components/schemas/post_streams_processing_queue_request_filters'
        limit:
          type: integer
          minimum: 1
          description: maximum number of the streams to return
      required: [filters, limit]

    preview_url:
      type: string
      format: uri-reference
      maxLength: 256

    live_preview:
      type: object
      properties:
        url:
          allOf:
          - $ref: '#/components/schemas/preview_url'
          description: live preview url
      description: live preview data

    last_frame_preview:
      type: object
      properties:
        url:
          allOf:
          - $ref: '#/components/schemas/preview_url'
          description: last frame preview url
      description: last frame preview data

    preview:
      type: object
      properties:
        live:
          $ref: '#/components/schemas/live_preview'
        last_frame:
          $ref: '#/components/schemas/last_frame_preview'
      description: preview data

    preview_nullable:
      allOf:
      - $ref: '#/components/schemas/preview'
      nullable: true

    post_streams_processing_feedback_request:
      description: streams info object
      type: object
      properties:
        streams:
          description: array of stream info
          type: array
          items:
            description: stream info from the processor
            type: object
            properties:
              error:
                $ref: '#/components/schemas/stream_error'
              video_info:
                $ref: '#/components/schemas/video_info'
              stream_id:
                $ref: '#/components/schemas/stream_id'
              status:
                allOf:
                  - $ref: '#/components/schemas/stream_status'
                enum: [in_progress, done, failure]
                example: in_progress
              version:
                $ref: '#/components/schemas/stream_version'
              preview:
                $ref: '#/components/schemas/preview'
            required: [ error, video_info, stream_id, status, version ]
      required: [streams]

    feedback_response_modified_stream:
      description: current stream info as is in the database (differs from the info in the request)
      type: object
      properties:
        stream_id:
          $ref: '#/components/schemas/stream_id'
        status:
          allOf:
            - $ref: '#/components/schemas/stream_status'
          enum: [ pending,in_progress,done,pause,cancel,failure,not_found ]
          example: in_progress
        version:
          allOf:
            - $ref: '#/components/schemas/stream_version'
          minimum: 0  # if stream was not found
      required: [ stream_id, status, version ]

    feedback_response_unmodified_stream:
      description: current stream info as is in the database (same as in the request)
      type: object
      properties:
        stream_id:
          $ref: '#/components/schemas/stream_id'
        status:
          allOf:
            - $ref: '#/components/schemas/stream_status'
          enum: [ in_progress, done, failure ]
          example: in_progress
        version:
          $ref: '#/components/schemas/stream_version'
      required: [ stream_id, status, version ]

    feedback_response:
      description: streams info object
      type: object
      properties:
        streams:
          description: stream info objects
          type: object
          properties:
            modified:
              description: streams that need reload
              type: array
              items:
                $ref: '#/components/schemas/feedback_response_modified_stream'
            unmodified:
              description: streams that do not need reload
              type: array
              items:
                $ref: '#/components/schemas/feedback_response_unmodified_stream'
          required: [modified, unmodified]
      required: [streams]

    log_time:
      allOf:
      - $ref: '#/components/schemas/time'
      - description: log record time

    streams_logs:
      type: object
      properties:
        logs:
          type: array
          description: streams logs
          items:
            type: object
            properties:
              stream_id:
                $ref: '#/components/schemas/stream_id'
              log_time:
                $ref: '#/components/schemas/log_time'
              error:
                $ref: '#/components/schemas/stream_error'
              status:
                allOf:
                  - $ref: '#/components/schemas/stream_status'
                enum: [ pending, in_progress, done, pause, restart, cancel, failure, handler_lost, deleted ]
                example: in_progress
              video_info:
                $ref: '#/components/schemas/video_info'
              version:
                $ref: '#/components/schemas/stream_version'
              preview:
                $ref: '#/components/schemas/preview_nullable'
            minProperties: 1
          minItems: 0
      required: [logs]

    streams_logs_deleted_count:
      type: object
      properties:
        deleted_count:
          type: integer
          description: deleted logs count
          example: 1000
      required: [ deleted_count ]

    streams_to_be_deleted:
      type: object
      properties:
        stream_ids:
          description: Stream Id filter.
          type: array
          items:
            $ref: '#/components/schemas/stream_id'
          maxItems: 1000
        names:
          description: Stream Name filter.
          type: array
          items:
            $ref: '#/components/schemas/stream_name'
          maxItems: 1000

    group_name:
      type: string
      pattern: '^[a-zA-Z0-9_\-]{1,128}$'
      description: group name
      example: "hd_stream_2"

    group_description:
      type: string
      description: group description
      maxLength: 256

    create_group:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
        group_name:
          $ref: '#/components/schemas/group_name'
        description:
          allOf:
            - $ref: '#/components/schemas/group_description'
          default: ""
      required: [ account_id, group_name ]
      example:
        account_id: ee4c42b6-23ae-410e-a2aa-a4220e64ba4b
        group_name: "stream_group-1"
        description: "default stream group"

    create_group_response:
      type: object
      properties:
        group_id:
          $ref: '#/components/schemas/group_id'
        group_name:
          $ref: '#/components/schemas/group_name'
      required: [ group_id, group_name ]
      example:
        group_id: "ee4c42b6-23ae-410e-a2aa-a4220e64ba4b"
        group_name: "stream_group-1"

    groups_count:
      type: object
      properties:
        groups_count:
          type: integer
          description: count of groups
      required: [ groups_count ]
      example:
        groups_count: 7

    update_group:
      type: object
      properties:
        description:
          allOf:
            - $ref: '#/components/schemas/group_description'
      required: [ description ]
      example:
        description: "old stream group"

    group_response:
      type: object
      properties:
        group_name:
          $ref: '#/components/schemas/group_name'
        group_id:
          $ref: '#/components/schemas/group_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        description:
          $ref: '#/components/schemas/group_description'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: group create time
      required: [ account_id, group_name, group_id, description, create_time ]
      example:
        account_id: ee4c42b6-23ae-410e-a2aa-a4220e64ba4b
        group_name: "stream_group-1"
        group_id: "b5d6fd45-fcca-453d-ac05-3e594054b813"
        description: "default stream group"
        create_time: "2018-08-11T09:11:41.674Z"

    linker:
      type: object
      properties:
        action:
          description: "action to perform: attach streams to group or detach"
          type: string
          enum: [attach, detach]
        stream_ids:
          description: stream ids
          type: array
          maxItems: 1000
          items:
            $ref: '#/components/schemas/uuid'
        group_id:
          $ref: '#/components/schemas/group_id'
      required: [action, stream_ids, group_id]
  responses:
    internal_server_error:
      description: internal server error.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'

    license_problem:
      description: License problem.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            no_license_info:
              value:
                error_code: 11055
                desc: Forbidden
                detail: "License problem: Cannot get license information"
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055
            license_expired:
              value:
                error_code: 11055
                desc: Forbidden
                detail: "License problem: License expired"
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055
            license_limit_exceeded:
              value:
                error_code: 11055
                desc: Forbidden
                detail: "License problem: Streams license limit exceeded. Please contact VisionLabs for license upgrade or delete redundant streams"
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055
paths:
  /version:
    get:
      tags:
      - version

      summary: get version
      description: get service version
      operationId: getVersion

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/version'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/version'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/streams:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'

    post:
      tags:
        - streams
      summary: create stream
      description: Create a new stream.
      operationId: createStream
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/stream_to_be_created'
        required: true
      responses:
        201:
          description: Create success.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  stream_id:
                    allOf:
                      - $ref: '#/components/schemas/stream_id'
                    description: |
                      ID of the created stream.
                      The ID can be used as the `stream_id` parameter in [GET](#operation/getStream) `/streams/{stream_id}`.
                  version:
                    type: integer
                    enum: [1]
                    description: stream initial version
                required: [ stream_id, version ]
                example:
                  stream_id: b5d6fd45-fcca-453d-ac05-3e594054b813
                  version: 1
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: |
                        Failed to validate input json.
                        Path: 'status',  message: unexpected value; permitted: 'pending', 'pause'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        403:
          $ref: '#/components/responses/license_problem'
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
        - streams
      summary: get streams
      description: Get streams according to filters. The results are sorted by stream creation order, the oldest streams shown first.
      operationId: getStreams
      parameters:
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/stream_ids'
        - $ref: '#/components/parameters/stream_names'
        - $ref: '#/components/parameters/stream_reference'
        - $ref: '#/components/parameters/stream_statuses'
        - $ref: '#/components/parameters/stream_create_time__gte'
        - $ref: '#/components/parameters/stream_create_time__lt'
        - $ref: '#/components/parameters/group_name'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  streams:
                    type: array
                    items:
                      $ref: '#/components/schemas/stream_response'
                    minItems: 0
                required: [ streams ]
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'stream_ids'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012

        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - streams
      summary: delete streams
      description: Delete streams matching specified filters (OR).
      operationId: deleteStreams
      parameters:
        - $ref: '#/components/parameters/account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/streams_to_be_deleted'
        required: true
      responses:
        204:
          description: Delete success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message: ''Additional properties are not
                                 allowed (''faces'' was unexpected)'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022

        500:
          $ref: '#/components/responses/internal_server_error'
  /1/streams/count:
    get:
      tags:
        - streams
      summary: count streams
      description: |
        Count streams according to the filters.

      operationId: countStreams
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/stream_ids'
        - $ref: '#/components/parameters/stream_names'
        - $ref: '#/components/parameters/stream_reference'
        - $ref: '#/components/parameters/stream_statuses'
        - $ref: '#/components/parameters/stream_create_time__gte'
        - $ref: '#/components/parameters/stream_create_time__lt'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  streams_count:
                    allOf:
                      - $ref: '#/components/schemas/count'
                    description: stream count
                description: stream count
                required: [ streams_count ]
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'stream_ids'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/streams/{stream_id}:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - in: path
        name: stream_id
        schema:
          $ref: '#/components/schemas/uuid'
        required: true
        description: ID of the stream (`stream_id` received in the "create stream" request).

    get:
      tags:
      - streams
      summary: get stream
      description: Get the stream by ID.
      operationId: getStream
      parameters:
        - $ref: '#/components/parameters/account_id'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/stream_response'
        404:
          description: Stream not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                error_code: 39001
                desc: Object not found
                detail: Stream with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39001
        500:
          $ref: '#/components/responses/internal_server_error'

    patch:
      tags:
        - streams
      summary: update stream
      description: |
        Update stream fields: *description*, *status*.
      operationId: patchStream
      parameters:
        - $ref: '#/components/parameters/account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/stream_to_be_patched'
        required: true
      responses:
        204:
          description: Update success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                nothing_to_update:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message: ''at least one field must have a value'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
                invalid_status:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''status'',  message: ''unexpected value; permitted: ''pending'', ''pause'', ''cancel'''''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
                extra_fields:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''user_data'',  message: ''extra fields not permitted'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
                unable_to_pause:
                  value:
                    error_code: 39003
                    desc: Unable to stop processing
                    detail: 'Processing of stream with id ''557d54ec-29ad-4f3c-93b4-c9092ef12515'' is already in progress and cannot be stopped.'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39003
                unable_to_cancel:
                  value:
                    error_code: 39005
                    desc: Unable to cancel processing
                    detail: 'Processing of streams with id ''557d54ec-29ad-4f3c-93b4-c9092ef12515'' is finished and cannot be cancelled'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39005
        403:
          $ref: '#/components/responses/license_problem'
        404:
          description: Stream not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                error_code: 39001
                desc: Object not found
                detail: Stream with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39001
        500:
          $ref: '#/components/responses/internal_server_error'

    put:
      tags:
        - streams
      summary: put stream
      description: Update existing stream. You should specify all the fields required for the stream in the request.
      operationId: putStream
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/stream_to_be_created'
        required: true
      responses:
        200:
          description: Put success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  stream_id:
                    allOf:
                      - $ref: '#/components/schemas/stream_id'
                    description: |
                      ID of the stream that was put.
                      The ID can be used as the `stream_id` parameter in [GET](#operation/getStream) `/streams/{stream_id}`.
                  version:
                    allOf:
                      - $ref: '#/components/schemas/stream_version'
                    description: stream current version (incremented on every change)
                required: [ stream_id, version ]
                example:
                  stream_id: b5d6fd45-fcca-453d-ac05-3e594054b813
                  version: 10
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: |
                      Failed to validate input json.
                      Path: 'status',  message: unexpected value; permitted: 'pending', 'pause'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        403:
          $ref: '#/components/responses/license_problem'
        404:
          description: Stream not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                error_code: 39001
                desc: Object not found
                detail: Stream with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39001
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - streams
      summary: remove stream
      description: Remove the stream by ID.
      operationId: removeStream
      parameters:
        - $ref: '#/components/parameters/account_id'
      responses:
        204:
          description: Delete success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        404:
          description: Stream not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                error_code: 39001
                desc: Object not found
                detail: Stream with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39001
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/streams/processing/queue:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
    get:
      tags:
      - queue
      summary: Check the streams processing queue
      description: See the streams in the queue.
      operationId: getStreamsQueue
      parameters:
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/stream_ids'
        - $ref: '#/components/parameters/stream_names'
        - $ref: '#/components/parameters/group_ids'
        - $ref: '#/components/parameters/group_names'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/queue_streams_response_pending'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'limit'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        500:
          $ref: '#/components/responses/internal_server_error'

    post:
      tags:
      - queue
      summary: Get some streams from the queue
      description: | 

        Receive streams from the queue. The streams are received according to the specified filters.  

        The following actions are performed upon the request:

        - The streams are marked as "in progress".
        - The streams are deleted from the Streams Processing Queue.
        
        The information about the streams is returned in the response.

      operationId: getStreamsFromQueue
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post_streams_processing_queue_request'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/queue_streams_response_in_progress'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: |
                      Failed to validate input json. Path: 'filters',  message: 'field required'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/streams/processing/feedback:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
    post:
      tags:
      - queue
      summary: Post feedback on streams
      description: |

        Post information about streams processing. 

      operationId: postStreamsFeedback
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post_streams_processing_feedback_request'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/feedback_response'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: |
                      Failed to validate input json. Path: 'streams',  message: 'field required'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/streams/{stream_id}/preview/handler/frame:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/stream_id_path'
    get:
      tags:
      - preview
      summary: Get last frame preview
      description: |
        
        Get stream last frame preview.
        
        To add preview for stream, use `Post feedback on streams` request to create last frame preview.
      operationId: previewFrameProxy
      responses:
        200:
          description: OK.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        404:
          description: Not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                stream_not_found:
                  value:
                    error_code: 39001
                    desc: Object not found
                    detail: Stream with id 00000000-0000-4000-a000-000000642312 not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39001
                preview_not_found:
                  value:
                    error_code: 39009
                    desc: Forbidden
                    detail: Not found `live` preview url for stream with id '00000000-0000-4000-a000-000000642312'.
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39009
        500:
          description: internal server error.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                internal_server_error:
                  value:
                    error_code: 1
                    desc: internal server error
                    detail: internal server error
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-1
                stream_not_found:
                  value:
                    error_code: 39010
                    desc: Preview processing error
                    detail: Connection refused
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39010
  /1/streams/{stream_id}/preview/handler/live:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/stream_id_path'
    get:
      tags:
      - preview
      summary: Get live preview
      description: |
        
        Get stream live preview.
        
        To add preview for stream, use `Post feedback on streams` request to create live preview.
      operationId: previewLiveProxy
      responses:
        200:
          description: OK.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        404:
          description: Not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                stream_not_found:
                  value:
                    error_code: 39001
                    desc: Object not found
                    detail: Stream with id 00000000-0000-4000-a000-000000642312 not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39001
                preview_not_found:
                  value:
                    error_code: 39009
                    desc: Forbidden
                    detail: Not found `live` preview url for stream with id '00000000-0000-4000-a000-000000642312'.
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39009
        500:
          description: internal server error.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                internal_server_error:
                  value:
                    error_code: 1
                    desc: internal server error
                    detail: internal server error
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-1
                stream_not_found:
                  value:
                    error_code: 39010
                    desc: Preview processing error
                    detail: Connection refused
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39010
  /1/streams/logs:
    get:
      tags:
        - streams logs
      summary: get streams logs
      description: Get streams logs according to filters. The results are sorted by log creation order, 
        the new streams logs shown first.
      operationId: getStreamsLogs
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/stream_ids'
        - $ref: '#/components/parameters/stream_statuses'
        - $ref: '#/components/parameters/log_targets'
        - $ref: '#/components/parameters/log_time__lt'
        - $ref: '#/components/parameters/log_time__gte'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/streams_logs'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'log_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - streams logs
      summary: delete stream logs
      description: Delete streams logs older than specified date excluding last log entry.
      operationId: deleteStreamsLogs
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/log_time__lt_deleting'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/streams_logs_deleted_count'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'log_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/groups:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'

    post:
      tags:
        - groups
      summary: create group
      description: Create a new group.
      operationId: createGroup
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_group'
        required: true
      responses:
        201:
          description: Create success.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
                format: url
                example: /1/groups/group-1
              description: location of new group
              required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/create_group_response'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: |
                        Failed to validate input json.
                        Path: 'account_id',  message: 'field required'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        409:
          description: Conflict
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                error_code: 39006
                desc: Unique constraint error
                detail: Group named 'group1' already exists
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39006
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
        - groups
      summary: get groups
      description: Get groups according to filters. The results are sorted by group creation order, the oldest group shown first.
      operationId: getGroups
      parameters:
        - $ref: '#/components/parameters/group_ids'
        - $ref: '#/components/parameters/group_names'
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  groups:
                    type: array
                    items:
                      $ref: '#/components/schemas/group_response'
                    minItems: 0
                required: [ groups ]
              example:
                - account_id: ee4c42b6-23ae-410e-a2aa-a4220e64ba4b
                  group_name: "stream_group-1"
                  group_id: "b5d6fd45-fcca-453d-ac05-3e594054b813"
                  description: "default stream group"
                  create_time: "2018-08-11T09:11:41.674Z"
                - account_id: 2d6cbe1f-cbbe-485a-ab37-b968cc5e8764
                  group_name: "stream_group-2"
                  group_id: "a7d8fd45-fgga-453d-ac05-3e594054b813"
                  description: "stream group 2"
                  create_time: "2019-10-11T10:11:41.674Z"
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/groups/count:
    get:
      tags:
        - groups
      summary: get group count
      description: |
        Count of groups according to the filters.
      operationId: countGroups
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/group_ids'
        - $ref: '#/components/parameters/group_names'
        - $ref: '#/components/parameters/account_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/groups_count'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/groups/{group_id}:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - in: path
        name: group_id
        schema:
          $ref: '#/components/schemas/uuid'
        required: true
        description: ID of the group (`group_id` received in the "create group" request).

    get:
      tags:
        - groups
      summary: get group
      description: Get the group by name.
      operationId: getGroup
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/group_response'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        404:
          description: Group not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                error_code: 39008
                desc: Object not found
                detail: Group with id ee4c42b6-23ae-410e-a2aa-a4220e64ba4b not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39008
        500:
          $ref: '#/components/responses/internal_server_error'

    patch:
      tags:
        - groups
      summary: update group
      description: |
        Update group fields: *description*
      operationId: patchGroup
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/update_group'
        required: true
      responses:
        204:
          description: Update success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        404:
          description: Group not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                error_code: 39008
                desc: Object not found
                detail: Group with id ee4c42b6-23ae-410e-a2aa-a4220e64ba4b not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39008
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - groups
      summary: remove group
      description: Remove the group by name.
      operationId: deleteGroup
      responses:
        204:
          description: Delete success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        404:
          description: Group not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                error_code: 39008
                desc: Object not found
                detail: Group with id ee4c42b6-23ae-410e-a2aa-a4220e64ba4b not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-39008
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/linker:
    patch:
      tags:
        - linker
      summary: attach (or detach) streams to a group
      description: attach (or detach) streams to a group
      operationId: linker
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/linker'
      responses:
        204:
          description: Operation succeeded
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/docs/spec:
    get:
      tags:
        - documents
      summary: get openapi documentation
      description: |
        Get service OpenApi documentation. If *Accept* request header is of type `application/x-yaml`,
        returns documentation in `yaml` format or returns `html` documentation, if *Accept-Type* is `text/html`
      operationId: getSpec

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/accept_docs_handler'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/docs_content_type'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/x-yaml:
              schema:
                type: string
                description: yaml format documentation
            text/html:
              schema:
                type: string
                description: html format documentation
        415:
          description: Unsupported Media Type
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                unsupported_media_type:
                  value:
                    error_code: 12024
                    detail: Bad/incomplete input data
                    desc: Unsupported media type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12024
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/docs/dev:
    parameters:
      - $ref: '#/components/parameters/Accept'
    get:
      tags:
        - documents
      summary: get development manual
      description: |
        Get sphinx documentation - *Development Manual*. After the request you will be redirected to the page `/docs/dev/index.html`
      operationId: getDevManual

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/html:
              schema:
                type: string
                description: html format documentation
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/config:
    get:
      tags:
        - config
      summary: get service configuration
      description: Get service configuration. Passwords and tokens will be hidden in the response.
      operationId: getConfig

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/accept_config_handler'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/config_accept_content_type'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                description: json format configuration
              example:
                INFLUX_MONITORING:
                  SEND_DATA_FOR_MONITORING: 0
                  VERSION: 2
                  ORGANIZATION: ORGANIZATION_NAME
                  TOKEN: '********'
                  BUCKET: luna_monitoring
                  HOST: 127.0.0.1
                  PORT: 8086
                  USE_SSL: 0
                  FLUSHING_PERIOD: 1.0
            text/plain:
              schema:
                type: string
                description: text format configuration
              example: |
                [INFLUX_MONITORING]
                SEND_DATA_FOR_MONITORING = 0
                VERSION = 2
                ORGANIZATION = ORGANIZATION_NAME
                TOKEN = ********
                BUCKET = luna_monitoring
                HOST = 127.0.0.1
                PORT = 8086
                USE_SSL = 0
                FLUSHING_PERIOD = 1.0
        415:
          description: Unsupported Media Type
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                unsupported_media_type:
                  value:
                    error_code: 12024
                    detail: Bad/incomplete input data
                    desc: Unsupported media type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12024
        500:
          $ref: '#/components/responses/internal_server_error'
  /healthcheck:
    get:
      tags:
      - health
      summary: get health
      description: get health of service
      operationId: healthcheck
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/include_luna_services'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/health_ok'
        500:
          $ref: '#/components/responses/internal_server_error'
        502:
          description: Unhealthy
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/health_errors'