openapi: 3.0.0
info:
  version: 'v.0.3.4'
  title: 'luna-video-manager API'
  description: |
     'VisionLabs luna-video-manager'

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

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

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

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

    json_or_msgpack:
      schema:
        type: string
        enum:
        - application/json
        - application/msgpack
      required: true
      description: The content type of the response body.

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

    sources:
      in: query
      name: sources
      schema:
        type: string
      description: Comma-separated list of sources. Each stream from result will contain one of the given sources.
      example: "cam1,cam2"

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

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

    accept_html:
      in: header
      name: Accept
      schema:
        type: string
        enum:
          - text/html
          - application/x-yaml
      description: Preferred response content type

    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

    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.

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

    luna_account_id_header_required:
      in: header
      schema:
        $ref: '#/components/schemas/account_id'
      description: Account ID.
      name: Luna-Account-Id
      required: true

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

    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'

    analytic_ids:
      in: query
      name: analytic_ids
      schema:
        type: array
        items:
          $ref: '#/components/schemas/analytic_id'
      explode: false
      description: Analytics ID filter. Only analytics with the specified ids will be returned in the response.
      example: 'ae09126e-80a9-49c7-923f-df2320f08639,68b363eb-600a-4e72-afb3-8c4196e385ce'

    agent_id:
      in: path
      name: agent_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: ID of the agent (`agent_id` received in the ["register agent"](#operation/registerAgent) request).

    agent_id_query:
      in: query
      name: agent_id
      schema:
        $ref: '#/components/schemas/uuid'
      description: Agent ID filter. Only streams associated with the specified id will be returned in the response.

    agent_ids:
      in: query
      name: agent_ids
      schema:
        type: array
        items:
          $ref: '#/components/schemas/agent_id'
      explode: false
      description: Agent ID filter. Only agents with the specified ids will be returned in the response.
      example: 'ae09126e-80a9-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'

    agent_names:
      in: query
      name: names
      schema:
        type: array
        items:
          $ref: '#/components/schemas/agent_name'
      explode: false
      description: Agent name filter. Only agents with the specified names will be returned in the response.
      example: 'name1,name2'

    analytic_names:
      in: query
      name: names
      schema:
        type: array
        items:
          $ref: '#/components/schemas/analytic_name'
      explode: false
      description: Analytic 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: '1,2'

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

    create_time__gte:
      in: query
      name: create_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: Entity create time lower including bound filter in RFC 3339 format. Only entities 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"

    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'

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

    analytic_id__lt:
      in: query
      name: analytic_id__lt
      schema:
        $ref: '#/components/schemas/analytic_id'
      description: Analytic id upper excluded bound.
      example: 'ae09126e-70a6-49c7-923f-df2320f08639'

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

    agent_id__lt:
      in: query
      name: agent_id__lt
      schema:
        $ref: '#/components/schemas/agent_id'
      description: Agent id upper excluded bound.
      example: 'ae09126e-70a6-49c7-923f-df2320f08639'

    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_names:
      in: query
      name: group_names
      schema:
        type: array
        items:
          $ref: '#/components/schemas/group_name'
      description: Group names.
      example: "group1,group2"

    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'

    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__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_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_targets:
      in: query
      name: targets
      schema:
        type: array
        items:
          type: string
          enum: [ stream_id, status, error, log_time ]
          description: Stream log target.
        example: [ status ]
        default: [ stream_id, status, error, log_time ]
      description: List of comma-separated stream logs targets.

    order:
      in: query
      name: order
      schema:
        type: string
        enum: ["asc", "desc"]
        default: "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 (`<entity>_id__gte` or `<entity>_id__lt`), the results will be sorted by ID.

    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.

    patch_stream_action:
      in: query
      name: action
      schema:
        type: string
        enum: [stop, resume]
      required: true
      description: |
        stop - stop stream processing, stream status will be switched to `stop`
        resume - resume stream processing, stream status will be switched to `pending`

    path_stream_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).

    restream_quality:
      in: query
      name: quality
      schema:
        $ref: '#/components/schemas/restream_quality'
      description: Restream quality filter.
      example: 720
      required: false
  schemas:
    error:
      type: object
      properties:
        error_code:
          type: integer
          description: error code.
        desc:
          type: string
          description: short error description.
        detail:
          type: string
          description: error details.
        link:
          type: string
          description: link to the documentation website with the error description.
      required: [error_code, detail, desc, link]
      example:
        error_code: 1
        detail: internal server error
        desc: internal server error
        link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-1"

    int_version:
      type: integer
      minimum: 0

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

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

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

    health_ok:
      description: successful healthcheck execution info
      type: object
      properties:
        execution_time:
          type: number
          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: video_manager_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

    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"

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

    stream_name:
      type: string
      maxLength: 128
      pattern: '^[a-zA-Z0-9_\-]{0,128}$'
      default: ""

    stream_description:
      type: string
      maxLength: 512
      default: ""

    analytic_name:
      allOf:
        - $ref: '#/components/schemas/string36'
      pattern: '^[a-zA-Z0-9_\-]{1,36}$'
      description: Analytic name.
      example: some name

    agent_name:
      type: string
      pattern: '^[a-zA-Z0-9_\-]{3,128}$'
      minLength: 3
      maxLength: 128
      description: Agent name.
      example: some name

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

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

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

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

    string36:
      type: string
      maxLength: 36

    string36_nullable:
      type: string
      maxLength: 36
      nullable: true

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

    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'

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

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

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


    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]

    source:
      description: Additional information that user provides with event.
      type: string
      maxLength: 128
      pattern: "^[^\\x00]*$"
      example: "3rd Avenue"

    source_nullable:
      allOf:
        - $ref: '#/components/schemas/source'
        - nullable: true

    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_reference:
      type: string
      maxLength: 512
      description: path to stream source (stream or videofile)
      example: https://upload.wikimedia.org/wikipedia/commons/2xQ2gprbMUePw1s9gw9fvA==

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

    start_time:
      type: number
      min: 0
      default: 0
      nullable: false
      description: custom video start time

    video_pts:
      type: object
      description: Video timestamp settings.
      nullable: false
      properties:
        start_time:
          $ref: '#/components/schemas/start_time'
      required: [start_time]

    analytics:
      type: array
      description: list of analytics with its parameters
      items:
        type: object
        properties:
          analytic_name:
            $ref: '#/components/schemas/analytic_name'
          parameters:
            $ref: '#/components/schemas/analytic_parameters'
        required: [analytic_name]
      minItems: 1

    analytics_response:
      allOf:
        - $ref: '#/components/schemas/analytics'
      type: array
      items:
        type: object
        required: [analytic_name, parameters]

    stream_to_be_created_base:
      type: object
      properties:
        name:
          allOf:
            - $ref: '#/components/schemas/stream_name'
          description: Stream name.
          default: ""
        description:
          allOf:
            - $ref: '#/components/schemas/stream_description'
          description: Stream description.
          default: ""
        data:
          $ref: '#/components/schemas/stream_data'
        location:
          $ref: '#/components/schemas/location_to_be_created'
        source:
          $ref: '#/components/schemas/source'
        autorestart:
          $ref: '#/components/schemas/stream_autorestart'
        analytics:
          $ref: '#/components/schemas/analytics'
      required: [ data, analytics ]

    stream_data_base:
      type: object
      properties:
        reference:
          $ref: '#/components/schemas/stream_reference'
        downloadable:
          type: boolean
          default: false
          description: Whether to download reference via HTTP `GET` request before processing.
        timestamp_source:
          type: string
          enum: [auto, pts, server, frame_rate]
          default: auto
          description: |
            Timestamp source:
            
            `pts` - video labels | only when labels exist
            
            `server` - server time | only for stream
            
            `frame_rate` - video file
            
            `auto` - `pts` if video/stream contains correct `pts`, otherwise `server` for stream or `frame_rate` for video file.

            Correct `pts` for video file means time from video label differs to video start less than `-10**5`s.

            Correct `pts` for stream means time from stream differs to server time less than 1 day.
        rotation:
          $ref: '#/components/schemas/rotation'
        pts:
          $ref: '#/components/schemas/video_pts'
      required: [ type, reference ]

    stream_data_stream:
      allOf:
        - properties:
            type:
              type: string
              description: Stream.
              enum: ["stream"]
            timeout:
              type: integer
              nullable: true
              description: Stream [read timeout](https://ffmpeg.org/ffmpeg-protocols.html) for `stream` in ms.
              default: 3000
              minimum: 100
              maximum: 2147483647
        - $ref: '#/components/schemas/stream_data_base'

    stream_data_videofile:
      allOf:
        - properties:
            type:
              type: string
              description: Videofile.
              enum: ["videofile"]
            timeout:
              type: integer
              nullable: true
              description: |
                [Total timeout](http://docs.aiohttp.org/en/stable/client_reference.html) for `videofile` download.
                
                The default one from config will be used if not specified (from 
                `LUNA_VIDEO_AGENT_VIDEO_SETTINGS`/`LUNA_VIDEO_AGENT_VIDEO_SETTINGS` setting).
              default: null
              minimum: 100
              maximum: 2147483647
        - $ref: '#/components/schemas/stream_data_base'

    stream_data:
      oneOf:
        - $ref: '#/components/schemas/stream_data_stream'
        - $ref: '#/components/schemas/stream_data_videofile'

    stream_data_required:
      allOf:
        - $ref: '#/components/schemas/stream_data'
        - required: [type, reference, rotation, downloadable, timestamp_source, pts]

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

    stream_status:
      type: integer
      description: |
        stream status
        | Status name  | Value | Description                                                    | 
        |--------------|-------|----------------------------------------------------------------|
        | pending      | 0     | Stream is waiting for processing.                              |
        | in_progress  | 1     | Stream processing is in progress.                              |
        | done         | 2     | Stream processing is completed.                                |
        | restart      | 3     | Stream processing is restarted by server.                      |
        | failure      | 4     | Stream processing is failed.                                   |
        | stop         | 5     | Stream processing is stopped by user.                          |

        > **WARNING**: Stream status list may be expanded in the future.
      enum: [0,1,2,3,4,5]

    feedback_stream_status:
      type: integer
      description: |
        stream status
        | Status name  | Value | Description                               | 
        |--------------|-------|-------------------------------------------|
        | in_progress  | 1     | Stream processing is in progress.         |
        | done         | 2     | Stream processing is completed.           |
        | failure      | 4     | Stream processing is failed.              |
        | stop         | 5     | Stream processing is stopped.             |

        > **WARNING**: Stream status list may be expanded in the future.
      enum: [1,2,4,5]

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

    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_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

    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/stream_description'
          description: Stream description.
          example: some description
        data:
          $ref: '#/components/schemas/stream_data_required'
        location:
          $ref: '#/components/schemas/location'
        source:
          $ref: '#/components/schemas/source_nullable'
        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:
          $ref: '#/components/schemas/stream_status'
        last_error:
          $ref: '#/components/schemas/stream_error'
        groups:
          type: array
          items:
            $ref: '#/components/schemas/group_name'
          description: List of groups the stream belongs to.
        analytics:
          $ref: '#/components/schemas/analytics_response'
      required: [ stream_id, account_id, name, description, data, location, source, autorestart, version, create_time, status, last_error, groups, analytics ]

    streams_to_be_deleted:
      type: object
      properties:
        stream_ids:
          description: Stream ID filter.
          type: array
          items:
            $ref: '#/components/schemas/stream_id'
          maxItems: 1000
      required: [stream_ids]

    count:
      type: integer
      minimum: 0
      example: 146

    analytic_documentation:
      type: string
      description: Binary analytic documentation encoded in base64.
      default: ""

    validation_schema:
      type: object
      description: |
        Analytic parameters json validation schema.
        
        Specified schema will be used for analytic parameters validation during stream creation request, if
        no validation schema is specified, validation will not performed. Validation schema must be presented
        as jsonschema (see <a href="https://json-schema.org/specification">json schema specification</a> for details)
      additionalProperties: true

    analytic_version:
      type: integer
      minimum: 1
      default: 1

    default_parameters:
      type: object
      description: Default parameters for the video analytic.
      default: {}
      additionalProperties: true

    analytic_parameters:
      allOf:
        - $ref: '#/components/schemas/default_parameters'
      description: |
        Analytic parameters for stream processing.
        
        There are default analytic parameters which will be applied for stream processing if no one specified here.
        
        To list available analytics it is possible to use [get analytics request](#tag/analytics/operation/getAnalytics).
        
        To get schema and description of acceptable parameters for this or that analytics, it is possible to get it
        using [get analytic documentation request](#tag/analytics/operation/getAnalyticDoc)
        
        Specified parameters will be validation using analytic `validation_schema` if exists. 

    analytic_to_be_patched:
      type: object
      properties:
        analytic_name:
          $ref: '#/components/schemas/analytic_name'
        description:
          allOf:
            - $ref: '#/components/schemas/string512_default'
          description: Analytic description.
          default: ""
        documentation:
          $ref: '#/components/schemas/analytic_documentation'
        validation_schema:
          $ref: '#/components/schemas/validation_schema'
        analytic_version:
          $ref: '#/components/schemas/analytic_version'
        default_parameters:
          $ref: '#/components/schemas/default_parameters'

    analytic_to_be_created:
      allOf:
        - $ref: '#/components/schemas/analytic_to_be_patched'
      required: [analytic_name]

    agent_max_stream_count:
      type: integer
      minimum: 1
      description: Max streams count for agent
      example: 10

    agent_active_streams_count:
      type: integer
      minimum: 0
      description: Active streams count for agent
      example: 5

    agent_status:
      type: integer
      enum: [ 0, 1 ]
      default: 1
      description: |
        Agent status.

        | Value | Description         |
        |-------|---------------------|
        |   0   | Agent is not ready. |
        |   1   | Agent is ready.     |

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

    analytic_names:
      type: array
      description: Analytics list.
      items:
        $ref: '#/components/schemas/analytic_name'
      minItems: 1

    agent_port:
      type: integer
      minimum: 1
      maximum: 65535
      description: agent listening port

    agent_to_be_created:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/agent_name'
        description:
          allOf:
            - $ref: '#/components/schemas/string512_default'
          description: Analytic description.
          default: ""
        max_stream_count:
          $ref: '#/components/schemas/agent_max_stream_count'
        analytic_names:
          $ref: '#/components/schemas/analytic_names'
        port:
          $ref: '#/components/schemas/agent_port'
        api_version:
          type: integer
          minimum: 1
          description: agent api version
      required: [name, max_stream_count, analytic_names, port, api_version]

    agent_to_get:
      allOf:
        - $ref: '#/components/schemas/agent_to_be_created'
      type: object
      properties:
        agent_id:
          $ref: '#/components/schemas/agent_id'
        status:
          $ref: '#/components/schemas/agent_status'
        active_stream_count:
          $ref: '#/components/schemas/agent_active_streams_count'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: Agent create time.
        last_update_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: Agent last update time.
        analytic_names:
          $ref: '#/components/schemas/analytic_names'
        host:
          type: string
          description: Agent host.
          nullable: false
          example: 10.0.10.10
      required: [agent_id, status, name, description, max_stream_count, active_stream_count, create_time, last_update_time, analytic_names, port, api_version, host]

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

    post_streams_processing_feedback_request:
      description: Streams info object.
      type: object
      properties:
        streams:
          description: Array of stream info.
          type: array
          minItems: 0
          items:
            description: Stream info from the processor.
            type: object
            properties:
              stream_id:
                $ref: '#/components/schemas/stream_id'
              status:
                $ref: '#/components/schemas/feedback_stream_status'
              error:
                $ref: '#/components/schemas/stream_error'
              version:
                $ref: '#/components/schemas/stream_version'
              time:
                $ref: '#/components/schemas/feedback_time'
            required: [ error, stream_id, status, version, time ]
      required: [streams]

    streams_feedback_response:
      description: Feedback response.
      type: object
      properties:
        streams:
          description: Array of streams info
          type: array
          minItems: 1
          items:
            type: object
            properties:
              stream_id:
                $ref: '#/components/schemas/stream_id'
              version:
                $ref: '#/components/schemas/stream_version'
              action:
                type: string
                enum: ["stop", "continue"]
                description: Action that's need to be performed with stream - stop processing or continue processing.
            required: [stream_id, version, action]
      required: [streams]

    analytic_response:
      type: object
      properties:
        analytic_id:
          $ref: '#/components/schemas/analytic_id'
        analytic_name:
          $ref: '#/components/schemas/analytic_name'
        description:
          allOf:
            - $ref: '#/components/schemas/string512_default'
          description: Analytic description.
          default: ""
        analytic_version:
          $ref: '#/components/schemas/analytic_version'
        default_parameters:
          $ref: '#/components/schemas/default_parameters'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: Analytic create time.
        last_update_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: Analytic last update time.
        validation_schema:
          allOf:
            - $ref: '#/components/schemas/validation_schema'
          nullable: true
      required: [analytic_id, analytic_name, description, analytic_version, default_parameters, create_time,
                 last_update_time, validation_schema]

    analytics_to_be_deleted:
      type: object
      properties:
        analytic_ids:
          description: Analytic ID filter.
          type: array
          items:
            $ref: '#/components/schemas/analytic_id'
          maxItems: 1000
      required: [analytic_ids]

    agents_to_be_deleted:
      type: object
      properties:
        agent_ids:
          description: Agent ID filter.
          type: array
          items:
            $ref: '#/components/schemas/agent_id'
          maxItems: 1000
      required: [agent_ids]

    create_group:
      type: object
      properties:
        group_name:
          $ref: '#/components/schemas/group_name'
        description:
          allOf:
            - $ref: '#/components/schemas/group_description'
          default: ""
      required: [ group_name ]

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

    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"

    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"

    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]

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

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

    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:
                $ref: '#/components/schemas/stream_status'
            minProperties: 1
          minItems: 0
      required: [logs]

    feedback_frequency:
      type: int
      minimum: 1
      description: Required feedback frequency

    agents_streams_response:
      type: object
      properties:
        streams:
          type: array
          description: streams to process and its meta information for agent
          items:
            type: object
            properties:
              stream_id:
                $ref: '#/components/schemas/stream_id'
              data:
                $ref: '#/components/schemas/stream_data'
              location:
                $ref: '#/components/schemas/location'
              source:
                $ref: '#/components/schemas/source_nullable'
              analytics:
                $ref: '#/components/schemas/analytics_response'
              feedback_frequency:
                $ref: '#/components/schemas/feedback_frequency'
              version:
                $ref: '#/components/schemas/stream_version'
              account_id:
                $ref: '#/components/schemas/account_id'
            required: [stream_id, data, location, source, analytics, feedback_frequency, version, account_id]
          minItems: 0
      required: [streams]

    refresh_period:
      type: integer
      minimum: 1
      example: 5
      description: |
        Period for periodic agent requests to
        <a href="#tag/agents-interaction/operation/postAgentStreams">get streams for processing</a>

    alive_period:
      type: integer
      minimum: 1
      example: 30
      description: |
        Period for case when agent connection to `Luna-Video-Manager` cannot be established and streams can stay 
        in progress. If connection was not established after this period, all streams processing must be stopped by
        agent. See developer manual for more information.

    ws_stream_status:
      type: string
      enum: [in_progress, error, finished]
      description: |
        Stream processing status.

        `in_progress` means stream processing is in progress.
        
        `error` means fatal error occurred, interrupting processing, the connection will closed.

        `finished` means stream processing was successfully finished, the connection will closed.

    error_stream:
      type:
        - string
        - "null"
      description: Stream analytics processing error. Null means no error occurred.
      example: "decoding error"
      nullable: true

    message_from_ws:
      type: object
      description: Event from websocket.
      properties:
        stream_status:
          $ref: '#/components/schemas/ws_stream_status'
        error:
          allOf:
          - $ref: '#/components/schemas/error_stream'
          description: Stream processing error. Null means no error occurred.
        analytics_results:
          type: object
          description: |
            Analytics results.
            To get schema and description of analytics ws event, it is possible to get it
            using [get analytic documentation request](#tag/analytics/operation/getAnalyticDoc)
          properties:
            <analytics_name>:
              description: Analytics results.
              oneOf:
              - type: object
                description: Processing error.
                properties:
                  error:
                    $ref: '#/components/schemas/error_stream'
                required: [error]
              - type: object
                description: Event from websocket.
                additionalProperties: true
      required: [stream_status, error]

    restream_type:
      type: string
      default: hls
      enum: [ "hls" ]

    restream_quality_base:
      type: integer
      multipleOf: 2
      minimum: 144
      maximum: 2160
      example: 720

    restream_quality:
      allOf:
        - $ref: '#/components/schemas/restream_quality_base'
      description: >
        Target restream quality. This parameter set the height of final stream resolution, the width will
        be calculated proportionally in accordance with the original stream resolution. The original stream quality
        will be used by default.

    restream_quality_reply:
      allOf:
        - $ref: '#/components/schemas/restream_quality_base'
      description: >
        This parameter means the height of stream resolution, the width calculated proportionally in accordance with 
        the original stream resolution.

    stream_info:
      type: object
      properties:
        url:
          type: string
          description: restream url
        type:
          allOf:
            - $ref: '#/components/schemas/restream_type'
            - default: hls
        quality:
          allOf:
            - $ref: '#/components/schemas/restream_quality_reply'
            - default: 480
        token:
          type: string
          description: jwt token for stream
      required: [ url ]

    stream_info_required:
      allOf:
        - $ref: '#/components/schemas/stream_info'
      required: [ url, type, quality, token ]
  responses:
    internal_server_error:
      description: internal server error.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'

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

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

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            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/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/streams:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'

    post:
      tags:
        - streams
      summary: create stream
      description: Create stream.
      operationId: createStream
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/luna_account_id_header_required'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/stream_to_be_created'
        required: true
      responses:
        201:
          description: Create success.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  stream_id:
                    allOf:
                      - $ref: '#/components/schemas/stream_id'
                    description: |
                      ID of the created stream.
                      The ID can be used as the `stream_id` parameter in [GET](#operation/getStream) `/streams/{stream_id}`.
                required: [ stream_id ]
                example:
                  stream_id: b5d6fd45-fcca-453d-ac05-3e594054b813
        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: 'extra',  message: 'Extra inputs are not permitted'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        422:
          description: Unprocessable content.
          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_suitable_agent:
                  value:
                    error_code: 44014
                    desc: Unprocessable content
                    detail: |
                      Failed to find agent that supports all analytics associated with the stream
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44014
        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/create_time__gte'
        - $ref: '#/components/parameters/create_time__lt'
        - $ref: '#/components/parameters/agent_id_query'
        - $ref: '#/components/parameters/group_name'
        - $ref: '#/components/parameters/sources'
        - $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.
      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: 'extra',  message: 'Extra inputs are not permitted'
                    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/sources'
        - $ref: '#/components/parameters/create_time__gte'
        - $ref: '#/components/parameters/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'
      - $ref: '#/components/parameters/path_stream_id'

    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: 44001
                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-44001
        500:
          $ref: '#/components/responses/internal_server_error'

    head:
      tags:
        - streams
      summary: head stream
      operationId: checkStream
      description:  Check if stream exists.
      parameters:
        - $ref: '#/components/parameters/account_id'
      responses:
        200:
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          description: No content
        404:
          description: Stream not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        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'
        - $ref: '#/components/parameters/luna_account_id_header_required'
      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:
                    $ref: '#/components/schemas/stream_version'
                required: [ stream_id, version ]
        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: 'extra',  message: 'Extra inputs are not permitted'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        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: 44001
                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-44001
        500:
          $ref: '#/components/responses/internal_server_error'

    patch:
      tags:
        - streams
      summary: patch stream
      description: Pause/unpause stream
      operationId: patchStream
      parameters:
        - $ref: "#/components/parameters/patch_stream_action"
      responses:
        204:
          description: Patched 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 'action'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        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: 44001
                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-44001
        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: 44001
                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-44001
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/streams/{stream_id}/restream:
    parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/path_stream_id'

    get:
      parameters:
        - $ref: '#/components/parameters/restream_quality'
      tags:
        - streams
      summary: get stream retransmission
      description: Get stream retransmission (HLS).
      operationId: retransmission
      responses:
        '200':
          description: Retransmission.
          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_info_required'
        '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 (''userdata'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
        '403':
          description: Forbidden, luna-streams-retranslator support is disabled on server.
          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: 11078
                desc: Forbidden
                detail: Luna Streams Service service is disabled
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11078"
        '404':
          description: Object 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:
                bad_json:
                  value:
                    error_code: 45002
                    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-45002"
        '422':
          description: Unprocessable Content.
          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: 46002
                    desc: 'Unprocessable Content'
                    detail: 'The `videofile` retranslation is not supported at the moment'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-46002"
        '500':
          $ref: '#/components/responses/internal_server_error'
  /1/streams/{stream_id}/ws:
    parameters:
      - $ref: '#/components/parameters/path_stream_id'

    get:
      tags:
      - streams
      summary: stream events ws handshake
      description: |
        Stream ws events handshake. The resource is designed to receive realtime events from analytics.
        > ### Attention!
        > **Subscription to events occurs via [WebSocket](https://en.wikipedia.org/wiki/WebSocket).**
        > Messages sent by ws you can view in callback section.
        > Connection supports [autoping](https://tools.ietf.org/html/rfc6455#section-5.5.2).
      operationId: wsHandshake
      parameters:
      - $ref: '#/components/parameters/luna_account_id_header_required'

      responses:
        101:
          description: Success handshake.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/message_from_ws'
              examples:
                in_progress_no_error:
                  value:
                    stream_status: "in_progress"
                    error: null
                    analytics_results:
                      crowd:
                        track_id: "557d54ec-29ad-4f3c-93b4-c9092ef12515"
                        event_id: "557d54ec-29ad-4f3c-93b4-c9092ef12515"
                        people_count: 2
                        time_offset: 1.234
                        event_status: "started"
                        people_coordinates: [[64,128],[491,375]]
                in_progress_analytics_error:
                  value:
                    stream_status: "in_progress"
                    error: null
                    analytics_results:
                      crowd:
                        error: "error decoding frame number 12345"
                stream_error:
                  value:
                    stream_status: "error"
                    error: "fatal error during stream processing: connection refused"
                processing_finished:
                  value:
                    stream_status: "finished"
                    error: null
        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:
                oneOf:
                - $ref: '#/components/schemas/error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'stream_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        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: 44001
                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-44001
        422:
          description: Stream is not in progress.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/error'
              examples:
                stream_is_not_in_progress:
                  value:
                    error_code: 44013
                    desc: Stream status is unsuitable
                    detail: Stream with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' is not currently being processed
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44013
        500:
          $ref: '#/components/responses/internal_server_error'
      x-codeSamples:
        - lang: python
          label: async with websockets library
          source: |
            import asyncio
            import websockets

            async def main():
                uri = "ws://127.0.0.1:5230/1/streams/70c75b04-1ec8-4aa1-930c-ddad9e47b54b/ws"  # Note filtering by gender!
                async with websockets.connect(uri, extra_headers={"Luna-Account-Id": "70c75b04-1ec8-4aa1-930c-ddad9e47b54b") as websocket:
                    while True:
                        data = await websocket.recv()
                        print(data)


            asyncio.run(main())

        - lang: bash
          label: using curl
          source: |
            curl -i -N \
              -H "Connection: Upgrade" \
              -H "Upgrade: websocket" \
              -H "Sec-WebSocket-Version: 13" \
              -H "Sec-WebSocket-Key: YWFhYWFhYWFhYWFhYWFhYQ==" \
              -H "Luna-Account-Id: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a" \
              "http://127.0.0.1:5230/1/streams/70c75b04-1ec8-4aa1-930c-ddad9e47b54b/ws"
  /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/linker:
    patch:
      tags:
        - streams group linker
      summary: attach (or detach) streams to a group
      description: Attach (or detach) streams to a group.
      operationId: streamsGroupLinker
      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_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: |
                        Failed to validate input json. Path: 'extra',  message: 'Extra inputs are not permitted'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
                stream_not_found:
                  value:
                    error_code: 44001
                    desc: Object not found
                    detail: Stream with id 8406e8fd-4a02-4a72-81e1-6dfd2441fd2b not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44001
                group_not_found:
                  value:
                    error_code: 44004
                    desc: Object not found
                    detail: Group with id afb2639c-9fcb-43fe-b48c-95e2fd1335b9 not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44004
        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'
        - $ref: '#/components/parameters/luna_account_id_header_required'
      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: 'extra',  message: 'Extra inputs are not permitted'
                    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: 44003
                desc: Unique constraint error
                detail: Group named 'group1' already exists
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44003
        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 ]
        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
      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'
      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: 44004
                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-44004
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - groups
      summary: remove group
      description: Remove the group by name.
      operationId: deleteGroup
      responses:
        204:
          description: Delete success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        404:
          description: Group not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                error_code: 44004
                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-44004
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/analytics:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'

    post:
      tags:
        - analytics
      summary: create analytic
      description: Create analytic.
      operationId: createAnalytic
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/luna_account_id_header_required'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/analytic_to_be_created'
        required: true
      responses:
        201:
          description: Create success.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  analytic_id:
                    allOf:
                      - $ref: '#/components/schemas/analytic_id'
                    description: |
                      ID of the created analytic.
                      The ID can be used as the `analytic_id` parameter in [GET](#operation/getAnalytic) `/analytics/{analytic_id}`.
                required: [analytic_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: 'extra',  message: 'Extra inputs are not permitted'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
        - analytics
      summary: get analytics
      description: Get analytics according to filters. The results are sorted by analytic creation order, the oldest analytics shown first.
      operationId: getAnalytics
      parameters:
        - $ref: '#/components/parameters/analytic_ids'
        - $ref: '#/components/parameters/analytic_id__gte'
        - $ref: '#/components/parameters/analytic_id__lt'
        - $ref: '#/components/parameters/create_time__lt'
        - $ref: '#/components/parameters/create_time__gte'
        - $ref: '#/components/parameters/analytic_names'
        - $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:
                  analytics:
                    type: array
                    items:
                      $ref: '#/components/schemas/analytic_response'
                    minItems: 0
                required: [ analytics ]
        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 'analytic_ids'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - analytics
      summary: delete analytics
      description: Delete analytics matching specified filters.
      operationId: deleteAnalytics
      parameters:
        - $ref: '#/components/parameters/account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/analytics_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: 'extra',  message: 'Extra inputs are not permitted'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/analytics/{analytic_id}:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - in: path
        name: analytic_id
        schema:
          $ref: '#/components/schemas/uuid'
        required: true
        description: ID of the analytic (`analytic_id` received in the ["create analytic"](#operation/createAnalytic) request).

    get:
      tags:
      - analytics
      summary: get analytic
      description: Get the analytic by ID.
      operationId: getAnalytic
      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/analytic_response'
        404:
          description: Analytic 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: 44008
                desc: Object not found
                detail: Analytic with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44008
        500:
          $ref: '#/components/responses/internal_server_error'

    head:
      tags:
        - analytics
      summary: head analytic
      operationId: checkAnalytic
      description:  Check if analytic exists.
      parameters:
        - $ref: '#/components/parameters/account_id'
      responses:
        204:
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          description: No content
        404:
          description: Analytic not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        500:
          $ref: '#/components/responses/internal_server_error'

    put:
      tags:
        - analytics
      summary: put analytic
      description: Update existing analytic. You should specify all the fields required for the stream in the request.
      operationId: putAnalytic
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/luna_account_id_header_required'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/analytic_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:
                  analytic_id:
                    allOf:
                      - $ref: '#/components/schemas/analytic_id'
                    description: |
                      ID of the analytic that was put.
                      The ID can be used as the `analytic_id` parameter in [GET](#operation/getAnalytic) `/analytics/{analytic_id}`.
                  version:
                    allOf:
                      - $ref: '#/components/schemas/analytic_version'
                    description: Analytic current version (incremented on every change).
                required: [ analytic_id, version ]
        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: 'extra',  message: 'Extra inputs are not permitted'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        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: 44008
                desc: Object not found
                detail: Analytic with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44008
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - analytics
      summary: remove analytic
      description: Remove the analytic by ID.
      operationId: removeAnalytic
      parameters:
        - $ref: '#/components/parameters/account_id'
      responses:
        204:
          description: Delete success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        404:
          description: Analytic 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: 44008
                desc: Object not found
                detail: Analytic with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44008
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/analytics/{analytic_id}/docs:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - in: path
        name: analytic_id
        schema:
          $ref: '#/components/schemas/uuid'
        required: true
        description: ID of the analytic (`analytic_id` received in the ["create analytic"](#operation/createAnalytic) request).

    get:
      tags:
      - analytics
      summary: get analytic documentation
      description: Get the analytic documentation by ID.
      operationId: getAnalyticDoc
      parameters:
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/accept_html'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              oneOf:
                - $ref: '#/components/headers/application_json'
                - $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: string
                description: raw analytic documentation.
            application/x-yaml:
              schema:
                type: object
                description: analytics documentation
            text/html:
              schema:
                type: string
                description: HTML format analytic documentation.
        404:
          description: Analytic 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: 44008
                desc: Object not found
                detail: Analytic with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44008
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/agents:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'

    post:
      tags:
        - agents
      summary: register agent
      description: register agent.
      operationId: registerAgent
      parameters:
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/luna_account_id_header_required'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/agent_to_be_created'
        required: true
      responses:
        201:
          description: Create success.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  agent_id:
                    allOf:
                      - $ref: '#/components/schemas/agent_id'
                    description: |
                      ID of the created agent.
                      The ID can be used as the `agent_id` parameter in [GET](#operation/getAgent) `/agents/{agent_id}`.
                  refresh_period:
                    $ref: '#/components/schemas/refresh_period'
                  alive_period:
                    $ref: '#/components/schemas/alive_period'
                required: [agent_id, refresh_period, alive_period]
        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: 'extra',  message: 'Extra inputs are not permitted'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
        - agents
      summary: get agents
      description: Get agents according to filters. The results are sorted by agent creation order, the oldest agents shown first.
      operationId: getAgents
      parameters:
        - $ref: '#/components/parameters/agent_ids'
        - $ref: '#/components/parameters/agent_id__gte'
        - $ref: '#/components/parameters/agent_id__lt'
        - $ref: '#/components/parameters/agent_names'
        - $ref: '#/components/parameters/create_time__lt'
        - $ref: '#/components/parameters/create_time__gte'
        - $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:
                  agents:
                    type: array
                    description: agent list
                    items:
                      $ref: '#/components/schemas/agent_to_get'
                    minItems: 0
                required: [ agents ]
        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 'agent_ids'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - agents
      summary: delete agents
      description: Delete agents matching specified filters.
      operationId: deleteAgents
      parameters:
        - $ref: '#/components/parameters/account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/agents_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/agents/{agent_id}:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/agent_id'

    get:
      tags:
      - agents
      summary: get agent
      description: Get the agent by ID.
      operationId: getAgent
      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/agent_to_get'
        404:
          description: Analytic 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: 44007
                desc: Object not found
                detail: Agent with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44007
        500:
          $ref: '#/components/responses/internal_server_error'

    head:
      tags:
        - agents
      summary: head agent
      operationId: checkAgent
      description:  Check if agent exists.
      parameters:
        - $ref: '#/components/parameters/account_id'
      responses:
        204:
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          description: Agent exists.
        404:
          description: Agent not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - agents
      summary: remove agent
      description: Remove the agent by ID.
      operationId: removeAgent
      parameters:
        - $ref: '#/components/parameters/account_id'
      responses:
        204:
          description: Delete success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        404:
          description: Analytic 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: 44007
                desc: Object not found
                detail: Agent with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44007
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/agents/{agent_id}/streams:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - in: path
        name: agent_id
        schema:
          $ref: '#/components/schemas/uuid'
        required: true
        description: ID of the agent (`agent_id` received in the ["register agent"](#operation/registerAgent) request).

    post:
      tags:
      - agents interaction
      summary: get streams which processing must be started.
      description: Get agents streams by agent ID and send information about streams processing.
      operationId: postAgentStreams
      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/agents_streams_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: 'extra',  message: 'Extra inputs are not permitted'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        404:
          description: Agent 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: 44007
                desc: Object not found
                detail: Agent with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-44007
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/agents/{agent_id}/streams/feedback:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/agent_id'
    post:
      tags:
      - agents interaction
      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/streams_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: 'extra',  message: 'Extra inputs are not permitted'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        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'
