OpenApi

View spec in html.

openapi: 3.0.0
info:
  version: 'v.1.1.18'
  title: 'LUNA Streams API'
  description: |
     VisionLabs LUNA Streams API. The API version is 1.

     Service is intended for creation and management streams. "Stream" is an user logical entity.

     Default port: 5160.

     OpenAPI specification is the only valid document providing up-to-date information about the service LUNA Streams.

     The specification can be used:

     - By documentation generation tools to visualize the API.
     - By code generation tools.

     All the documents and code generated using this specification can include inaccuracies and should be carefully checked.

     OpenAPI specification can be received using the [/docs/spec](#operation/getSpec) resource. The "Accept" header should be set to "application/x-yaml".

components:
  headers:
    application_json:
      schema:
        type: string
        enum:
        - application/json
      required: true
      description: 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 in system logs that correspond to particular requests.
        If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the response.
      required: true

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

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

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

    page_size:
      in: query
      name: page_size
      schema:
        type: integer
        minimum: 1
        maximum: 1000
        default: 10
      description: 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 in system logs that correspond to particular requests.
        If it was not set, the system will set it to the default format ("timestamp, UUID"). It will be returned with the 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.

    applicationJsonContent:
      in: header
      name: Content-Type
      schema:
        type: string
        enum:
        - application/json
      description: Content type is `application/json`.

    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 excluding 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 excluding 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 excluding 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'

    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.

    order:
      in: query
      name: order
      schema:
        type: string
        enum: ["asc", "desc"]
      description: |
        The sort order.

        By default, the results will be sorted in order of stream appearance in the database (may not match stream `create_time`).
        If "desc" is set, the newest streams will be shown first. If "asc" is set, the oldest streams will be shown first.

        But if some stream ID range filters specified (`stream_id__gte` or `stream_id__lt`), the results will be sorted by stream ID.

    stream_id__gte:
      in: query
      name: stream_id__gte
      schema:
        $ref: '#/components/schemas/stream_id'
      description: Stream id lower included bound.
      example: 'ae09126e-70a6-49c7-923f-df2320f08639'

    stream_id__lt:
      in: query
      name: stream_id__lt
      schema:
        $ref: '#/components/schemas/stream_id'
      description: Stream id upper excluded bound.
      example: 'ae09126e-70a6-49c7-923f-df2320f08639'
  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: API version of service.
            major:
              allOf:
                - $ref: '#/components/schemas/int_version'
              description: Major version of service.
            minor:
              allOf:
                - $ref: '#/components/schemas/int_version'
              description: Minor version of service.
            patch:
              allOf:
                - $ref: '#/components/schemas/int_version'
              description: 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: Stream group ID.

    account_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: Account ID for authentication in the LUNA PLATFORM.

    stream_reference:
      type: string
      maxLength: 512
      description: |
        Stream reference: 
        - for `tcp`, `udp` stream types: path to the source, USB-number
        - for `videofile` stream type: path to video file
        - for `images` stream type: path to folder with images
      example: https://upload.wikimedia.org/wikipedia/commons/2xQ2gprbMUePw1s9gw9fvA==

    roi_integer:
      type: integer
      minimum: 0
      maximum: 65536

    roi_float_percent:
      type: number
      format: float
      minimum: 0.0
      maximum: 100.0

    roi_float_percent_size:
      type: number
      format: float
      minimum: 0.00001
      maximum: 100.0

    rect:
      type: array
      items:
        type: integer
        minimum: 0
        maximum: 65536
      minItems: 4
      maxItems: 4
      deprecated: true
      default: [ 0, 0, 0, 0 ]

    rect_abs:
      type: object
      properties:
        x:
          allOf:
          - $ref: '#/components/schemas/roi_integer'
          description: Region of interest *x* coordinate
        y:
          allOf:
            - $ref: '#/components/schemas/roi_integer'
          description: Region of interest *y* coordinate
        width:
          allOf:
            - $ref: '#/components/schemas/roi_integer'
          description: Region of interest width
        height:
          allOf:
            - $ref: '#/components/schemas/roi_integer'
          description: Region of interest height
        mode:
          type: string
          enum: [abs]
          description: |
            Region of interest coordinates mode.

            - `abs`: absolute coordinates and size in pixels
            - `percent`: coordinates and size are set by percents of stream image size
      required: [x, y, width, height]

    rect_percent:
      type: object
      properties:
        x:
          allOf:
            - $ref: '#/components/schemas/roi_float_percent'
          description: Region of interest *x* coordinate in percents
        y:
          allOf:
            - $ref: '#/components/schemas/roi_float_percent'
          description: Region of interest *y* coordinate in percents
        width:
          allOf:
            - $ref: '#/components/schemas/roi_float_percent_size'
          description: Region of interest width in percents
        height:
          allOf:
            - $ref: '#/components/schemas/roi_float_percent_size'
          description: Region of interest height in percents
        mode:
          type: string
          enum: [percent]
          description: |
            Region of interest coordinates mode.

            - `abs`: absolute coordinates and size in pixels
            - `percent`: coordinates and size are set by percents of stream image size
      required: [x, y, width, height]

    roi:
      oneOf:
        - $ref: '#/components/schemas/rect_abs'
        - $ref: '#/components/schemas/rect_percent'
        - $ref: '#/components/schemas/rect'
      description: |
        Region of interest of camera frame (x, y, width, height). Can be specified either as a json object or as an array. The array format is deprecated.

        If array format is used, the elements represent the values of `x`, `y`, `width` and `height` according to their order

        If the value is omitted, the default will be: `{"x": 0, "y": 0, "width": 0, "height": 0, "mode": "abs"}`

        This means that the whole frame is the region of interest

        **Only for processing faces.**

    droi:
      oneOf:
        - $ref: '#/components/schemas/rect_abs'
        - $ref: '#/components/schemas/rect_percent'
        - $ref: '#/components/schemas/rect'
      description: |
        Region of interest within the ROI zone. Can be specified either as a json object or as an array. The array format is deprecated.

        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.

        If array format is used, the elements represent the values of `x`, `y`, `width` and `height` according to their order

        If the value is omitted, the default will be: `{"x": 0, "y": 0, "width": 0, "height": 0, "mode": "abs"}`

        This means that the whole frame is the region of interest

        **Only for processing faces.**

    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. 
        
        The parameter is intended to work with protocols that imply the presence of several channels with different 
        bitrates and resolutions (for example, HLS).
        If the stream has several such channels, then this parameter will enable you to select from all the channels
        of the whole stream the channel whose frame width is closer to the value specified in this parameter.

        **Intended for use with "tcp" and "udp" stream types.**

    stream_data_common:
      type: object
      properties:
        type:
          type: string
          description: |
            Stream type.
            - `images` - set of frames as separate image files
            - `videofile` - video file
            - `tcp` - transport layer network protocol
            - `udp` - transport layer network protocol

            Only transport layer protocols (TCP or UDP) are specified. It is necessary
            to understand on which transport layer protocol the application layer protocol 
            (HTTP, RTSP, HLS, etc.) is based.
        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_v2:
      type: object
      properties:
        type:
          type: string
          description: |
            Stream type.
            - `images` - set of frames as separate image files
            - `videofile` - video file
            - `tcp` - transport layer network protocol
            - `udp` - transport layer network protocol

            Only transport layer protocols (TCP or UDP) are specified. It is necessary
            to understand on which transport layer protocol the application layer protocol 
            (HTTP, RTSP, HLS, etc.) is based.
        analytics:
          type: array
          min_items: 1
          items:
            $ref: '#/components/schemas/stream_analytics_v2'
        frame_processing_mode:
          $ref: '#/components/schemas/frame_processing_mode'
        real_time_mode_fps:
          $ref: '#/components/schemas/real_time_mode_fps'
        ffmpeg_threads_number:
          $ref: '#/components/schemas/ffmpeg_threads_number'
        reference:
          $ref: '#/components/schemas/stream_reference'
        roi:
          $ref: '#/components/schemas/roi'
        rotation:
          $ref: '#/components/schemas/rotation'
        preferred_program_stream_frame_width:
          $ref: '#/components/schemas/preferred_program_stream_frame_width'
      required: [ type, reference, analytics ]

    stream_analytics_v2:
      type: object
      properties:
        enabled:
          type: boolean
          default: true
        mode:
          type: integer
          enum: [1, 2, 3]
          default: 3
          description: |
            Analytics mode:
              - 1 - faces
              - 2 - bodies
              - 3 - humans (default)
        droi:
          $ref: '#/components/schemas/droi'
        filtering:
          $ref: '#/components/schemas/filtering_v2'
        primary_track_policy:
          $ref: '#/components/schemas/primary_track_policy'
        sending:
          $ref: '#/components/schemas/sending_v2'
        event_handler:
          $ref: '#/components/schemas/stream_event_handler_v2'
        healthcheck:
          $ref: '#/components/schemas/healthcheck_policy'
        liveness:
          $ref: '#/components/schemas/liveness_policy_v2'
      required: [event_handler]
      description: Face Stream analytics

    sending_v2:
      type: object
      properties:
        body:
          type: object
          properties:
            send_only_full_set:
              type: boolean
              default: true
              description: |
                  Send data only if the required number of best shots
                  (`analytics` > `sending` > `bestshot_settings` >
                  `body_bestshots_to_send` parameter) and detections with human
                  body coordinates (`minimal_body_track_length_to_send`
                  parameter of `FACE_STREAM_CONFIG` settings) have been
                  collected.

                  **Only for processing bodies.**
            delete_track_after_sending:
              type: boolean
              default: false
              description: |
                Whether to delete the best shots and detections with human body coordinates after sending the data.
                
                **Only for processing bodies.**
        bestshot_settings:
          type: object
          properties:
            type:
              type: integer
              enum: [1, 2, 3, 4]
              default: 3
              description: |
                Bestshot mode:
                  - 1 - faces_only
                  - 2 - bodies_only
                  - 3 - faces_with_bodies (default)
                  - 4 - (separately)
            face_bestshots_to_send:
              type: integer
              default: 1
              description: Number of best frames for face detections to send
            body_bestshots_to_send:
              type: integer
              default: 1
              description: Number of best frames for body detections to send
          description: Settings of which bestshots will be sent to platform.
        full_frame_settings:
          type: integer
          enum: [1, 2, 3, 4]
          default: 3
          description: |
            Should only be present if analytics mode is set to 3 (humans).
            Defines which source frames will be sent to LP.
              - 1 - faces_only
              - 2 - bodies_only
              - 3 - faces_with_bodies (default)
              - 4 - (separately)
        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.

            The measurement type is set in the `type` parameter. If the value is `-1` (by default), then frame analysis is performed on all frames until the end of the track. At the end of the track (when the object leaves the frame), the best frame will be sent to LUNA PLATFORM.
        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.

            The measurement type is set in the `type` parameter. If the value is `-1`, then the silent period will last indefinitely.
        type:
          type: string
          enum: [ sec, frames ]
          default: sec
          description: Measurement type for `time_period_of_searching` and `silent_period` parameters (per frames or per seconds).
      description: Stream sending parameters.

    sending_v2_required:
      allOf:
        - $ref: '#/components/schemas/sending_v2'
        - properties:
            body:
              required: [send_only_full_set, delete_track_after_sending]
            bestshot_settings:
              required: [type, face_bestshots_to_send, body_bestshots_to_send]
          required: [body, bestshot_settings, time_period_of_searching, silent_period, type]

    filtering_v2:
      type: object
      properties:
        min_score_face:
          type: number
          default: 0.5187
          description: |
            Score that defines detection quality. Threshold for filtering detections of faces sent to LUNA PLATFORM.

            Recommended value: **0.5187**
        min_score_body:
          type: number
          default: 0.5
          description: |
            Score that defines detection quality. Threshold for filtering detections of bodies sent to LUNA PLATFORM.

            Recommended value: **0.5**
        detection_yaw_threshold:
          type: number
          minimum: 0
          maximum: 180
          default: 40.0
          description: |
            Maximum value of head yaw angle in relation to camera.

            **Only for processing faces.**
        detection_pitch_threshold:
          type: number
          minimum: 0
          maximum: 180
          default: 40.0
          description: |
            Maximum value of head pitch angle in relation to camera.

            **Only for processing faces.**
        detection_roll_threshold:
          type: number
          minimum: 0
          maximum: 180
          default: 30.0
          description: |
            Maximum value of head roll angle in relation to camera.

            **Only for processing faces.**
        yaw_number:
          type: integer
          default: 1
          description: |
            Number of frames for image filtration based on head yaw angle.

            The algorithm analyzes head yaw angles on each of those frames. If on one of them the angle is significantly different from the average 
            value of angles, the frame will not be considered as a candidate for best shot.

            By default, the parameter is disabled, the value is `1`.

            **Only for processing faces.**
        yaw_collection_mode:
          type: boolean
          default: false
          description: |
            Whether to collect a certain number of frames set in `yaw_number` to analyze head yaw angle.

            If `yaw_collection_mode` is disabled, then the system will analyze incoming frames sequentially, 
            i.e., first two frames are analyzed, then three, etc. The maximum number of frames in this sequence is set in `yaw_number` parameter.

            **Only for processing faces.**
        mouth_occlusion_threshold:
          type: number
          format: float
          default: 0.0
          example: 0.1
          description: |
            Maximum degree of overlap of the face mouth in the frame. I.e. when the value is equal to "0.5", 50% of the mouth can be occluded.

            **Only for processing faces.**
        min_body_size_threshold:
          type: number
          format: float
          minimum: 0
          default: 0.0
          example: 0.1
          description: |
            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). 

            If the value is `0`, then filtering of body detection by size will not be performed.

            **Only for processing bodies.**
      description: Stream filtering parameters.

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

    stream_data_common_v2_required:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_v2'
        - properties:
            analytics:
              type: array
              items:
                $ref: '#/components/schemas/stream_analytics_with_defaults'
          required: [type, analytics, frame_processing_mode, real_time_mode_fps, ffmpeg_threads_number, reference, roi, 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_v2:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_v2'
        - properties:
            type:
              enum: [ udp ]
            endless:
              $ref: '#/components/schemas/stream_endless'

    stream_data_udp_v2_required:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_v2_required'
        - properties:
            type:
              enum: [ udp ]
            endless:
              $ref: '#/components/schemas/stream_endless'
        - required: [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_v2:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_v2'
        - properties:
            type:
              enum: [ tcp ]
            endless:
              $ref: '#/components/schemas/stream_endless'

    stream_data_tcp_v2_required:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_v2_required'
        - properties:
            type:
              enum: [ tcp ]
            endless:
              $ref: '#/components/schemas/stream_endless'
        - required: [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_v2:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_v2'
        - properties:
            type:
              enum: [ videofile ]

    stream_data_videofile_v2_required:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_v2_required'
        - 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_v2:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_v2'
        - properties:
            type:
              enum: [ images ]
            mask:
              $ref: '#/components/schemas/file_mask'
          required: [ type, mask ]

    stream_data_images_v2_required:
      allOf:
        - $ref: '#/components/schemas/stream_data_common_v2_required'
        - 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 setting parameters.

    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 setting parameters.

    stream_data_v2:
      oneOf:
        - $ref: '#/components/schemas/stream_data_udp_v2'
        - $ref: '#/components/schemas/stream_data_tcp_v2'
        - $ref: '#/components/schemas/stream_data_videofile_v2'
        - $ref: '#/components/schemas/stream_data_images_v2'
      discriminator:
        propertyName: type
        mapping:
          udp: '#/components/schemas/stream_data_udp_v2'
          tcp: '#/components/schemas/stream_data_tcp_v2'
          videofile: '#/components/schemas/stream_data_videofile_v2'
          images: '#/components/schemas/stream_data_images_v2'
      description: Stream setting parameters.

    stream_data_v2_required:
      oneOf:
        - $ref: '#/components/schemas/stream_data_udp_v2_required'
        - $ref: '#/components/schemas/stream_data_tcp_v2_required'
        - $ref: '#/components/schemas/stream_data_videofile_v2_required'
        - $ref: '#/components/schemas/stream_data_images_v2_required'
      discriminator:
        propertyName: type
        mapping:
          udp: '#/components/schemas/stream_data_udp_v2_required'
          tcp: '#/components/schemas/stream_data_tcp_v2_required'
          videofile: '#/components/schemas/stream_data_videofile_v2_required'
          images: '#/components/schemas/stream_data_images_v2_required'
      description: Stream setting parameters.

    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 created in the 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]

    event_handler_luna:
      type: object
      properties:
        type:
          type: string
          default: luna_handler
          enum: [luna_handler]
          description: Handler type
        handler_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
          description: Handler ID created in the LUNA PLATFORM.
        frame_store:
          type: string
          example: http://127.0.0.1:5020/1/buckets/frames/images
          nullable: true
          description: URL for saving the faces or bodies source frames in the LUNA PLATFORM. You can specify the address to the bucket of the LUNA Image Store service, or the address to the "/images" resource of the LUNA API service.
        authorization:
          description: |
            Authorization for requests to the LUNA API service of the LUNA PLATFORM.
          oneOf:
            - $ref: "#/components/schemas/token_authorization"
            - $ref: "#/components/schemas/account_authorization"
      required: [ handler_id, authorization, frame_store ]

    stream_event_handler_v2:
      oneOf:
        - $ref: '#/components/schemas/event_handler_luna'
      discriminator:
        propertyName: "type"
        mapping:
          luna_handler: '#/components/schemas/event_handler_luna'
      description: Parameters related to sending the best shots to LUNA PLATFORM and processing them using handlers.

    stream_event_handler_base:
      type: object
      properties:
        origin:
          type: string
          example: http://127.0.0.1:5000
          description: API service origin of the deployed LUNA PLATFORM.
        api_version:
          type: integer
          example: 6
          description: API version of API service of the deployed LUNA PLATFORM.
        bestshot_handler:
          allOf:
            - $ref: '#/components/schemas/handler'
          description: Sets the static `handler_id` pre-created in LUNA PLATFORM to generate events based on the best shots of faces and/or bodies.
        detection_handler:
          allOf:
            - $ref: '#/components/schemas/handler'
            - nullable: true
          deprecated: true
          description: | 
            Sets the dynamic `handler_id` pre-created in LUNA PLATFORM to generate events containing the coordinates of the human body (x, y, width and height). These events are associated by `track_id` with events created using `bestshot_handler`.

            **Only for processing bodies.**
        frame_store:
          type: string
          example: http://127.0.0.1:5020/1/buckets/frames/images
          nullable: true
          description: URL for saving the faces or bodies source frames in the LUNA PLATFORM. You can specify the address to the bucket of the LUNA Image Store service, or the address to the "/images" resource of the LUNA API service.
        authorization:
          description: |
            Authorization for requests to the LUNA API service of the LUNA PLATFORM. 
            If authorization not specified, the `account_id` from stream will be used.
          oneOf:
            - $ref: "#/components/schemas/token_authorization"
            - $ref: "#/components/schemas/account_authorization"
      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: Parameters related to sending the best shots to LUNA PLATFORM and processing them using handlers.

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

    liveness_policy_template:
      type: object
      properties:
        use_mask_liveness_filtration:
          type: boolean
          default: False
          description: Whether to check the presence of a real person in the frame based on backgrounds.
        use_flying_faces_liveness_filtration:
          type: boolean
          default: False
          description: Whether to check 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: |
            Which frames from 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: 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: Threshold for defining 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.
        mask_backgrounds_count:
          type: integer
          default: 0
          example: 300
          description: Number of background frames that are used for the corresponding checks.
      description: |
        Stream Liveness check parameters.

        **Only for processing faces.**

    liveness_policy:
      allOf:
        - $ref: "#/components/schemas/liveness_policy_template"
      properties:
        use_shoulders_liveness_filtration:
          type: boolean
          default: False
          deprecated: true
          description: |
            Whether to check the presence of a real person in the frame based on the head and shoulder areas.

            The parameter is deprecated and will not affect any results.
        livenesses_weights:
          type: array
          items:
            type: number
            format: float
          minItems: 3
          maxItems: 3
          default: [ 0.0, 0.0, 0.0 ]
          example: [ 0.0, 0.45, 0.5 ]
          description: |
            Determines the involvement of each Liveness check type (mask, and flying_faces) in the resulting estimation of the presence of a human face in the frame.

            The liveness shoulders (first value) parameter will be 0.0 regardless to anything.


    liveness_policy_v2:
      allOf:
        - $ref: "#/components/schemas/liveness_policy_template"
      properties:
        livenesses_weights:
          type: array
          items:
            type: number
            format: float
          minItems: 2
          maxItems: 2
          default: [ 0.0, 0.0]
          example: [ 0.45, 0.5 ]
          description: |
            Determines the involvement of each Liveness check type (mask, flying_faces) in the resulting estimation of the presence of a human face in the frame.

    primary_track_policy:
      type: object
      properties:
        use_primary_track_policy:
          type: boolean
          default: false
          description: Whether to use primary track policy.
        best_shot_min_size:
          type: integer
          default: 70
          description: Minimal height of detections in pixels for primary track policy at which frame analysis begins and the best shot is determined.
        best_shot_proper_size:
          type: integer
          default: 140
          description: Height of detections in pixels for primary track policy. When detection reaches the defined value, track immediately sends all its best shots to LUNA PLATFORM.
      description: |
        Stream primary track policy parameters. 

        These parameters is used to work with Access Control Systems (ACS, turnstiles at the entrances to banks/office buildings) to simplify the control and the introduction of facial recognition technology at the entrance to a protected area.

        **Only for processing faces. Not intended for use with "images" stream type.**

    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.

                The measurement type is set in the `type` parameter. If the value is `-1` (by default), then frame analysis is performed on all frames until the end of the track. At the end of the track (when the object leaves the frame), the best frame will be sent to LUNA PLATFORM.
            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.

                The measurement type is set in the `type` parameter. If the value is `-1`, then the silent period will last indefinitely.
            type:
              type: string
              enum: [sec, frames]
              default: sec
              description: Measurement type for `time_period_of_searching` and `silent_period` parameters (per frames or per seconds).
            number_of_bestshots_to_send:
              type: integer
              default: 1
              description: Number of best shots that the user sets to receive from the track or certain periods of this track.
            send_only_full_set:
              type: boolean
              default: true
              description: |
                  Send data only if the required number of best shots (`number_of_bestshots_to_send` parameter of `FACE_STREAM_CONFIG` settings) and detections with human body coordinates  `minimal_body_track_length_to_send` parameter of `FACE_STREAM_CONFIG` settings) have been collected.

                  **Only for processing bodies.**
            delete_track_after_sending:
              type: boolean
              default: false
              description: |
                  Whether to delete the best shots and detections with human body coordinates after sending the data.

                  **Only for processing bodies.**
          description: Stream sending parameters.
        primary_track_policy:
          $ref: '#/components/schemas/primary_track_policy'
        liveness:
          $ref: '#/components/schemas/liveness_policy'
        filtering:
          type: object
          properties:
            min_score:
              type: number
              default: 0.5187
              description: |
                Score that defines detection quality. Threshold for filtering detections sent to LUNA PLATFORM.

                Threshold must be different when working with **faces** and when working with **bodies**.

                Recommended value for faces: **0.5187**

                Recommended value for bodies: **0.5**
            detection_yaw_threshold:
              type: number
              minimum: 0
              maximum: 180
              default: 40.0
              description: |
                Maximum value of head yaw angle in relation to camera.

                **Only for processing faces.**
            detection_pitch_threshold:
              type: number
              minimum: 0
              maximum: 180
              default: 40.0
              description: |
                Maximum value of head pitch angle in relation to camera.

                **Only for processing faces.**
            detection_roll_threshold:
              type: number
              minimum: 0
              maximum: 180
              default: 30.0
              description: |
                Maximum value of head roll angle in relation to camera.

                **Only for processing faces.**
            yaw_number:
              type: integer
              default: 1
              description: |
                Number of frames for image filtration based on head yaw angle.

                The algorithm analyzes head yaw angles on each of those frames. If on one of them the angle is significantly different from the average 
                value of angles, the frame will not be considered as a candidate for best shot.

                By default, the parameter is disabled, the value is `1`.

                **Only for processing faces.**
            yaw_collection_mode:
              type: boolean
              default: false
              description: |
                Whether to collect a certain number of frames set in `yaw_number` to analyze head yaw angle.

                If `yaw_collection_mode` is disabled, then the system will analyze incoming frames sequentially, 
                i.e., first two frames are analyzed, then three, etc. The maximum number of frames in this sequence is set in `yaw_number` parameter.

                **Only for processing faces.**
            mouth_occlusion_threshold:
              type: number
              format: float
              default: 0.0
              example: 0.1
              description: | 
                Maximum degree of overlap of the face mouth in the frame. I.e. when the value is equal to "0.5", 50% of the mouth can be occluded.

                **Only for processing faces.**
            min_body_size_threshold:
              type: number
              format: float
              minimum: 0
              default: 0.0
              example: 0.1
              description: |
                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). 
                
                If the value is `0`, then filtering of body detection by size will not be performed.

                **Only for processing bodies.**
          description: Stream filtering parameters.
        frame_processing_mode:
          $ref: '#/components/schemas/frame_processing_mode'
        real_time_mode_fps:
          $ref: '#/components/schemas/real_time_mode_fps'
        ffmpeg_threads_number:
          $ref: '#/components/schemas/ffmpeg_threads_number'
        healthcheck:
          $ref: '#/components/schemas/healthcheck_policy'

      description: Stream processing parameters.

    healthcheck_policy:
      type: object
      properties:
        max_error_count:
          type: integer
          default: 10
          description: |
            Error count limit in period to consider stream to be alive.

            The parameter works in conjunction with the `period` and `retry_delay` parameters. After receiving the first error, the wait specified in the `retry_delay` parameter is performed, and then the connection to the stream is retried. If during the time specified in the `period` parameter, the number of errors greater than or equal to the number specified in `max_error_count` was accumulated, then the processing of the stream will be terminated and its status will change to `failure`.
        period:
          type: integer
          default: 3600
          description: |
            Period (in seconds) during which the number of errors is calculated.

            The parameter works in conjunction with the `retry_delay` and `max_error_count` parameters. See the description of working with this parameter in the `max_error_count` parameter.
        retry_delay:
          type: integer
          default: 5
          description: |
            Period after which the reconnection attempt is performed.

            The parameter works in conjunction with the `period` and `max_error_count` parameters. See the description of working with this parameter in the `max_error_count` parameter.
        timeout:
          type: integer
          minimum: 0
          maximum: 2147483647
          description: |
            Timeout in milliseconds that is set to read the encoded packet.
      description: Stream health check parameters. This section is used for reconnecting to the stream when errors occur while the video is streamed.

    frame_processing_mode:
      type: string
      enum: [ auto, full, scale ]
      default: auto
      description: |
        Whether full or scaled frame will be processed (`auto` - depends on `convert_full_frame` parameter from `FACE_STREAM_CONFIG` settings).

        **Not intended for use with "images" stream type.**

    real_time_mode_fps:
        type: integer
        default: 0
        description: | 
          Number of FPS with which the video file will be processed.
          **Intended for use with "videofile" stream type.**

    ffmpeg_threads_number:
        type: integer
        default: 0
        description: Number of threads for video decoding (`0` - chosen by decoder library).

    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 ]

    stream_analytics_with_defaults:
      allOf:
        - $ref: '#/components/schemas/stream_analytics_v2'
        - properties:
            sending:
              $ref: '#/components/schemas/sending_v2_required'
            filtering:
              required: [ min_score_face, min_score_body, detection_yaw_threshold, detection_pitch_threshold, detection_roll_threshold, yaw_number, yaw_collection_mode, mouth_occlusion_threshold ]
            primary_track_policy:
              required: [ use_primary_track_policy, best_shot_min_size, best_shot_proper_size ]
            liveness:
              required: [ use_mask_liveness_filtration, use_flying_faces_liveness_filtration, liveness_mode, number_of_liveness_checks, liveness_threshold, livenesses_weights, mask_backgrounds_count ]
            healthcheck:
              required: [ max_error_count, period, retry_delay ]
            event_handler:
              required: [type, handler_id, frame_store, authorization]
          required: [mode, enabled, droi, filtering, liveness, primary_track_policy, sending, event_handler, 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 parameters.

    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.
            
            Success or failure stream autorestart determines by last stream status received in *delay* seconds after *last_attempt_time*.
            
            For more information about autorestart see *Streams automatic restart* chapter of development manual.
      description: Stream autorestart parameters.

    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 parameters 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
      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: Stream account ID for authentication in LUNA PLATFORM.
        name:
          allOf:
            - $ref: '#/components/schemas/string128_default'
          description: Stream name.
          default: ""
        description:
          allOf:
            - $ref: '#/components/schemas/string512_default'
          description: 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: Stream processing initial status.
      required: [ account_id, data, event_handler]

    stream_to_be_created_base_v2:
      type: object
      properties:
        account_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
          description: Stream account ID for authentication in LUNA PLATFORM.
        name:
          allOf:
            - $ref: '#/components/schemas/string128_default'
          description: Stream name.
          default: ""
        description:
          allOf:
            - $ref: '#/components/schemas/string512_default'
          description: Stream description.
          default: ""
        data:
          $ref: '#/components/schemas/stream_data_v2'
        location:
          $ref: '#/components/schemas/location_to_be_created'
        autorestart:
          $ref: '#/components/schemas/stream_autorestart'
        status:
          type: string
          enum: [ pending, pause ]
          default: pending
          description: Stream processing initial status.
      required: [ account_id, data]

    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_with_group_name_v2:
      allOf:
        - $ref: '#/components/schemas/stream_to_be_created_base_v2'
        - properties:
            group_name:
              $ref: '#/components/schemas/group_name'

    stream_with_group_id_v2:
      allOf:
        - $ref: '#/components/schemas/stream_to_be_created_base_v2'
        - properties:
            group_id:
              $ref: '#/components/schemas/group_id'

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

    stream_to_be_created_v2:
      anyOf:
        - $ref: '#/components/schemas/stream_with_group_name_v2'
        - $ref: '#/components/schemas/stream_with_group_id_v2'

    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 manual](#operation/getDevManual) 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 (group of frames) 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_v2:
      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_v2_required'
        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, location, autorestart, version, create_time, status, last_error, video_info, groups, preview ]


    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_base'
        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_base:
      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
      required: [streams]

    queue_streams_response_pending_v1:
      allOf:
        - $ref: '#/components/schemas/queue_streams_response_pending_base'
        - type: object
          properties:
            streams:
              type: array
              items:
                allOf:
                  - $ref: '#/components/schemas/stream_response'
                properties:
                  status:
                    allOf:
                      - $ref: '#/components/schemas/stream_status'
                    enum: [ pending ]

    queue_streams_response_pending_v2:
      allOf:
        - $ref: '#/components/schemas/queue_streams_response_pending_base'
        - type: object
          properties:
            streams:
              type: array
              items:
                allOf:
                  - $ref: '#/components/schemas/stream_response_v2'
                properties:
                  status:
                    allOf:
                      - $ref: '#/components/schemas/stream_status'
                    enum: [ pending ]

    queue_streams_response_in_progress_base:
      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:
            properties:
              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]

    queue_streams_response_in_progress:
      allOf:
        - $ref: '#/components/schemas/queue_streams_response_in_progress_base'
      type: object
      properties:
        streams:
          type: array
          items:
            allOf:
            - $ref: '#/components/schemas/stream_response'
            properties:
              data:
                $ref: '#/components/schemas/stream_data'

    queue_streams_response_in_progress_v2:
      allOf:
        - $ref: '#/components/schemas/queue_streams_response_in_progress_base'
      type: object
      properties:
        streams:
          type: array
          items:
            allOf:
            - $ref: '#/components/schemas/stream_response_v2'
            properties:
              data:
                $ref: '#/components/schemas/stream_data_v2'

    post_streams_processing_queue_request_filters:
      type: object
      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.
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/stream_id'
          maxItems: 1000
        names:
          description: Stream name filter.
          nullable: true
          type: array
          items:
            $ref: '#/components/schemas/stream_name'
          maxItems: 1000

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

    group_description:
      type: string
      description: Stream 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 or detach streams to group."
          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]

    plugin_status:
      type: object
      properties:
        name:
          type: string
          description: Plugin name
        running:
          type: integer
          enum: [0, 1]
          description: Whether plugin is running or not.
      required: [name, running]

    plugins:
      type: object
      properties:
        plugins:
          description: list of imported plugins
          type: array
          items:
            $ref: '#/components/schemas/plugin_status'
      required: [plugins]
      example:
        plugins:
          - name: foo
            running: 1
  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

    forbidden_resource_error:
      description: Forbidden.
      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:
            resource_is_disabled:
              value:
                error_code: 12049
                desc: Forbidden
                detail: Resource is disabled.
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12049"
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 stream.
      operationId: createStream
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
      x-codeSamples:
        - lang: bash
          source: |
            curl --location --request POST 'http://127.0.0.1:5160/1/streams' \
            --header 'Luna-Request-Id: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a' \
            --header 'Content-Type: application/json' \
            --data '{
                    "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
                    "name": "Stream 1",
                    "description": "Stream with tcp stream type",
                    "data": {
                      "type": "tcp",
                      "reference": "rtsp://some_stream_address",
                      "roi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs",
                      },
                      "droi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs",
                      },
                      "rotation": 0,
                      "preferred_program_stream_frame_width": 800,
                      "endless": true
                    },
                    "event_handler": {
                      "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"
                      }
                    },
                    "policies": {
                      "sending": {
                        "time_period_of_searching": -1,
                        "silent_period": 0,
                        "type": "sec",
                        "number_of_bestshots_to_send": 1,
                        "send_only_full_set": true,
                        "delete_track_after_sending": false
                      },
                      "primary_track_policy": {
                        "use_primary_track_policy": false,
                        "best_shot_min_size": 70,
                        "best_shot_proper_size": 140
                      },
                      "liveness": {
                        "use_shoulders_liveness_filtration": false,
                        "use_mask_liveness_filtration": false,
                        "use_flying_faces_liveness_filtration": false,
                        "liveness_mode": 0,
                        "number_of_liveness_checks": 10,
                        "liveness_threshold": 0.6,
                        "livenesses_weights": [
                          0.05,
                          0.45,
                          0.5
                        ],
                        "mask_backgrounds_count": 300
                      },
                      "filtering": {
                        "min_score": 0.5187,
                        "detection_yaw_threshold": 40,
                        "detection_pitch_threshold": 40,
                        "detection_roll_threshold": 30,
                        "yaw_number": 1,
                        "yaw_collection_mode": false,
                        "mouth_occlusion_threshold": 0.1,
                        "min_body_size_threshold": 0.1
                      },
                      "frame_processing_mode": "auto",
                      "real_time_mode_fps": 0,
                      "ffmpeg_threads_number": 0,
                      "healthcheck": {
                        "max_error_count": 10,
                        "period": 3600,
                        "retry_delay": 5,
                        "timeout": 123
                      }
                    },
                    "location": {
                      "city": "Moscow",
                      "area": "Central",
                      "district": "Basmanny",
                      "street": "Podsosensky lane",
                      "house_number": "23 bldg.3",
                      "geo_position": {
                        "longitude": 36.616,
                        "latitude": 55.752
                      }
                    },
                    "autorestart": {
                      "restart": 0,
                      "attempt_count": 10,
                      "delay": 60
                    },
                    "status": "pending",
                    "group_name": "hd_stream_2"
                  }'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/stream_to_be_created'
            examples:
              type_tcp_udp:
                summary: stream type is tcp or udp
                value:
                  {
                    "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
                    "name": "Stream 1",
                    "description": "Stream with tcp stream type",
                    "data": {
                      "type": "tcp",
                      "reference": "rtsp://some_stream_address",
                      "roi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs",
                      },
                      "droi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs",
                      },
                      "rotation": 0,
                      "preferred_program_stream_frame_width": 800,
                      "endless": true
                    },
                    "event_handler": {
                      "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"
                      }
                    },
                    "policies": {
                      "sending": {
                        "time_period_of_searching": -1,
                        "silent_period": 0,
                        "type": "sec",
                        "number_of_bestshots_to_send": 1,
                        "send_only_full_set": true,
                        "delete_track_after_sending": false
                      },
                      "primary_track_policy": {
                        "use_primary_track_policy": false,
                        "best_shot_min_size": 70,
                        "best_shot_proper_size": 140
                      },
                      "liveness": {
                        "use_shoulders_liveness_filtration": false,
                        "use_mask_liveness_filtration": false,
                        "use_flying_faces_liveness_filtration": false,
                        "liveness_mode": 0,
                        "number_of_liveness_checks": 10,
                        "liveness_threshold": 0.6,
                        "livenesses_weights": [
                          0.05,
                          0.45,
                          0.5
                        ],
                        "mask_backgrounds_count": 300
                      },
                      "filtering": {
                        "min_score": 0.5187,
                        "detection_yaw_threshold": 40,
                        "detection_pitch_threshold": 40,
                        "detection_roll_threshold": 30,
                        "yaw_number": 1,
                        "yaw_collection_mode": false,
                        "mouth_occlusion_threshold": 0.1,
                        "min_body_size_threshold": 0.1
                      },
                      "frame_processing_mode": "auto",
                      "real_time_mode_fps": 0,
                      "ffmpeg_threads_number": 0,
                      "healthcheck": {
                        "max_error_count": 10,
                        "period": 3600,
                        "retry_delay": 5,
                        "timeout": 123
                      }
                    },
                    "location": {
                      "city": "Moscow",
                      "area": "Central",
                      "district": "Basmanny",
                      "street": "Podsosensky lane",
                      "house_number": "23 bldg.3",
                      "geo_position": {
                        "longitude": 36.616,
                        "latitude": 55.752
                      }
                    },
                    "autorestart": {
                      "restart": 0,
                      "attempt_count": 10,
                      "delay": 60
                    },
                    "status": "pending",
                    "group_name": "hd_stream_2"
                  }
              type_tcp_udp_usb:
                summary: stream type is tcp or udp with usb device
                value:
                  {
                    "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
                    "name": "Stream 1",
                    "description": "Stream with tcp stream type with usb device",
                    "data": {
                      "type": "tcp",
                      "reference": "/dev/video0",
                      "roi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs",
                      },
                      "droi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs",
                      },
                      "rotation": 0,
                      "preferred_program_stream_frame_width": 800,
                      "endless": true
                    },
                    "event_handler": {
                      "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"
                      }
                    },
                    "policies": {
                      "sending": {
                        "time_period_of_searching": -1,
                        "silent_period": 0,
                        "type": "sec",
                        "number_of_bestshots_to_send": 1,
                        "send_only_full_set": true,
                        "delete_track_after_sending": false
                      },
                      "primary_track_policy": {
                        "use_primary_track_policy": false,
                        "best_shot_min_size": 70,
                        "best_shot_proper_size": 140
                      },
                      "liveness": {
                        "use_shoulders_liveness_filtration": false,
                        "use_mask_liveness_filtration": false,
                        "use_flying_faces_liveness_filtration": false,
                        "liveness_mode": 0,
                        "number_of_liveness_checks": 10,
                        "liveness_threshold": 0.6,
                        "livenesses_weights": [
                          0.05,
                          0.45,
                          0.5
                        ],
                        "mask_backgrounds_count": 300
                      },
                      "filtering": {
                        "min_score": 0.5187,
                        "detection_yaw_threshold": 40,
                        "detection_pitch_threshold": 40,
                        "detection_roll_threshold": 30,
                        "yaw_number": 1,
                        "yaw_collection_mode": false,
                        "mouth_occlusion_threshold": 0.1,
                        "min_body_size_threshold": 0.1
                      },
                      "frame_processing_mode": "auto",
                      "real_time_mode_fps": 0,
                      "ffmpeg_threads_number": 0,
                      "healthcheck": {
                        "max_error_count": 10,
                        "period": 3600,
                        "retry_delay": 5,
                        "timeout": 123
                      }
                    },
                    "location": {
                      "city": "Moscow",
                      "area": "Central",
                      "district": "Basmanny",
                      "street": "Podsosensky lane",
                      "house_number": "23 bldg.3",
                      "geo_position": {
                        "longitude": 36.616,
                        "latitude": 55.752
                      }
                    },
                    "autorestart": {
                      "restart": 0,
                      "attempt_count": 10,
                      "delay": 60
                    },
                    "status": "pending",
                    "group_name": "hd_stream_2"
                  }
              type_videofile:
                summary: stream type is videofile
                value:
                  {
                    "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
                    "name": "Stream 1",
                    "description": "Stream with videofile stream type",
                    "data": {
                      "type": "videofile",
                      "reference": "/example/path/to/video/video.mp4",
                      "roi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs",
                      },
                      "droi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs",
                      },
                      "rotation": 0,
                      "preferred_program_stream_frame_width": 800
                    },
                    "event_handler": {
                      "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"
                      }
                    },
                    "policies": {
                      "sending": {
                        "time_period_of_searching": -1,
                        "silent_period": 0,
                        "type": "sec",
                        "number_of_bestshots_to_send": 1,
                        "send_only_full_set": true,
                        "delete_track_after_sending": false
                      },
                      "primary_track_policy": {
                        "use_primary_track_policy": false,
                        "best_shot_min_size": 70,
                        "best_shot_proper_size": 140
                      },
                      "liveness": {
                        "use_shoulders_liveness_filtration": false,
                        "use_mask_liveness_filtration": false,
                        "use_flying_faces_liveness_filtration": false,
                        "liveness_mode": 0,
                        "number_of_liveness_checks": 10,
                        "liveness_threshold": 0.6,
                        "livenesses_weights": [
                          0.05,
                          0.45,
                          0.5
                        ],
                        "mask_backgrounds_count": 300
                      },
                      "filtering": {
                        "min_score": 0.5187,
                        "detection_yaw_threshold": 40,
                        "detection_pitch_threshold": 40,
                        "detection_roll_threshold": 30,
                        "yaw_number": 1,
                        "yaw_collection_mode": false,
                        "mouth_occlusion_threshold": 0.1,
                        "min_body_size_threshold": 0.1
                      },
                      "frame_processing_mode": "auto",
                      "real_time_mode_fps": 0,
                      "ffmpeg_threads_number": 0,
                      "healthcheck": {
                        "max_error_count": 10,
                        "period": 3600,
                        "retry_delay": 5,
                        "timeout": 123
                      }
                    },
                    "location": {
                      "city": "Moscow",
                      "area": "Central",
                      "district": "Basmanny",
                      "street": "Podsosensky lane",
                      "house_number": "23 bldg.3",
                      "geo_position": {
                        "longitude": 36.616,
                        "latitude": 55.752
                      }
                    },
                    "autorestart": {
                      "restart": 0,
                      "attempt_count": 10,
                      "delay": 60
                    },
                    "status": "pending",
                    "group_name": "hd_stream_2"
                  }
              type_images:
                summary: stream type is images
                value:
                  {
                    "account_id": "557d54ec-29ad-4f3c-93b4-c9092ef12515",
                    "name": "Stream 1",
                    "description": "Stream with images stream type",
                    "data": {
                      "type": "images",
                      "reference": "/example/path/to/images/",
                      "roi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs",
                      },
                      "droi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs",
                      },
                      "rotation": 0,
                      "preferred_program_stream_frame_width": 800,
                      "mask": "example1_%04d.jpg"
                    },
                    "event_handler": {
                      "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"
                      }
                    },
                    "policies": {
                      "sending": {
                        "time_period_of_searching": -1,
                        "silent_period": 0,
                        "type": "sec",
                        "number_of_bestshots_to_send": 1,
                        "send_only_full_set": true,
                        "delete_track_after_sending": false
                      },
                      "primary_track_policy": {
                        "use_primary_track_policy": false,
                        "best_shot_min_size": 70,
                        "best_shot_proper_size": 140
                      },
                      "liveness": {
                        "use_shoulders_liveness_filtration": false,
                        "use_mask_liveness_filtration": false,
                        "use_flying_faces_liveness_filtration": false,
                        "liveness_mode": 0,
                        "number_of_liveness_checks": 10,
                        "liveness_threshold": 0.6,
                        "livenesses_weights": [
                          0.05,
                          0.45,
                          0.5
                        ],
                        "mask_backgrounds_count": 300
                      },
                      "filtering": {
                        "min_score": 0.5187,
                        "detection_yaw_threshold": 40,
                        "detection_pitch_threshold": 40,
                        "detection_roll_threshold": 30,
                        "yaw_number": 1,
                        "yaw_collection_mode": false,
                        "mouth_occlusion_threshold": 0.1,
                        "min_body_size_threshold": 0.1
                      },
                      "frame_processing_mode": "auto",
                      "real_time_mode_fps": 0,
                      "ffmpeg_threads_number": 0,
                      "healthcheck": {
                        "max_error_count": 10,
                        "period": 3600,
                        "retry_delay": 5,
                        "timeout": 123
                      }
                    },
                    "location": {
                      "city": "Moscow",
                      "area": "Central",
                      "district": "Basmanny",
                      "street": "Podsosensky lane",
                      "house_number": "23 bldg.3",
                      "geo_position": {
                        "longitude": 36.616,
                        "latitude": 55.752
                      }
                    },
                    "autorestart": {
                      "restart": 0,
                      "attempt_count": 10,
                      "delay": 60
                    },
                    "status": "pending",
                    "group_name": "hd_stream_2"
                  }
        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_id__gte'
        - $ref: '#/components/parameters/stream_id__lt'
        - $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/order'
        - $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: Streams 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"](#operation/createStream) request 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'
        - $ref: '#/components/parameters/applicationJsonContent'
      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
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
      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_v1'
        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
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
      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
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
      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"](#operation/postStreamsFeedback) request to create last frame preview.
      operationId: previewFrameProxy
      parameters:
        - $ref: '#/components/parameters/account_id'
      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"](#operation/postStreamsFeedback) request to create live preview.
      operationId: previewLiveProxy
      parameters:
        - $ref: '#/components/parameters/account_id'
      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.
        
        Also you can run streams logs auto deletion by using `LUNA_STREAMS_LOGS_CLEAR_INTERVAL` setting.
        For more information see development documentation.
      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 group.
      operationId: createGroup
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
      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"](#operation/createGroup) request).

    get:
      tags:
        - groups
      summary: get group
      description: Get the group by name.
      operationId: getGroup
      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/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*
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/account_id'
      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
      parameters:
        - $ref: '#/components/parameters/account_id'
      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'
        - $ref: '#/components/parameters/applicationJsonContent'
      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'
  /1/plugins:
    get:
      tags:
        - plugins
      summary: get list of plugins
      description: |
        Get list of service plugins
      operationId: getPlugins
      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/plugins'
        500:
          $ref: '#/components/responses/internal_server_error'
  /2/streams:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'

    post:
      tags:
        - streams V2
      summary: create stream
      description: Create stream .
      operationId: createStreamV2
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
      x-codeSamples:
        - lang: bash
          source: |
            curl --location --request POST 'http://127.0.0.1:5160/1/streams' \
            --header 'Luna-Request-Id: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a' \
            --header 'Content-Type: application/json' \
            --data '{
            "account_id": "d00e78dd-b91e-4686-866c-d69a493e5b5f",
            "data": {
                "analytics": [{
                    "mode": 1,
                    "enabled": true,
                    "droi": [
                        0,
                        0,
                        0,
                        0
                    ],
                    "filtering": {
                        "detection_pitch_threshold": 40,
                        "detection_roll_threshold": 30,
                        "detection_yaw_threshold": 40,
                        "min_body_size_threshold": 250,
                        "min_score_face": 0.5187,
                        "min_score_body": 0.5,
                        "mouth_occlusion_threshold": 0,
                        "yaw_collection_mode": false,
                        "yaw_number": 1
                    },
                    "liveness": {
                        "liveness_mode": 1,
                        "liveness_threshold": 0.6,
                        "livenesses_weights": [
                            0.45,
                            0.5
                        ],
                        "mask_backgrounds_count": 300,
                        "number_of_liveness_checks": 10,
                        "use_flying_faces_liveness_filtration": true,
                        "use_mask_liveness_filtration": true,
                    },
                    "primary_track_policy": {
                        "best_shot_min_size": 70,
                        "best_shot_proper_size": 140,
                        "use_primary_track_policy": false
                    },
                    "sending": {
                        "body": {
                            "send_only_full_set": true,
                            "delete_track_after_sending": true
                        },
                        "silent_period": 0,
                        "time_period_of_searching": -1,
                        "type": "sec",
                        "bestshot_settings": {
                            "type": 1,
                            "face_bestshots_to_send": 1,
                            "body_bestshots_to_send": 1
                        },
                        "full_frame_settings": 1
                    },
                    "event_handler": {
                        "type": "luna_handler",
                        "handler_id": "0b61258c-434f-45d6-964f-2131e58cd58c",
                        "frame_store": "http://127.0.0.1:5000/6/images",
                        "authorization": {
                            "token": "eyJ0eXAiOiJKV1QiLC"
                        }
                    }
                }],
                "frame_processing_mode": "auto",
                "real_time_mode_fps": 0,
                "ffmpeg_threads_number": 0,
                "roi": [
                    0,
                    0,
                    0,
                    0
                ],
                "rotation": 0,
                "reference": "rtsp://dev02.vlabs:5554/video",
                "type": "tcp"
            },
            "description": "http video test stream",
            "location": {
                "city": "Moscow",
                "area": "Central",
                "district": "Basmanny",
                "street": "Podsosensky lane",
                "house_number": "23 bldg.3",
                "geo_position": {
                    "longitude": 36.616,
                    "latitude": 55.752
                }
            },
            "name": "http video test stream",
            "status": "pending"
            }'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/stream_to_be_created_v2'
            examples:
              type_tcp_udp:
                summary: stream type is tcp or udp
                value:
                  {
                    "account_id": "d00e78dd-b91e-4686-866c-d69a493e5b5f",
                    "data": {
                      "analytics": [ {
                        "mode": 3,
                        "enabled": true,
                        "droi": {
                          "x": 0,
                          "y": 0,
                          "width": 0,
                          "height": 0,
                          "mode": "abs"
                        },
                        "filtering": {
                          "detection_pitch_threshold": 40,
                          "detection_roll_threshold": 30,
                          "detection_yaw_threshold": 40,
                          "min_body_size_threshold": 250,
                          "min_score_face": 0.5187,
                          "min_score_body": 0.5,
                          "mouth_occlusion_threshold": 0,
                          "yaw_collection_mode": false,
                          "yaw_number": 1
                        },
                        "liveness": {
                          "liveness_mode": 1,
                          "liveness_threshold": 0.6,
                          "livenesses_weights": [
                            0.45,
                            0.5
                          ],
                          "mask_backgrounds_count": 300,
                          "number_of_liveness_checks": 10,
                          "use_flying_faces_liveness_filtration": true,
                          "use_mask_liveness_filtration": true,
                        },
                        "primary_track_policy": {
                          "best_shot_min_size": 70,
                          "best_shot_proper_size": 140,
                          "use_primary_track_policy": false
                        },
                        "sending": {
                          "body": {
                            "send_only_full_set": true,
                            "delete_track_after_sending": true
                          },
                          "silent_period": 0,
                          "time_period_of_searching": -1,
                          "full_frame_settings": 1,
                          "type": "sec",
                          "bestshot_settings": {
                            "face_bestshots_to_send": 1,
                            "body_bestshots_to_send": 1
                          }
                        },
                        "event_handler": {
                          "type": "luna_handler",
                          "handler_id": "0b61258c-434f-45d6-964f-2131e58cd58c",
                          "frame_store": "http://127.0.0.1:5020/1/buckets/frames/images",
                          "authorization": {
                            "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k"
                          }
                        }
                      } ],
                      "frame_processing_mode": "auto",
                      "real_time_mode_fps": 0,
                      "ffmpeg_threads_number": 0,
                      "roi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs"
                      },
                      "rotation": 0,
                      "reference": "rtsp://some_stream_address",
                      "type": "tcp"
                    },
                    "description": "http video test stream",
                    "location": {
                      "city": "Moscow",
                      "area": "Central",
                      "district": "Basmanny",
                      "street": "Podsosensky lane",
                      "house_number": "23 bldg.3",
                      "geo_position": {
                        "longitude": 36.616,
                        "latitude": 55.752
                      }
                    },
                    "name": "http video test stream",
                    "group_name": "hd_stream_2",
                    "status": "pending"
                  }
              type_tcp_udp_usb:
                summary: stream type is tcp or udp with usb device
                value:
                  {
                    "account_id": "d00e78dd-b91e-4686-866c-d69a493e5b5f",
                    "data": {
                      "analytics": [ {
                        "mode": 3,
                        "enabled": true,
                        "droi": {
                          "x": 0,
                          "y": 0,
                          "width": 0,
                          "height": 0,
                          "mode": "abs"
                        },
                        "filtering": {
                          "detection_pitch_threshold": 40,
                          "detection_roll_threshold": 30,
                          "detection_yaw_threshold": 40,
                          "min_body_size_threshold": 250,
                          "min_score_face": 0.5187,
                          "min_score_body": 0.5,
                          "mouth_occlusion_threshold": 0,
                          "yaw_collection_mode": false,
                          "yaw_number": 1
                        },
                        "liveness": {
                          "liveness_mode": 1,
                          "liveness_threshold": 0.6,
                          "livenesses_weights": [
                            0.45,
                            0.5
                          ],
                          "mask_backgrounds_count": 300,
                          "number_of_liveness_checks": 10,
                          "use_flying_faces_liveness_filtration": true,
                          "use_mask_liveness_filtration": true,
                        },
                        "primary_track_policy": {
                          "best_shot_min_size": 70,
                          "best_shot_proper_size": 140,
                          "use_primary_track_policy": false
                        },
                        "sending": {
                          "body": {
                            "send_only_full_set": true,
                            "delete_track_after_sending": true
                          },
                          "silent_period": 0,
                          "time_period_of_searching": -1,
                          "full_frame_settings": 1,
                          "type": "sec",
                          "bestshot_settings": {
                            "face_bestshots_to_send": 1,
                            "body_bestshots_to_send": 1
                          }
                        },
                        "event_handler": {
                          "type": "luna_handler",
                          "handler_id": "0b61258c-434f-45d6-964f-2131e58cd58c",
                          "frame_store": "http://127.0.0.1:5020/1/buckets/frames/images",
                          "authorization": {
                            "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k"
                          }
                        }
                      } ],
                      "frame_processing_mode": "auto",
                      "real_time_mode_fps": 0,
                      "ffmpeg_threads_number": 0,
                      "roi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs"
                      },
                      "rotation": 0,
                      "reference": "/dev/video0",
                      "type": "tcp"
                    },
                    "description": "http video test stream",
                    "location": {
                      "city": "Moscow",
                      "area": "Central",
                      "district": "Basmanny",
                      "street": "Podsosensky lane",
                      "house_number": "23 bldg.3",
                      "geo_position": {
                        "longitude": 36.616,
                        "latitude": 55.752
                      }
                    },
                    "name": "http video test stream",
                    "group_name": "hd_stream_2",
                    "status": "pending"
                  }
              type_videofile:
                summary: stream type is videofile
                value:
                  {
                    "account_id": "d00e78dd-b91e-4686-866c-d69a493e5b5f",
                    "data": {
                      "analytics": [ {
                        "mode": 3,
                        "enabled": true,
                        "droi": {
                          "x": 0,
                          "y": 0,
                          "width": 0,
                          "height": 0,
                          "mode": "abs"
                        },
                        "filtering": {
                          "detection_pitch_threshold": 40,
                          "detection_roll_threshold": 30,
                          "detection_yaw_threshold": 40,
                          "min_body_size_threshold": 250,
                          "min_score_face": 0.5187,
                          "min_score_body": 0.5,
                          "mouth_occlusion_threshold": 0,
                          "yaw_collection_mode": false,
                          "yaw_number": 1
                        },
                        "liveness": {
                          "liveness_mode": 1,
                          "liveness_threshold": 0.6,
                          "livenesses_weights": [
                            0.45,
                            0.5
                          ],
                          "mask_backgrounds_count": 300,
                          "number_of_liveness_checks": 10,
                          "use_flying_faces_liveness_filtration": true,
                          "use_mask_liveness_filtration": true,
                        },
                        "primary_track_policy": {
                          "best_shot_min_size": 70,
                          "best_shot_proper_size": 140,
                          "use_primary_track_policy": false
                        },
                        "sending": {
                          "body": {
                            "send_only_full_set": true,
                            "delete_track_after_sending": true
                          },
                          "silent_period": 0,
                          "time_period_of_searching": -1,
                          "full_frame_settings": 1,
                          "type": "sec",
                          "bestshot_settings": {
                            "face_bestshots_to_send": 1,
                            "body_bestshots_to_send": 1
                          }
                        },
                        "event_handler": {
                          "type": "luna_handler",
                          "handler_id": "0b61258c-434f-45d6-964f-2131e58cd58c",
                          "frame_store": "http://127.0.0.1:5020/1/buckets/frames/images",
                          "authorization": {
                            "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k"
                          }
                        }
                      } ],
                      "frame_processing_mode": "auto",
                      "real_time_mode_fps": 0,
                      "ffmpeg_threads_number": 0,
                      "roi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs"
                      },
                      "rotation": 0,
                      "reference": "/example/path/to/video/video.mp4",
                      "type": "videofile"
                    },
                    "description": "http video test stream",
                    "location": {
                      "city": "Moscow",
                      "area": "Central",
                      "district": "Basmanny",
                      "street": "Podsosensky lane",
                      "house_number": "23 bldg.3",
                      "geo_position": {
                        "longitude": 36.616,
                        "latitude": 55.752
                      }
                    },
                    "name": "http video test stream",
                    "group_name": "hd_stream_2",
                    "status": "pending"
                  }
              type_images:
                summary: stream type is images
                value:
                  {
                    "account_id": "d00e78dd-b91e-4686-866c-d69a493e5b5f",
                    "data": {
                      "analytics": [ {
                        "mode": 3,
                        "enabled": true,
                        "droi": {
                          "x": 0,
                          "y": 0,
                          "width": 0,
                          "height": 0,
                          "mode": "abs"
                        },
                        "filtering": {
                          "detection_pitch_threshold": 40,
                          "detection_roll_threshold": 30,
                          "detection_yaw_threshold": 40,
                          "min_body_size_threshold": 250,
                          "min_score_face": 0.5187,
                          "min_score_body": 0.5,
                          "mouth_occlusion_threshold": 0,
                          "yaw_collection_mode": false,
                          "yaw_number": 1
                        },
                        "liveness": {
                          "liveness_mode": 1,
                          "liveness_threshold": 0.6,
                          "livenesses_weights": [
                            0.45,
                            0.5
                          ],
                          "mask_backgrounds_count": 300,
                          "number_of_liveness_checks": 10,
                          "use_flying_faces_liveness_filtration": true,
                          "use_mask_liveness_filtration": true,
                        },
                        "primary_track_policy": {
                          "best_shot_min_size": 70,
                          "best_shot_proper_size": 140,
                          "use_primary_track_policy": false
                        },
                        "sending": {
                          "body": {
                            "send_only_full_set": true,
                            "delete_track_after_sending": true
                          },
                          "silent_period": 0,
                          "time_period_of_searching": -1,
                          "full_frame_settings": 1,
                          "type": "sec",
                          "bestshot_settings": {
                            "face_bestshots_to_send": 1,
                            "body_bestshots_to_send": 1
                          }
                        },
                        "event_handler": {
                          "type": "luna_handler",
                          "handler_id": "0b61258c-434f-45d6-964f-2131e58cd58c",
                          "frame_store": "http://127.0.0.1:5020/1/buckets/frames/images",
                          "authorization": {
                            "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbklkIjoiN2Q0MjYwNmEtZmM3NS00NDU4LWE3OGUtOWYzNGM2MjIyZWQyIiwiZXhwaXJhdGlvblRpbWUiOm51bGwsImFjY291bnRJZCI6IjdkYjUzNThiLWZjMzMtNDIwZC1hYTgzLTk5YTRkOWY0MGM0MSJ9.kDL5oLTJaxKyYbwmKV1lejxrzsFoFzx5VOzvTR-i90k"
                          }
                        }
                      } ],
                      "frame_processing_mode": "auto",
                      "real_time_mode_fps": 0,
                      "ffmpeg_threads_number": 0,
                      "roi": {
                        "x": 0,
                        "y": 0,
                        "width": 0,
                        "height": 0,
                        "mode": "abs"
                      },
                      "rotation": 0,
                      "reference": "/example/path/to/images/",
                      "type": "images",
                      "mask": "example1_%04d.jpg"
                    },
                    "description": "http video test stream",
                    "location": {
                      "city": "Moscow",
                      "area": "Central",
                      "district": "Basmanny",
                      "street": "Podsosensky lane",
                      "house_number": "23 bldg.3",
                      "geo_position": {
                        "longitude": 36.616,
                        "latitude": 55.752
                      }
                    },
                    "name": "http video test stream",
                    "group_name": "hd_stream_2",
                    "status": "pending"
                  }
        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 V2
      summary: get streams
      description: Get streams according to filters. The results are sorted by stream creation order, the oldest streams shown first.
      operationId: getStreamsV2
      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_v2'
                    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 V2
      summary: delete streams
      description: Delete streams matching specified filters (OR).
      operationId: deleteStreamsV2
      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'
  /2/streams/count:
    get:
      tags:
        - streams V2
      summary: count streams
      description: |
        Count streams according to the filters.

      operationId: countStreamsV2
      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: Streams 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'

  /2/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"](#operation/createStream) request request).

    put:
      tags:
        - streams V2
      summary: put stream
      description: Update existing stream. You should specify all the fields required for the stream in the request.
      operationId: putStreamV2
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/stream_to_be_created_v2'
        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'

    get:
      tags:
      - streams V2
      summary: get stream
      description: Get the stream by ID.
      operationId: getStreamV2
      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_v2'
        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 V2
      summary: update stream
      description: |
        Update stream fields: *description*, *status*.
      operationId: patchStreamV2
      parameters:
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/applicationJsonContent'
      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'

    delete:
      tags:
        - streams V2
      summary: remove stream
      description: Remove the stream by ID.
      operationId: removeStreamV2
      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'
  /2/streams/processing/queue:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
    get:
      tags:
      - queue V2
      summary: check the streams processing queue
      description: See the streams in the queue.
      operationId: getStreamsQueueV2
      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_v2'
        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 V2
      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: getStreamsFromQueueV2
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
      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_v2'
        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'
  /2/streams/processing/feedback:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
    post:
      tags:
      - queue V2
      summary: post feedback on streams
      description: |

        Post information about streams processing. 

      operationId: postStreamsFeedbackV2
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
      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'
  /2/streams/{stream_id}/preview/handler/frame:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/stream_id_path'
    get:
      tags:
      - preview V2
      summary: get last frame preview
      description: |
        
        Get stream last frame preview.
        
        To add preview for stream, use ["post feedback on streams"](#operation/postStreamsFeedback) request to create last frame preview.
      operationId: previewFrameProxyV2
      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
  /2/streams/{stream_id}/preview/handler/live:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/stream_id_path'
    get:
      tags:
      - preview V2
      summary: get live preview
      description: |
        
        Get stream live preview.
        
        To add preview for stream, use ["post feedback on streams"](#operation/postStreamsFeedback) request to create live preview.
      operationId: previewLiveProxyV2
      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
  /2/streams/logs:
    get:
      tags:
        - streams logs V2
      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: getStreamsLogsV2
      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 V2
      summary: delete stream logs
      description: Delete streams logs older than specified date excluding last log entry.
      operationId: deleteStreamsLogsV2
      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'
  /2/groups:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'

    post:
      tags:
        - groups V2
      summary: create group
      description: Create group.
      operationId: createGroupV2
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
      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 V2
      summary: get groups
      description: Get groups according to filters. The results are sorted by group creation order, the oldest group shown first.
      operationId: getGroupsV2
      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'
  /2/groups/count:
    get:
      tags:
        - groups V2
      summary: get group count
      description: |
        Count of groups according to the filters.
      operationId: countGroupsV2
      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'
  /2/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"](#operation/createGroup) request).

    get:
      tags:
        - groups V2
      summary: get group
      description: Get the group by name.
      operationId: getGroupV2
      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 V2
      summary: update group
      description: |
        Update group fields: *description*
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
      operationId: patchGroupV2
      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 V2
      summary: remove group
      description: Remove the group by name.
      operationId: deleteGroupV2
      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'
  /2/linker:
    patch:
      tags:
        - linker V2
      summary: attach (or detach) streams to a group
      description: Attach (or detach) streams to a group.
      operationId: linkerV2
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/applicationJsonContent'
      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'
  /2/docs/spec:
    get:
      tags:
        - documents V2
      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: getSpecV2

      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'
  /2/docs/dev:
    parameters:
      - $ref: '#/components/parameters/Accept'
    get:
      tags:
        - documents V2
      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: getDevManualV2

      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'
  /2/config:
    get:
      tags:
        - config V2
      summary: get service configuration
      description: Get service configuration. Passwords and tokens will be hidden in the response.
      operationId: getConfigV2

      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'
  /2/plugins:
    get:
      tags:
        - plugins V2
      summary: get list of plugins
      description: |
        Get list of service plugins
      operationId: getPluginsV2
      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/plugins'
        500:
          $ref: '#/components/responses/internal_server_error'
  /metrics:

    get:
      tags:
        - metrics
      summary: get service requests statistics
      description: Get statistics of success and failed requests to the service in prometheus format.
      operationId: metrics
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              schema:
                type: string
                enum:
                  - text/plain; charset=UTF-8
              required: true
              description: Content type is `text/plain`.
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/plain:
              schema:
                type: string
                description: Prometheus plain text format.
              example: |
                # HELP request_count_total Counter of requests
                # TYPE request_count_total counter
                request_count_total{path="GET:/healthcheck",status_code="200"} 1.0
        403:
          $ref: '#/components/responses/forbidden_resource_error'
        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'