OpenApi

You can find spec for the API service spec in the html document.

openapi: 3.0.0
info:
  version: 'v.1.5.30'
  title: 'LUNA Backport 4 API'
  description: |
          VisionLabs Luna Backport 4 API. The API version is 5.      
          
          OpenAPI specification is the only valid document providing up-to-date information about the service API. 

          The specification can be used:

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

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

          OpenAPI specification can be received using the "/docs/spec" resource. The "Accept" header should be set to "application/x-yaml".    
      
servers:
- description: SwaggerHub API Auto Mocking
  url: https://virtserver.swaggerhub.com/visionlabs/Luna3API/v.1.5.30


components:
  headers:
    application_json:
      schema:
        type: string
        enum:
        - application/json
        - application/json; charset=utf-8
      required: true
      description: content type is application/json

    octet_stream:
      schema:
        type: string
        enum:
        - application/octet-stream
      required: true
      description: content type is application/octet-stream

    text_plain:
      schema:
        type: string
        enum:
        - text/plain
      required: true
      description: content type is text/plain

    text_html:
      schema:
        type: string
        enum:
          - text/html
      required: true
      description: content type is text/html

    docs_content_type:
      schema:
        type: string
        enum:
          - application/x-yaml
          - text/html
      required: true
      description: Type of recieving data

    image_content_type:
      schema:
        type: string
        enum:
        - image/jpeg
        - image/png
      description: content type is image/jpeg or image/png
      required: true

    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

    application_zip:
      schema:
        type: string
        enum:
        - application/zip
      required: true
      description: content type is application/zip

    content_disposition:
      schema:
        type: string
      example: 'attachment; filename=task_146.zip'
      required: true
      description: content disposition with filename

    allow_methods:
      schema:
        type: string
      example: 'PUT, DELETE, GET, OPTIONS'
      required: true
      description: allow methods header

    access_control_allow_origin:
      schema:
        type: string
        enum: ['*']
      example: '*'
      description: access control allow origin header. Is supported by CORS requests to the server

    access_control_allow_headers:
      schema:
        type: string
        enum: ['*']
      example: '*'
      description: access control allow headers. Is supported by CORS requests to the server

    access_control_allow_methods:
      schema:
        type: string
        enum: ['*']
      example: '*'
      description: access control allow methods. Is supported by CORS requests to the server

    access_control_max_age:
      schema:
        type: string
        enum: ['86400']
      example: '86400'
      description: access control max age header. Is supported by CORS requests to the server

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

    authenticate:
      schema:
        type: string
        enum:
        - Basic realm="login:password"
        - Bearer
      required: true
      description: authorization format

    transfer_encoding:
      schema:
        type: string
      example: 'chunked'
      required: true
      description: transfer encoding type
  parameters:
    page:
      in: query
      name: page
      schema:
        type: integer
        minimum: 1
        default: 1
      description: a page number.

    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, the system will set it to the default format ("timestamp,UUID"). It will be returned with response.
      name: Luna-Request-Id

    cors_origin:
      in: header
      name: Origin
      schema:
        type: string
      example: 'http://example.com'
      description: The Origin header indicates the origin of the cross-site access request

    luna_account_id:
      in: header
      deprecated: true
      schema:
        type: string
        format: uuid4
        example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a
        pattern: ^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
      description: |
        account ID. Account is a limitation for all user actions (matching, removing, updating and other)
        on data which does not have corresponding account id. For example: it is impossible to attach a face with one
        account to a list with another account id. User can make a limited set of requests without this header
        (requests with methods *GET, HEAD, OPTIONS*, match requests and getting events statistics requests).
      name: Luna-Account-Id

    required_luna_account_id:
      in: header
      deprecated: true
      required: true
      schema:
        type: string
        format: uuid4
        example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a
        pattern: ^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
      description: |
        account ID. Account is a limitation for all user actions (matching, removing, updating and other)
        on data which does not have corresponding account id. For example: it is impossible to attach a face with one
        account to a list with another account id. User can make a limited set of requests without this header
        (requests with methods *GET, HEAD, OPTIONS*, match requests and getting events statistics requests).
      name: Luna-Account-Id

    luna_account_id_new_account:
      in: header
      schema:
        type: string
        format: uuid
        example: 8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a
        pattern: ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
      description: |
        Account ID for new account creation.
      name: Luna-Account-Id

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

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

    order:
      in: query
      name: order
      schema:
        type: string
        enum: ["asc", "desc"]
      description: the sort order. If "desc" is set, the newest events will be shown first. If "asc" is set, the oldest events will be shown first.

    gender:
      in: query
      name: gender
      schema:
        type: integer
        enum: [0, 1]
      description: Gender. 1 - male, 0 - female.
      example: 1

    emotions:
      in: query
      name: emotions
      schema:
        type: string
        format: list of integer (1, 2, 3, 4, 5, 6, 7)
      description: |
        comma-separated list of predominant emotions. Each event from result will contain one of the given emotions.

        | emotions    | value |
        |-----------------|---|
        | anger           | 1 |
        | disgust         | 2 |
        | fear            | 3 |
        | happiness       | 4 |
        | neutral         | 5 |
        | sadness         | 6 |
        | surprise        | 7 |
      example: "1,2,3"

    ethnic_groups:
      in: query
      name: ethnic_groups
      schema:
        type: string
        format: list of integer (1, 2, 3, 4)
      description: |
        comma-separated list of dominant ethnic group. Each event from result will contain one of the given ethnic groups.

        | ethnicity   | value |
        |-----------------|---|
        | AfricanAmerican | 1 |
        | Indian          | 2 |
        | Asian           | 3 |
        | Caucasian       | 4 |

      example: "1,2"

    tags:
      in: query
      name: tags
      schema:
        type: array
        items:
          $ref: '#/components/schemas/tag'
        minItems: 0
      explode: false
      description: |
        A comma-separated list of tags. Each event from result will contain all of the given tags.
        Each tag can be at most 36 characters.
      example:
        - tag_1
        - tag_2

    time__lt:
      in: query
      name: time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper bound for object create_time.
      example: "2018-08-11T09:11:41.674Z"

    time__gte:
      in: query
      name: time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: lower included bound for object create_time.
      example: "2018-08-11T09:11:41.674Z"

    event_time__lt:
      in: query
      name: create_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper bound for object create_time. Current datetime if no time bound specified.
      example: "2018-08-11T09:11:41.674Z"

    event_time__gte:
      in: query
      name: create_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: lower included bound for object create_time. Current datetime minus month if no time bound specified.
      example: "2018-08-11T09:11:41.674Z"

    list_create_time__lt:
      in: query
      name: create_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper bound for list create_time.
      example: "2018-08-11T09:11:41.674Z"

    list_create_time__gte:
      in: query
      name: create_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: lower included bound for list create_time.
      example: "2018-08-11T09:11:41.674Z"

    list_last_update_time__lt:
      in: query
      name: last_update_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper excluded bound for list last_update_time.
      example: "2018-08-11T09:11:41.674Z"

    list_last_update_time__gte:
      in: query
      name: last_update_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: lower included bound for list last_update_time.
      example: "2018-08-11T09:11:41.674Z"

    age__lt:
      in: query
      name: age__lt
      schema:
        type: integer
      description: age upper excluded bound.
      example: 50

    age__gte:
      in: query
      name: age__gte
      schema:
        type: integer
      description: age lower included bound.
      example: 50

    face_ids:
      in: query
      name: face_ids
      schema:
        type: string
        format: list of uuid4
      description: list of comma-separated face ids.

      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc38'

    event_ids:
      in: query
      name: event_ids
      schema:
        type: string
        format: list of uuid4.
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc38'

      description: a list of comma-separated event ids.

    handler_ids:
      in: query
      name: handler_ids
      schema:
        type: string
        format: list of uuid4.
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc38'
      description: a list of comma-separated handler ids.

    external_id:
      in: query
      name: external_id
      schema:
        type: string
        maxLength: 36
      description: |
        external ID.
        When filtering by an external ID, you must specify the full `external_id` value.

    external_ids:
      in: query
      name: external_ids
      schema:
        type: string
        format: list of string.
      example: 'external_id_1,external_id_2'
      description: a list of comma-separated external ids.

    user_data:
      in: query
      name: user_data
      schema:
        type: string
      description: |
        find all objects with `user_data` that is similar to this parameter.
        You can specify only part of the `user_data` value for this filter.
      example: "user_data_text"

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

    top_similar_face_list:
      in: query
      name: top_similar_face_list
      schema:
        $ref: '#/components/schemas/uuid4'
      description: ID of top similar face list.

    top_similar_face_lists:
      in: query
      name: top_similar_face_lists
      schema:
        type: array
        items:
          $ref: '#/components/schemas/uuid4'
      description: IDs of top similar face lists.

    top_similar_face_ids:
      in: query
      name: top_similar_face_ids
      schema:
        type: array
        items:
          $ref: '#/components/schemas/uuid4'
      description: Comma-separated list of top similar face ids. Each event from result will contain one of the given top similar face ids.

    top_similar_face_similarity__gte:
      in: query
      name: top_similar_face_similarity__gte
      schema:
        type: number
      description: Top similar face similarity lower included bound.
      example: 0.5

    top_similar_face_similarity__lt:
      in: query
      name: top_similar_face_similarity__lt
      schema:
        type: number
      description: Top similar face similarity upper excluded bound.
      example: 0.5

    get_event_target:
      in: query
      name: target
      schema:
        type: string
        enum: ["create_time", "event_id", "handler_id", "external_id", "attribute_id", "source",
               "top_similar_face_id", "top_similar_face_list", "top_similar_face_similarity", "match_result",
               "extract_result", "face_id", "attach_result", "gender", "age", "emotion", "ethnic_group", "tags",
               "user_data"]
      description: |
        Comma-separated list of event fields.
        If set, each event from result will contain only specified fields, otherwise, events with all fields will be returned.
      example: "create_time,event_id,extract_result"

    get_face_target:
      in: query
      name: targets
      schema:
        type: string
        enum: ["face_id", "attribute_id", "event_id", "user_data", "create_time", "external_id", "avatar", "lists"]
      description: |
        Comma-separated list of face fields.
        If set, each face from result will contain only specified fields, otherwise, faces with all the fields will be returned.
      example: "face_id,user_data"

    get_face_target_match:
      in: query
      name: targets
      schema:
        type: string
        enum: ["face_id", "attribute_id", "event_id", "user_data", "create_time", "external_id", "avatar", "lists"]
      description: Comma-separated list of candidate face fields to enrich the match result.
          If set, each face from result will contain specified fields besides the "face_id", otherwise, faces with all fields will be returned.
      example: "face_id,user_data"

    list_id:
      in: query
      name: list_id
      schema:
        $ref: '#/components/schemas/uuid4'
      description: id of a list that contains faces.

    list_ids:
      in: query
      name: list_ids
      schema:
        type: string
        format: list of uuid4
      description: list of comma-separated list ids.

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

    estimate_head_pose:
      in: query
      name: estimate_head_pose
      schema:
        $ref: '#/components/schemas/estimate_head_pose'
      description: |
        whether to estimate head pose in the image.
        *Not supported with warped images (see `warped_image` parameter).*

    estimate_emotions:
      in: query
      name: estimate_emotions
      schema:
        $ref: '#/components/schemas/estimate_emotions'
      description: |
        whether to estimate emotions in the image.

    detect_landmarks68:
      in: query
      name: detect_landmarks68
      schema:
        $ref: '#/components/schemas/detect_landmarks68'
      description: |
        whether to detect basic 68-point facial landmarks in the image.
        *Not supported with warped images (see `warped_image` parameter).*

    extract_exif:
      in: query
      name: estimate_exif
      schema:
        $ref: '#/components/schemas/extract_exif'
      description: |
        whether to extract EXIF meta information from input JPEG images.

        Exact output will vary since there are no mandatory requirements for both authoring software and digital cameras how to write the data.

        This function will only parse the tags and output their names and values as they are. Please refer to JEITA CP-3451 EXIF specification for details.

    estimate_quality:
      in: query
      name: estimate_quality
      schema:
        $ref: '#/components/schemas/estimate_quality'
      description: |
        whether to estimate input face image quality. Each of the following parameters is estimated: light, darkness, saturation and blur

    estimate_gaze:
      in: query
      name: estimate_gaze
      schema:
        $ref: '#/components/schemas/estimate_gaze'
      description: |
        whether to estimate eye gaze in the image.
        *Not supported with warped images (see `warped_image` parameter).*

    estimate_eyes_attributes:
      in: query
      name: estimate_eyes_attributes
      schema:
        $ref: '#/components/schemas/estimate_eyes_attributes'
      description: |
        whether to estimate eye attributes in the image.
        *Not supported with warped images (see `warped_image` parameter).*

    estimate_mouth_attributes:
      in: query
      name: estimate_mouth_attributes
      schema:
        $ref: '#/components/schemas/estimate_mouth_attributes'
      description: |
        whether to estimate mouth attributes in the image.

    pitch_threshold:
      in: query
      name: pitch_threshold
      schema:
        $ref: '#/components/schemas/pitch_threshold'
      description: |
        maximum deviation pitch angle from 0.

    roll_threshold:
      in: query
      name: roll_threshold
      schema:
        $ref: '#/components/schemas/roll_threshold'
      description: |
        maximum deviation roll angle from 0.

    yaw_threshold:
      in: query
      name: yaw_threshold
      schema:
        $ref: '#/components/schemas/yaw_threshold'

      description: |
        maximum deviation yaw angle from 0.

    extract_descriptor:
      in: query
      name: extract_descriptor
      schema:
        $ref: '#/components/schemas/extract_descriptor'
      description: |
          whether to extract face descriptor(s).

    aggregate_attributes:
      in: query
      name: aggregate_attributes
      schema:
        $ref: '#/components/schemas/aggregate_attributes'

    extract_basic_attributes:
      in: query
      name: extract_basic_attributes
      schema:
        $ref: '#/components/schemas/extract_basic_attributes'
      description: |
        whether to extract basic attributes (gender, age, ethnicity).

    score_threshold:
      in: query
      name: score_threshold
      schema:
        $ref: '#/components/schemas/score_threshold'


    warped_image:
      in: query
      name: warped_image
      schema:
        $ref: '#/components/schemas/warped_image'
      description: Whether input image is a sample or not.


    luna_event_time:
      in: header
      name: Luna-Event-Time
      schema:
        $ref: '#/components/schemas/time'
      examples:
        with_time_zone:
          summary: time with timezone
          value: 2018-12-16T15:29:59.300275+03:00
        utc:
          summary: utc time
          value: 2018-12-16T15:29:59.300275Z
      description: |
        user defined event time. All events will be saved with this time as "create_time". Format of time is
        [rfc3339](https://www.ietf.org/rfc/rfc3339.txt). All other format is ignored.

    create_time__lt:
      in: query
      name: create_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper bound for object create_time.
      example: "2018-08-11T09:11:41.674Z"

    create_time__gte:
      in: query
      name: create_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: lower included bound for object create_time.
      example: "2018-08-11T09:11:41.674Z"

    last_update_time__lt:
      in: query
      name: last_update_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper bound for object create_time.
      example: "2018-08-11T09:11:41.674Z"

    last_update_time__gte:
      in: query
      name: last_update_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: lower included bound for object create_time.
      example: "2018-08-11T09:11:41.674Z"

    end_time__lt:
      in: query
      name: end_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper bound for object end_time.
      example: "2018-08-11T09:11:41.674Z"

    end_time__gte:
      in: query
      name: end_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: lower included bound for object end_time.
      example: "2018-08-11T09:11:41.674Z"

    error_time__lt:
      in: query
      name: error_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper bound for object error_time.
      example: "2018-08-11T09:11:41.674Z"

    error_time__gte:
      in: query
      name: error_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: lower included bound for object error_time.
      example: "2018-08-11T09:11:41.674Z"

    error_id:
      in: query
      name: error_id
      schema:
        $ref: '#/components/schemas/errorId'
      description: error id
      example: 10

    error_ids:
      in: query
      name: error_ids
      schema:
        $ref: '#/components/schemas/errorIds'
      description: comma-separated error ids

    task_ids:
      in: query
      name: task_ids
      schema:
        $ref: '#/components/schemas/taskIds'
      description: comma-separated task ids

    error_code:
      in: query
      name: error_code
      schema:
        $ref: '#/components/schemas/error_code'
      description: error code

    task_type:
      in: query
      name: task_type

      schema:
        $ref: '#/components/schemas/taskType'
      example: 1

    task_status:
      in: query
      name: task_status

      schema:
        $ref: '#/components/schemas/taskStatus'
      example: 1

    subtask_status:
      in: query
      name: subtask_status
      description: |
        subtask status

        | subtask status| value |
        |-------------------|---|
        | pending           | 0 |
        | in progress       | 1 |
        | cancelled         | 2 |
        | failed            | 3 |
        | done              | 4 |

      schema:
        $ref: '#/components/schemas/subtaskStatus'
      example: 2

    result_id:
      in: query
      name: result_id

      schema:
        allOf:
        - $ref: '#/components/schemas/result_id'
        - nullable: true
      description: id of task result, which stored in  the Image Store service.
      example: 8f4f0070-c464-460b-bf78-fac225df72e9

    status_code:
      in: query
      name: status_code
      schema:
        $ref: '#/components/schemas/status_code'
      description: http status code

    with_faces:
      in: query
      name: with_faces
      schema:
        $ref: '#/components/schemas/int01_def0'
      description: whether to delete list with all its' faces

    multiple_images_content_type:
      in: header
      name: Content-Type

      schema:
        type: string
        enum:
          - image/jpeg
          - image/png
          - image/bmp
          - image/x-portable-pixmap
          - image/tiff
          - multipart/form-data
          - application/json
          - image/x-jpeg-base64
          - image/x-png-base64
          - image/x-bmp-base64
          - image/x-tiff-base64
          - image/x-portable-pixmap-base64

    attribute_ids:
      in: query
      name: attribute_ids
      required: true
      schema:
        type: string
        format: list of uuid4
      description: list of comma-separated temporary attribute ids.

      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc38'

    accept_docs_handler:
      in: header
      name: Accept
      schema:
        $ref: '#/components/schemas/accept_docs_handler'
      description: acceptable type of recieving 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.

    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
  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
          descriprion: Link to the documentation website with the error description.
      required:
      - error_code
      - detail
      - desc
      - link
      example:
        error_code: 11009
        detail: internal server error
        desc: internal server error
        link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11009

    image_binary:
      type: string
      format: binary
      description: |
        The sample has the following properties
         * its size is always 250x250 pixels
         * it's always in RGB color format
         * it always contains just a single face
         * the face is always centered and rotated so that imaginary line between the eyes is horizontal.

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

    attribute_id:
      allOf:
      - $ref: '#/components/schemas/uuid4'
      description: attribute ID. This ID links the descriptor, the face attributes, the sample, and the face received from a single image.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    sample_id:
      allOf:
        - $ref: '#/components/schemas/uuid4'
      description: sample ID.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    sample_ids:
      type: array
      maxItems: 8
      minItems: 1
      description: sample ID list.
      items:
        $ref: '#/components/schemas/sample_id'

    result_id:
      allOf:
        - $ref: '#/components/schemas/uuid4'
      description: ID of task result, which stored in the Image Store service.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    face_external_id:
      description: user-defined external ID for the face. External ID can be used to link several *faces* which belong to one person.
      type: string
      maxLength: 36
      example: "3.1415926"
      default: ""

    event_external_id:
      description: user-defined external ID for the event. External
      type: string
      maxLength: 36
      example: "3.1415926"
      default: ""

    face_id:
      allOf:
      - $ref: '#/components/schemas/uuid4'
      description: face ID.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    avatar:
      type: string
      maxLength: 256
      format: uri-reference
      example: 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Yfke-sturm-1326186044.jpg/800px-Yfke-sturm-1326186044.jpg'
      default: ""
      description: |
        avatar is a visual representation of a face.

        The avatar can be used in the user interface.

        You can use a sample or an external image as the avatar.

    list_id:
      allOf:
      - $ref: '#/components/schemas/uuid4'
      description: list ID.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    event_id:
      allOf:
      - $ref: '#/components/schemas/uuid4'
      description: event ID.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    handler_id:
      allOf:
      - $ref: '#/components/schemas/uuid4'
      description: handler ID.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    account_id:
      allOf:
        - $ref: '#/components/schemas/uuid4'
      description: Account ID.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    count:
      type: integer
      minimum: 0
      description: object count.
      example: 1

    int01:
      type: integer
      enum:
      - 0
      - 1

    int01_def0:
      type: integer
      default: 0
      enum:
      - 0
      - 1

    int0100:
      type: integer
      minimum: 0
      maximum: 100

    int0180:
      type: integer
      minimum: 0
      maximum: 180

    double01:
      type: number
      format: double
      minimum: 0
      maximum: 1

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

    estimate_head_pose:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      description: whether to estimate head angles (yaw, pitch and roll) in the image.

    estimate_emotions:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      description: whether to estimate emotions in the image.

    estimate_quality:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      description: whether to estimate quality of the image (darkness, light, blur, saturation).

    estimate_gaze:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      description: whether to estimate gaze in the image (yaw and pitch angles for each of the eyes).

    estimate_eyes_attributes:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      description: whether to estimate eye attributes in the image (iris landmarks and state of the eyes).

    estimate_mouth_attributes:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      description: |
        whether to estimate:
          - occlusion of the mouth in the image,
          - the score for the mouth detection confidence,
          - the smile probability.

    detect_landmarks68:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      description: whether to detect basic 68-point facial landmarks in the image.

    extract_exif:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      description: |
        whether to extract EXIF meta-information (artist, date, software, orientation, etc.) from input JPEG images.

        Exact output will vary since there are no mandatory requirements to both authoring software and digital cameras how to write the data.

        This function will only parse the tags and output their names and values as is. Please refer to JEITA CP-3451 EXIF specification for details.

    pitch_threshold:
      example: 180
      allOf:
      - $ref: '#/components/schemas/int0180'
      description: maximum deviation pitch angle from 0. If the estimated value is equal to or less than the threshold, the image is filtered

    roll_threshold:
      example: 180
      allOf:
      - $ref: '#/components/schemas/int0180'
      description: maximum deviation roll angle from 0. If the estimated value is equal to or less than the threshold, the image is filtered

    yaw_threshold:
      example: 180
      allOf:
      - $ref: '#/components/schemas/int0180'
      description: maximum deviation yaw angle from 0. If the estimated value is equal to or less than the threshold, the image is filtered

    extract_basic_attributes:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      description: whether to extract basic attributes (gender, age, ethnicity).

    extract_descriptor:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      example: 1
      default: 1
      description: whether to extract face descriptor(s).

    aggregate_attributes:
      type: integer
      description: |
        whether to aggregate face attributes.

        If the value is set to "0", a descriptor and basic attributes are extracted for each sample.

        If the value is set to "1", you can create an aggregated descriptor, receive aggregated basic attributes, or both. The behavior depends on the `extract_basic_attributes` and `extract_descriptor` parameters:

        - If `extract_descriptor` is enabled, all the samples in the request will be used to create a single descriptor. An aggregated descriptor gives you more accurate results upon descriptors comparison.

        - If `extract_basic_attributes` is enabled, all the samples in the request will be used to extract basic attributes. Age, gender and ethnicity values received from several samples are more precise.

        >Make sure that all the samples in the request belong to the same person.

        >If there are several faces in the input image, an error occurs.

      default: 0

    score_threshold:
      type: number
      minimum: 0
      maximum: 1
      example: 0.74
      default: 0
      description: |
        descriptor quality score threshold. The higher the quality score for the image, the better the extraction results.

        All the attributes with a quality score below the threshold will be ignored (and not stored in the DB). The function will proceed as usual with all the remaining descriptors (if left).

        *Consult VisionLabs about the recommended value of this parameter.*

        **Note!** This parameter is **not** related to the image quality estimated in the detect faces request (`estimate_quality` request parameter).

    column:
      type: string
      enum: [event_id, external_id, handler_id, attribute_id, source, top_similar_face_id, top_similar_face_list,
             create_time, top_similar_face_similarity, face_id, gender, age, emotion, ethnic_group, user_data,
             tags]
      description: fields to aggregate.
      example: source

    gender:
      allOf:
        - $ref: '#/components/schemas/int01'
      description: gender, 0 - female, 1 - male

    age:
      $ref: '#/components/schemas/int0100'


    aggregator:
      type: string
      enum: [count, max, min, avg, group_by]
      example: count
      description: aggregation function for column.
      default: count

    operator_filter:
      type: string
      enum: [eq, neq, in, nin, like, nlike, gt, gte, lt, lte]
      description: filter operator. For tags it is required to be like/nlike only.
      example: eq

    operator_period:
      type: string
      enum: [gt, gte, lt, lte]
      description: filter operator for event creation time.
      example: gt

    value_period:
      type: string
      format: date-time
      example: "2018-01-01T00:00:00Z"
      description: filter value for event creation time. In ISO or now-time format.

    value_filter:
      anyOf:
        - type: string
        - type: number
        - type: integer
        - type: array
      description: filter value. It is required to be string, array, integer or number.
      example: "Main_hall_camera"

    face_user_data:
      type: string
      maxLength: 128
      description: user data associated with face
      example: "face of person"
      default: ""

    event_user_data:
      type: string
      maxLength: 128
      description: user data associated with event
      example: "save event"
      default: ""

    list_user_data:
      type: string
      maxLength: 128
      description: user data associated with list
      example: "list of good persons"
      default: ""

    target:
      type: object
      description: an event field and corresponding function-aggregator for statistic selection
      properties:
        column:
          $ref: '#/components/schemas/column'
        aggregator:
          $ref: '#/components/schemas/aggregator'
      required: [column , aggregator]
      example:
        column: "age"
        aggregator: "avg"

    targets:
      type: array
      description: |
        You can specify one or several event fields and functions for them for data aggregation.

        The table includes event fields and available functions for them:

        | Field                       | Function   |     |     |     |          |
        |-----------------------------|------------|-----|-----|-----|----------|
        |                             | count      | max | min | avg | group_by |
        | event_id                    | +          | -   | -   | -   | +        |
        | external_id                 | +          | -   | -   | -   | +        |
        | handler_id                  | +          | -   | -   | -   | +        |
        | attribute_id                | +          | -   | -   | -   | +        |
        | source                      | +          | -   | -   | -   | +        |
        | top_similar_face_id         | +          | -   | -   | -   | +        |
        | top_similar_face_list       | +          | -   | -   | -   | +        |
        | create_time                 | +          | +   | +   | -   | -        |
        | top_similar_face_similarity | +          | +   | +   | +   | -        |
        | face_id                     | +          | -   | -   | -   | +        |
        | gender                      | +          | +   | +   | +   | +        |
        | age                         | +          | +   | +   | +   | +        |
        | emotion                     | +          | +   | +   | +   | +        |
        | ethnic_group                | +          | +   | +   | +   | +        |
        | user_data                   | +          | -   | -   | -   | +        |
        | tags                        | +          | +   | +   | -   | -        |

        >Note! There **must** be at least one function different from `group_by` in the `targets`, otherwise an error occurs.

      items:
        $ref: '#/components/schemas/target'
      minItems: 0
      default:
        - {'column': 'event_id', 'aggregator': 'count'}

    filter:
      type: object
      description: filter for sample restriction.
      properties:
        column:
          $ref: '#/components/schemas/column'
        operator:
          $ref: '#/components/schemas/operator_filter'
        value:
          $ref: '#/components/schemas/value_filter'
      required: [column , operator, value]

    filters:
      type: array
      description: |
        specifies filters for events.

        Operators available for each filter:

        | Filter                      | Operator    |         |         |                  |
        |-----------------------------|-------------|---------|---------|------------------|
        |                             | like, nlike | in, nin | eq, neq | gt, gte, lt, lte |
        | tags                        | +           | -       | -       | -                |
        | source                      | -           | +       | +       | -                |
        | user_data                   | -           | +       | +       | -                |
        | event_id                    | -           | +       | +       | +                |
        | external_id                 | -           | +       | +       | +                |
        | handler_id                  | -           | +       | +       | +                |
        | attribute_id                | -           | +       | +       | +                |
        | top_similar_face_id         | -           | +       | +       | +                |
        | top_similar_face_list       | -           | +       | +       | +                |
        | top_similar_face_similarity | -           | -       | -       | +                |
        | face_id                     | -           | +       | +       | +                |
        | gender                      | -           | +       | +       | +                |
        | age                         | -           | +       | +       | +                |
        | emotion                     | -           | +       | +       | +                |
        | ethnic_group                | -           | +       | +       | +                |

      items:
        $ref: '#/components/schemas/filter'
      minItems: 0

    period:
      type: object
      properties:
        operator:
          $ref: '#/components/schemas/operator_period'
        value:
          $ref: '#/components/schemas/value_period'
      required: [operator, value]

    periods:
      type: array
      description: |
        specifies the period of event creation. All the events created during this period will be included in the statistics.

        You can set the start and end of the period or only one of the bounds.

        >**Note!** You can specify **only one** period!
      items:
        $ref: '#/components/schemas/period'
      minItems: 0

    group_by:
      type: string
      description: |
        enables you to group events by creation time according to one of two ways:

        1) Grouping by time intervals - number and dimension

        | The parameter value | Description  |
        |---------------------|--------------|
        | `1m`                | one minute   |
        | `2h`                | two hours    |
        | `7d`                | seven days   |
        | `5w`                | five weeks   |
        | `3M`                | three months |
        | `10y`               | ten years    |

        2) The frequency grouping - one of the following

        | The parameter value | Description        |
        |---------------------|--------------------|
        | `monthOfYear`       | by month of year   |
        | `weekOfYear`        | by week of year    |
        | `dayOfYear`         | by day of year     |
        | `dayOfMonth`        | by day of month    |
        | `dayOfWeek`         | by day of week     |
        | `hourOfDay`         | by hours of day    |
        | `minuteOfHour`      | by minutes of hour |

      example: "dayOfWeek"


    detect_policy:
      type: object
      properties:

        estimate_head_pose:
          $ref: '#/components/schemas/estimate_head_pose'

        estimate_emotions:
          $ref: '#/components/schemas/estimate_emotions'

        estimate_quality:
          $ref: '#/components/schemas/estimate_quality'

        estimate_gaze:
          $ref: '#/components/schemas/estimate_gaze'

        estimate_eyes_attributes:
          $ref: '#/components/schemas/estimate_eyes_attributes'

        estimate_mouth_attributes:
          $ref: '#/components/schemas/estimate_mouth_attributes'

        detect_landmarks68:
          $ref: '#/components/schemas/detect_landmarks68'

        extract_exif:
          $ref: '#/components/schemas/extract_exif'

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

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

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

      description: |
        The policy specifies face detection parameters.

        This policy execution depends on the status of the `warped_image` parameter in the "generate events" request:

        - If `warped_image` is set to "1" and `detect_policy` is not set in the handler, then images are not processed by Detector and are directly saved into Image Store.

        - If `warped_image` is set to "1" and `detect_policy` is specified in the handler, Detector estimates all the properties specified in the handler and does not create new samples.

        - If  `warped_image` is set to "0", then images are processed according to the `detect_policy`, and new samples are created for them.

        > The estimated face properties are not stored in the Events database (except emotion). The properties are only returned in the response.

    detect_policy_required:
      allOf:
        - $ref: '#/components/schemas/detect_policy'
      required: [estimate_head_pose, estimate_emotions, estimate_quality, estimate_gaze,
                 estimate_eyes_attributes, estimate_mouth_attributes, detect_landmarks68, extract_exif]

    extract_policy:
      type: object
      properties:
        extract_basic_attributes:
          $ref: '#/components/schemas/extract_basic_attributes'

        extract_descriptor:
          $ref: '#/components/schemas/extract_descriptor'

        score_threshold:
          $ref: '#/components/schemas/score_threshold'

      description: |
        specifies parameters for the extraction of descriptors and basic attributes.

    extract_policy_required:
      allOf:
        - $ref: '#/components/schemas/extract_policy'
      required: [extract_basic_attributes, extract_descriptor, score_threshold]

    gender_filter:
      type: integer
      enum: [0, 1]
      description: gender. 1 - male, 0 - female.
      example: 1

    age_lt_filter:
      allOf:
        - $ref: '#/components/schemas/age'
      description: upper excluded bound for age.
      example: 30

    age_gte_filter:
      allOf:
        - $ref: '#/components/schemas/age'
      description: lower included bound for age.
      example: 22

    matching_limit:
      type: integer
      minimum: 1
      maximum: 100
      default: 3
      description: The maximum number of match results per candidate's list.

    ethnicity:
      type: integer
      enum: [1, 2, 3, 4]
      example: 1
      description: |
        ethnicity

        | ethnicity   | value |
        |-----------------|---|
        | AfricanAmerican | 1 |
        | Indian          | 2 |
        | Asian           | 3 |
        | Caucasian       | 4 |

    ethnicities_enum:
      example: [4, 3]
      type: array
      items:
        type: integer
        enum: [1, 2, 3, 4]
      minItems: 1
      description: |
        ethnicity

        | ethnicity   | value |
        |-----------------|---|
        | AfricanAmerican | 1 |
        | Indian          | 2 |
        | Asian           | 3 |
        | Caucasian       | 4 |

    emotion_enum:
      description: |
        predominant emotion.

        | emotions    | value |
        |-----------------|---|
        | anger           | 1 |
        | disgust         | 2 |
        | fear            | 3 |
        | happiness       | 4 |
        | neutral         | 5 |
        | sadness         | 6 |
        | surprise        | 7 |

      type: integer
      enum: [1, 2, 3, 4, 5, 6, 7]

    emotions_map:
      type: array
      description: list of emotion
      items:
        $ref: '#/components/schemas/emotion_enum'

    match_filter:
      type: object
      properties:
        list_id:
          allOf:
            - $ref: '#/components/schemas/list_id'
          description: ID of the luna list, which was used for matching.
        similarity__lte:
          type: number
          maximum: 1
          minimum: 0
          example: 0.90
          description: upper included bound  for the best match by the list.
        similarity__gte:
          type: number
          maximum: 1
          minimum: 0
          example: 0.78
          description: lower included bound for the best match by the list.
      required: [list_id]

    match_lists_policy:
      type: array
      items:
        type: object
        properties:
          list_id:
            allOf:
              - $ref: '#/components/schemas/list_id'
            description: ID of the list for matching.
          filters:
            type: object
            properties:
              gender:
                $ref: '#/components/schemas/gender_filter'
              ethnicities:
                $ref: '#/components/schemas/ethnicities_enum'
              age__lt:
                $ref: '#/components/schemas/age_lt_filter'
              age__gte:
                $ref: '#/components/schemas/age_gte_filter'
            description: filters for matching are based on the results of the extraction.
          limit:
            $ref: '#/components/schemas/matching_limit'
        required: [list_id]
      minItems: 0
      description: |
        this policy enables you to match the received events with the faces from the specified lists. You can specify several lists with filters.
        The event descriptor is matched with descriptors from the specified list.
        The event must have a successfully extracted descriptor to be matched using this policy. If an event does not satisfy the list filters or has no descriptor, the event is not matched.
    create_face_policy:
      type: object
      description: |
        the policy specifies filters for new face creation. You can specify filters by age, gender, and ethnicity as well as filters by matching results.

        The `extract_basic_attributes` parameter in the `extraction_policy` must be enabled for filtration by basic attributes.

        Matching results must be received in the `match_policy` to use the `match` section of the filters.
      properties:
        filters:
          allOf:
          - $ref: '#/components/schemas/post_filters'
          description: filters determine whether to create face or not.
        create_faces:
          allOf:
          - $ref: '#/components/schemas/int01_def0'
          description: whether to create faces from events.
          default: 0
        set_sample_as_avatar:
          allOf:
          - $ref: '#/components/schemas/int01'
          - description: whether to set a sample as an avatar for created faces. The avatar can be used for visual representation in the user interface.
          - default: 1

    create_face_policy_required:
      allOf:
        - $ref: '#/components/schemas/create_face_policy'
      required: [create_faces, set_sample_as_avatar, filters]

    link_to_lists_policy:
      type: array
      items:
        type: object
        properties:
          list_id:
            $ref: '#/components/schemas/list_id'
          filters:
            allOf:
            - $ref: '#/components/schemas/post_filters'
            description: filters determine whether to link the created face to the list.
        required: [list_id]

      minItems: 0
      description: |
        the policy specifies filters for linking of the created faces to specified lists. You can specify filters by age, gender, and ethnicity as well as filters by matching results.

        The `extract_basic_attributes` parameter in the `extraction_policy` must be enabled for filtration by basic attributes.

        Matching results must be received in the `match_policy` to use the `match` section of the filters.

    link_to_lists_policy_required:
      type: array
      items:
        type: object
        properties:
          list_id:
            $ref: '#/components/schemas/list_id'
          filters:
            allOf:
            - $ref: '#/components/schemas/post_filters'
            description: filters determine whether to link created face to the list.
        required: [list_id, filters]
      minItems: 0
      description: a set of luna lists for linking of created faces.

    int_version:
      type: integer
      minimum: 0

    base_version_schema:
      type: object
      properties:
        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: [major, minor, patch]
      example:
        major: 1
        minor: 3
        patch: 2

    version:
      allOf:
        - $ref: '#/components/schemas/base_version_schema'
      properties:
        api:
          allOf:
            - $ref: '#/components/schemas/int_version'
          description: an api version of service.
      required: [api, major, minor, patch]
      example:
        api: 1
        major: 0
        minor: 0
        patch: 0


    New_Face:
      type: object
      properties:
        external_id:
          $ref: '#/components/schemas/face_external_id'
        attribute_id:
          $ref: '#/components/schemas/attribute_id'
        user_data:
          $ref: '#/components/schemas/face_user_data'
        avatar:
          $ref: '#/components/schemas/avatar'
        lists:
          type: array
          items:
            $ref: '#/components/schemas/list_id'
          minItems: 1
          description: luna lists for linking face with them.
        event_id:
          allOf:
          - $ref: '#/components/schemas/event_id'
          description: the event ID associated with the face creation.
          nullable: true
      example:
        external_id: 2xQ2gprbMUePw1s9gw9fvA==
        attribute_id: 'b668c4a5-2191-476e-a261-3b4f9ce2e25e'
        user_data: some_string
        avatar: 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Abbey_Lee_2015.jpg/800px-Abbey_Lee_2015.jpg'
        lists: ['234fc28c-a767-42fc-a0c2-e01ad00b5c59', 'c2a09aff-0116-41cf-a7c7-91631d40d0c2']

    Update_Face:
      type: object
      properties:
        external_id:
          description: user-defined external ID for the face.
          type: string
          maxLength: 36
        attribute_id:
          allOf:
          - $ref: '#/components/schemas/attribute_id'
          description: the attribute ID associated with the face.
        event_id:
          allOf:
            - $ref: '#/components/schemas/event_id'
          description: the event ID associated with the face creation.
          nullable: true
        user_data:
          description: user-defined data for the face.
          type: string
          maxLength: 36
        avatar:
          $ref: '#/components/schemas/avatar'
      example:
        external_id: 2xQ2gprbMUePw1s9gw9fvA==
        attribute_id: 'b668c4a5-2191-476e-a261-3b4f9ce2e25e'
        user_data: some_string
        avatar: 'https://upload.wikimedia.org/wikipedia/commons/7/7f/Emma_Watson_2013.jpg'

    Face:
      type: object
      properties:
        face_id:
          $ref: '#/components/schemas/face_id'
        external_id:
          $ref: '#/components/schemas/face_external_id'
        attribute_id:
          allOf:
            - $ref: '#/components/schemas/attribute_id'
          description: the attribute ID equals "00000000-0000-4000-a000-000000000000" cause LUNA do not associate face with attribute ID from now.
        user_data:
          $ref: '#/components/schemas/face_user_data'
        create_time:
          allOf:
            - $ref: "#/components/schemas/time"
          description: time of the face creation.
        avatar:
          $ref: '#/components/schemas/avatar'
        lists:
          type: array
          items:
            $ref: '#/components/schemas/list_id'
          description: list of luna lists, which contain the face.
        event_id:
          allOf:
            - $ref: '#/components/schemas/event_id'
          nullable: true
          description: the event ID associated with the face creation.
      example:
        face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
        external_id: 2xQ2gprbMUePw1s9gw9fvA==
        attribute_id: 'b668c4a5-2191-476e-a261-3b4f9ce2e25e'
        user_data: fox1991
        create_time: "2018-08-11T09:11:41.674Z"
        lists: ["429b0e78-4616-426a-b57f-02baa72d638d", '6d037c33-31ec-4d73-b3b3-ec80b09446c2']
        avatar: 'https://st.kp.yandex.net/images/actor_iphone/iphone360_460188.jpg'
        event_id: f9687459-986b-406d-9c1f-0d6289be5256

    Link:
      type: object
      properties:
        action:
          type: string
          enum:
          - attach
          - detach
          description: expected action with list and faces.
        face_ids:
          type: array
          items:
            $ref: '#/components/schemas/face_id'
          minItems: 1
          description: faces to attach or detach to/from list.
      required: [action, face_ids]

    basic_attributes:
      type: object
      properties:
        gender:
          allOf:
            - $ref: '#/components/schemas/gender'
          nullable: true
        age:
          allOf:
            - $ref: '#/components/schemas/int0100'
          description: detected age
          nullable: true
        ethnicity:
          allOf:
            - $ref: '#/components/schemas/ethnicity'
          nullable: true
      required: [age, gender, ethnicity]

    attributes_with_basic_attributes:
      type: object
      properties:
        create_time:
          description: time of the attribute creation
          type: string
          format: date-time
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
      required: [create_time, basic_attributes]

    Attributes:
      type: object
      properties:
        attribute_id:
          allOf:
            - $ref: '#/components/schemas/attribute_id'
          description: the attribute ID equals "00000000-0000-4000-a000-000000000000" cause LUNA do not associate face with attribute ID from now.
          nullable: true
        gender:
          allOf:
          - $ref: '#/components/schemas/gender'
          nullable: true
        age:
          allOf:
            - $ref: '#/components/schemas/int0100'
          description: detected age
          nullable: true
        ethnicity:
          allOf:
          - $ref: '#/components/schemas/ethnicity'
          nullable: true
        create_time:
          description: time of the attribute creation
          type: string
          format: date-time
          nullable: true
      required: [attribute_id, create_time, age, gender, ethnicity]
      example:
        age: 20
        gender: 1
        ethnic_group: 2
        create_time: "2018-08-11T09:08:29.414Z"
        attribute_id: "00000000-0000-4000-a000-000000000000"

    New_List:
      type: object
      properties:
        user_data:
          $ref: '#/components/schemas/list_user_data'
      required:
      - user_data

    List:
      type: object
      properties:
        list_id:
          allOf:
          - $ref: '#/components/schemas/list_id'
          readOnly: true
        user_data:
          $ref: '#/components/schemas/list_user_data'
        create_time:
          type: string
          format: date-time
          readOnly: true
          description: list creation time.
        last_update_time:
          type: string
          format: date-time
          readOnly: true
          description: list update time (face was attached or detached, user_data was changed).
      required:
      - list_id
      - user_data
      - create_time
      - last_update_time
      example:
        list_id: c004aae2-f191-4a1a-9d2a-e5894f8cecbf
        user_data: good guys
        create_time: 2018-08-11T09:11:41.674Z
        last_update_time: 2018-08-11T09:11:41.674Z

    post_filters:
      type: object
      properties:
        gender:
          $ref: '#/components/schemas/gender_filter'
        ethnicities:
          $ref: '#/components/schemas/ethnicities_enum'
        age__lt:
          $ref: '#/components/schemas/age_lt_filter'
        age__gte:
          $ref: '#/components/schemas/age_gte_filter'
        match:
          type: array
          items:
            $ref: '#/components/schemas/match_filter'
          minItems: 0
          description: |
            filtering using matching results, received in the match_policy.

            If there are no matching results for any event, the event is skipped.

            You can specify several lists with similarity boundaries. All the events with similarity within the specified boundaries are processed by the policy.
    Policies:
      type: object
      description: the set of rules, which determine input images processing.
      properties:
        detect_policy:
          allOf:
          - $ref: '#/components/schemas/detect_policy'
          description: face detection policy.
        multiface_policy:
          allOf:
          - $ref: '#/components/schemas/int01'
          default: 1
          description: whether to process images with several faces.
        extract_policy:
          allOf:
            - $ref: '#/components/schemas/extract_policy'
          description: extract attributes policy.
        match_policy:
          $ref: '#/components/schemas/match_lists_policy'
        create_face_policy:
          allOf:
            - $ref: '#/components/schemas/create_face_policy'
          description: whether to create faces.
        link_to_lists_policy:
          $ref: '#/components/schemas/link_to_lists_policy'
      nullable: true

    PoliciesWithRequired:
      type: object
      description: a set of rules, which determine input images processing. Empty policies refer to dynamic handler.
      properties:
        detect_policy:
          allOf:
          - $ref: '#/components/schemas/detect_policy_required'
          description: face detection policy.
        multiface_policy:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: |
              whether to process images with several faces. If the value is set to "0", images with several faces are skipped.
          default: 1
        extract_policy:
          $ref: '#/components/schemas/extract_policy_required'
        match_policy:
          $ref: '#/components/schemas/match_lists_policy'
        create_face_policy:
          $ref: '#/components/schemas/create_face_policy_required'
        link_to_lists_policy:
          $ref: '#/components/schemas/link_to_lists_policy_required'
      required: [detect_policy, extract_policy, match_policy, create_face_policy, link_to_lists_policy, multiface_policy]

    New_Handler:
      type: object
      properties:
        description:
          type: string
          maxLength: 128
          description: |
            description of the handler.

            Use it to distinguish the handler from other created handlers and filter handlers using corresponding requests.
          example: Handler example
        policies:
          $ref: '#/components/schemas/Policies'
        create_time:
          type: string
          format: date-time
          readOnly: true
          description: the handler creation time.
        last_update_time:
          type: string
          format: date-time
          readOnly: true
          description: the handler last update time.
      required: [policies, description, create_time, last_update_time]

    HandlerWithRequiredPolicies:
      type: object
      properties:
        handler_id:
          allOf:
          - $ref: '#/components/schemas/handler_id'
          description: handler ID.
          readOnly: true
        description:
          type: string
          maxLength: 128
          description: user description.
        policies:
          $ref: '#/components/schemas/PoliciesWithRequired'
        create_time:
          type: string
          format: date-time
          readOnly: true
          description: the handler creation time.
        last_update_time:
          type: string
          format: date-time
          readOnly: true
          description: the handler last update time.
      required: [policies, handler_id, description, create_time, last_update_time]

    EventFromHandler:
      type: object
      description: event format from handler.
      properties:
        samples:
          type: array
          minItems: 1
          description: list of samples associated with the event.
          items:
            $ref: '#/components/schemas/sample_id'
        attributes:
          allOf:
          - $ref: '#/components/schemas/AttributeWithFilter'
          description: attributes extracted from samples.
        source:
          type: string
          description: additional information that the user provided with the event.
          nullable: true
          example: "Main_hall_camera"
        tags:
          description: tag array.
          type: array
          items:
            $ref: '#/components/schemas/tag'
          example: ['tag1', 'tag2']
          nullable: true
        external_id:
          $ref: '#/components/schemas/event_external_id'
        user_data:
          $ref: '#/components/schemas/event_user_data'
        face:
          nullable: true
          type: object
          properties:
            face_id:
              $ref: '#/components/schemas/face_id'
            external_id:
              $ref: '#/components/schemas/face_external_id'
            event_id:
              allOf:
                - $ref: '#/components/schemas/event_id'
              nullable: true
            user_data:
              $ref: '#/components/schemas/face_user_data'
            avatar:
              type: string
              format: uri-reference
              description: avatar for the face, references to a sample or a user-defined reference.
              nullable: true
            lists:
              type: array
              items:
                $ref: '#/components/schemas/list_id'
              description: list of luna lists, which contains the face.
              nullable: true
            url:
              type: string
              format: uri-reference
              description: location of face.
          required: [lists, avatar, user_data, external_id, face_id, url]
        event_id:
          allOf:
          - $ref: '#/components/schemas/event_id'
          description: Event ID.
        url:
          type: string
          format: uri-reference
          example: /0/events/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
          description: location of event.
        matches:
          allOf:
            - $ref: '#/components/schemas/Matches'
          description: sorted list with match results for the event.
          nullable: true
      required: [matches, url, event_id, face, tags, source, attributes, samples]

    Source:
      description: additional information that the user provided with the event.
      type: string
      maxLength: 128
      example: "Main_hall_camera"

    Tags:
      description: tag array.
      type: array
      items:
        type: string
      example: ['tag1', 'tag2']

    Event:
      type: object
      description: event.
      properties:
        create_time:
          allOf:
            - $ref: "#/components/schemas/time"
          description: time of the event creation.
        event_id:
          $ref: '#/components/schemas/event_id'
        handler_id:
          allOf:
            - $ref: '#/components/schemas/handler_id'
          description: ID of the handler, which gave birth to the event.
        attribute_id:
          allOf:
            - $ref: '#/components/schemas/attribute_id'
          nullable: true
        external_id:
          $ref: '#/components/schemas/event_external_id'
        source:
          allOf:
            - $ref: '#/components/schemas/Source'
          nullable: true
        top_similar_face_id:
          allOf:
            - $ref: '#/components/schemas/face_id'
          nullable: true
          description: most similar face ID.
        top_similar_face_list:
          allOf:
            - $ref: '#/components/schemas/list_id'
          nullable: true
          description: the list that contains the most similar face.
        top_similar_face_similarity:
          nullable: true
          description: similarity to the most similar face.
          type: number
          example: 0.7
        match_result:
          description: object that contains match result.
          type: array
          nullable: true
          items:
            type: object
            properties:
              list_id:
                $ref: '#/components/schemas/list_id'
              candidates:
                type: array
                items:
                  type: object
                  properties:
                    similarity:
                      type: number
                      minimum: 0
                      maximum: 1
                    face:
                      type: object
                      properties:
                        face_id:
                          $ref: '#/components/schemas/face_id'
                        external_id:
                          $ref: '#/components/schemas/face_external_id'
                        attribute_id:
                          allOf:
                            - $ref: '#/components/schemas/attribute_id'
                          description: attributes associated with the face.
                        user_data:
                          $ref: '#/components/schemas/face_user_data'
                        create_time:
                          allOf:
                            - $ref: "#/components/schemas/time"
                          description: time of the face creation.
        extract_result:
          description: Extract result. List of all detection and corresponding sample IDs
          type: array
          nullable: true
          items:
            type: object
            properties:
              sample_id:
                $ref: '#/components/schemas/sample_id'
              detection:
                type: object
                description: detection
                properties:
                  rect:
                    type: object
                    description: detection rectangle
                    properties:
                      x:
                        type: integer
                        nullable: true
                        description: detection rectangle x coordinate
                      y:
                        type: integer
                        nullable: true
                        description: detection rectangle y coordinate
                      width:
                        type: integer
                        nullable: true
                        description: detection rectangle width
                      height:
                        type: integer
                        nullable: true
                        description: detection rectangle height
                    required: [x, y, width, height]
                required: [rect]
            required: [sample_id]
        face_id:
          allOf:
            - $ref: '#/components/schemas/face_id'
          nullable: true
        attach_result:
          description: contains attached lists IDs.
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/list_id'
            nullable: true
        gender:
          allOf:
          - $ref: '#/components/schemas/gender'
          nullable: true
        age:
          description: Age.
          type: integer
          nullable: true
          maximum: 100
          minimum: 0
        emotion:
          allOf:
          - $ref: '#/components/schemas/emotion_enum'
          nullable: true
        ethnic_group:
          allOf:
            - $ref: '#/components/schemas/ethnicity'
          nullable: true
        tags:
          allOf:
            - $ref: '#/components/schemas/Tags'
          nullable: true
        user_data:
          $ref: '#/components/schemas/event_user_data'

    Events:
      type: array
      items:
        $ref: '#/components/schemas/Event'

    EventsWithCount:
      type: object
      properties:
        total:
          $ref: '#/components/schemas/count'
        events:
          $ref: '#/components/schemas/Events'

    getEventStats:
      type: object
      properties:
        targets:
          $ref: '#/components/schemas/targets'
        filters:
          $ref: '#/components/schemas/filters'
        period:
          $ref: '#/components/schemas/periods'
        group_by:
          $ref: '#/components/schemas/group_by'


    emotions_estimations:
      type: object
      properties:
        anger:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: anger probability.
        disgust:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: disgust probability.
        fear:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: fear probability.
        happiness:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: happiness probability.
        neutral:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: neutral face probability.
        sadness:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: sadness probability.
        surprise:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: surprise probability.
      required: [surprise, sadness, neutral, happiness, fear, disgust, anger]
      description: emotion classifier response.

    emotions:
      type: object
      properties:
        estimations:
          allOf:
          - $ref: '#/components/schemas/emotions_estimations'
          description: emotion classifier response.
        predominant_emotion:
          type: string
          description: name of predominant emotion.
          enum: [surprise, sadness, neutral, happiness, fear, disgust, anger]
      required: [estimations, predominant_emotion]

    landmark:
      type: array
      items:
        type: integer
      description: |
        key point coordinates. First element is `x` coordinate, second is `y`.
      minItems: 2
      maxItems: 2
      example: [12, 13]

    landmarks5:
      type: array
      items:
        $ref: '#/components/schemas/landmark'
      description: array of 5 landmarks.
      minItems: 5
      maxItems: 5
      example:
      - - 23
        - 72
      - - 82
        - 71
      - - 42
        - 114
      - - 29
        - 140
      - - 79
        - 138

    landmarks68:
      description: array of 68 landmarks.
      type: array
      items:
        $ref: '#/components/schemas/landmark'
      minItems: 68
      maxItems: 68

    landmarks32:
      description: array of 32 landmarks.
      type: array
      items:
        $ref: '#/components/schemas/landmark'
      minItems: 32
      maxItems: 32

    mouth_attributes:
      description: mouth attributes.
      type: object
      properties:
        score:
          type: number
          maximum: 1
          minimum: 0
          description: mouth detection confidence.
        smile:
          type: number
          maximum: 1
          minimum: 0
          description: smile probability.
        occluded:
          type: number
          maximum: 1
          minimum: 0
          description: occlusion probability.
      required: [score, smile, occluded]

    eye_attributes:
      description: eye attributes.
      type: object
      properties:
        state:
          type: string
          enum: [open, closed, occluded]
          description: eye state.
        iris_landmarks:
          allOf:
          - $ref: '#/components/schemas/landmarks32'
          description: iris landmarks.
      required: [state, iris_landmarks]

    eyes_attributes:
      description: eyes attributes.
      type: object
      properties:
        left_eye:
          allOf:
          - $ref: '#/components/schemas/eye_attributes'
          description: left eye attributes.
        right_eye:
          allOf:
          - $ref: '#/components/schemas/eye_attributes'
          description: right eye attributes.
      required: [left_eye, right_eye]

    head_pose:
      description: head pose.
      type: object
      properties:
        yaw:
          type: number
          description: yaw angle in degrees.
        pitch:
          type: number
          description: pitch angle in degrees.
        roll:
          type: number
          description: roll angle in degrees.
      required: [yaw, pitch, roll]

    eye_gaze:
      type: object
      properties:
        yaw:
          type: number
          description: yaw angle in degrees.
        pitch:
          type: number
          description: pitch angle in degrees.
      required: [yaw, pitch]

    gaze:
      description: gaze direction.
      type: object
      properties:
        left_eye:
          allOf:
          - $ref: '#/components/schemas/eye_gaze'
          description: left eye estimation.
        right_eye:
          allOf:
          - $ref: '#/components/schemas/eye_gaze'
          description: right eye estimation.
      required: [left_eye, right_eye]

    attributes:
      description: face attributes.
      type: object
      properties:
        mouth_attributes:
          allOf:
          - $ref: '#/components/schemas/mouth_attributes'
          description: optional mouth attributes.
        eyes_attributes:
          allOf:
          - $ref: '#/components/schemas/eyes_attributes'
          description: optional eye attributes.
        emotions:
          allOf:
          - $ref: '#/components/schemas/emotions'
          description: face emotions estimation.
        head_pose:
          allOf:
          - $ref: '#/components/schemas/head_pose'
          description: head pose estimation.
        gaze:
          allOf:
          - $ref: '#/components/schemas/gaze'
          description: gaze estimation.
      example:
        mouth_attributes:
          occluded: 0.0
          score: 0.999999165534973
          smile: 0.0
        emotions:
          estimations:
            anger: 0.00894705578684807
            disgust: 0.00000965219624049496
            fear: 0.00121302821207792
            happiness: 0.00129503419157118
            neutral: 0.986027479171753
            sadness: 0.00187553185969591
            surprise: 0.000632198702078313
          predominant_emotion: "neutral"
        head_pose:
          pitch: 18.6827487945557
          roll: -10.3542232513428
          yaw: 15.4102487564087
        gaze:
          left_eye:
            pitch: 9.26744079589844
            yaw: -19.4657287597656
          right_eye:
            pitch: 10.7074518203735
            yaw: -14.6733160018921

    rect:
      description: bounding rectangle.
      type: object
      properties:
        height:
          type: integer
          description: rectangle height.
          example: 200
        width:
          type: integer
          description: rectangle width.
          example: 100
        x:
          type: integer
          description: top left corner "x" coordinate.
          example: 17
        y:
          type: integer
          description: top left corner "y" coordinate.
          example: 10
      required: [height, width, x, y]
      example:
        height: 240
        width: 209
        x: 170
        y: 198

    quality:
      description: |
        image quality. Estimation of image visual properties.
      type: object
      properties:
        dark:
          type: number
          description: low value means underlit face area (i.e. due to backlight, poor lighting, sensor underexposure).
          maximum: 1
          minimum: 0
        light:
          type: number
          description: low value means overexposed face area (i.e. overbright lighting, sensor overexposure).
          maximum: 1
          minimum: 0
        saturation:
          type: number
          description: low value means low saturation (e.g. grayscale images).
          maximum: 1
          minimum: 0
        blurriness:
          type: number
          description: low value means blurred image (e.g. due to depth of field or motion blur). High value means sharp image.
          maximum: 1
          minimum: 0
      required: [blurriness, saturation, light, dark]
      example:
        light: 0.87
        dark: 0.13
        saturation: 0.93
        blurriness: 0.2

    warped_image:
      type: integer
      default: 0
      enum:
      - 0
      - 1

    detector_filter:
      type: object
      properties:
        is_filtered:
          type: boolean
          description: true if sample is filtered by a threshold otherwise false.
        filter_reason:
          type: array
          description: list with an informaion why sample is filtered
          items:
            type: object
            properties:
              filter_name:
                type: string
                enum: ['pitch_threshold', 'roll_threshold', 'yaw_threshold', 'score_threshold']
                description: |
                  filter name.  Available values depend on the resource:

                    - for the "detect faces" request the following values are available: 'pitch_threshold', 'roll_threshold',
                    'yaw_threshold',

                    - for the "generate events" request all the values are available.
              object_value:
                example: 67
                type: number
                description: estimate value
              threshold_value:
                example: 40
                type: number
                description: threshold value
          required:
          - filter_name
          - object_value
          - threshold_value

    extractor_filter:
      type: object
      properties:
        is_filtered:
          type: boolean
          description: true if sample is filtered by a threshold otherwise false
        filter_reason:
          type: array
          items:
            type: object
            properties:
              filter_name:
                type: string
                enum: ['score_threshold']
                description: filter name
              object_value:
                example: 0.75
                type: number
                description: estimated parameter value
              threshold_value:
                example: 0.8
                type: number
                description: current threshold value
            required:
            - filter_name
            - object_value
            - threshold_value
      description: extractor filters

    FaceDetection:
      type: object
      description: face detection
      properties:
        attributes:
          allOf:
          - $ref: '#/components/schemas/attributes'
          description: face attributes estimation.
        quality:
          allOf:
          - $ref: '#/components/schemas/quality'
          description: image quality estimation for this face detection region.
        rect:
          allOf:
          - $ref: '#/components/schemas/rect'
          description: face detection bounding box.
        landmarks5:
          allOf:
          - $ref: '#/components/schemas/landmarks5'
          description: facial landmarks.
        landmarks68:
          allOf:
          - $ref: '#/components/schemas/landmarks68'
          description: facial landmarks.

    FaceDetectionWithFilter:
      allOf:
        - $ref: '#/components/schemas/FaceDetection'
      properties:
        filter:
          allOf:
            - $ref: '#/components/schemas/detector_filter'
          description: filtering result

    exif:
      description: |
        select image EXIF tags.
        See [CIPA DC-008-2016]( http://www.cipa.jp/std/documents/e/DC-008-Translation-2016-E.pdf) for details.
        Tag to string conversions is handled by libEXIF.
      type: object
      properties:
        make:
          type: string
          description: make tag (IFD0 0x010f).
        model:
          type: string
          description: model tag (IFD0 0x0110).
        artist:
          type: string
          description: artist tag (IFD0 0x013b).
        software:
          type: string
          description: software tag (IFD0 0x0131).
        flash:
          type: string
          description: flash tag (IFD_EXIF 0x9209).
        gps:
          type: object
          description: gps tag (IFD_EXIF 0x8825).
          properties:
            latitude:
              type: string
              description: |
                GPS latitude (IFD GPS).

                Combined latitude ref (0x0001) + latitude (0x0002).
            longitude:
              type: string
              description: |
                GPS longitude (IFD GPS).

                Combined longitude ref (0x0003) + longitude (0x0004).
          required: [latitude, longitude]
        orientation:
          type: integer
          description: orientation (IFD0 0x0112).
      example:
        artist: "Photomaker Vadim"
        model: "Canon PX-200"
        software: "Adobe Photoshop CS5 Macintosh"

    Detections:
      type: array
      items:
        type: object
        description: face detection sample
        properties:
          sample_id:
            $ref: '#/components/schemas/sample_id'
          detection:
            $ref: '#/components/schemas/FaceDetectionWithFilter'
          url:
            type: string
            description: detection url
            format: uri-reference
            example: "/0/samples/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c"
        required:
        - detection

    Detected_images:
      type: object
      properties:
        failed_images:
          type: array
          items:
            type: object
            properties:
              error:
                $ref: '#/components/schemas/Error'
              filename:
                type: string
                example: "penelope.jpeg"
                description: |
                  source image file name (preserved only for multipart-form-data requests, otherwise "Raw Image")
            required:
            - error
            - filename
          example:
            error:
              desc: Failed to decode image data
              detail: Failed to decodeImage image data.
              error_code: 3001
            filename: n.jpg
          description: list of images which is failed processing
        succeeded_images:
          type: array
          items:
            type: object
            properties:
              samples:
                $ref: '#/components/schemas/Detections'
              filename:
                type: string
                example: "claudia.jpg"
                description: |
                  source image file name (preserved only for multipart-form-data requests, otherwise "Raw Image")
              exif:
                $ref: '#/components/schemas/exif'
            required:
            - samples
            - filename
          description: list of succeeded processing images. It doesn’t mean that anything face found
      required:
      - succeeded_images
      - failed_images

    ethnicities_estimations:
      type: object
      description: ethnicity classifier response.
      properties:
        asian:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Asian ethnicity probability.
        indian:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Indian ethnicity probability.
        caucasian:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Caucasian ethnicity probability.
        african_american:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: African American ethnicity probability.
      required: [african_american, caucasian, indian, asian]

    ethnicities:
      description: estimated ethnicities.
      type: object
      properties:
        estimations:
          allOf:
            - $ref: '#/components/schemas/ethnicities_estimations'
          description: ethnicity classifier response.
        predominant_ethnicity:
          type: string
          description: name of predominant ethnicity.
      required: [estimations, predominant_ethnicity]
      example:
        estimations:
          african_american: 1.92238889737406e-12
          asian: 0.954671621322632
          caucasian: 0.045328326523304
          indian: 7.65100649502415e-10
        predominant_ethnicity: "asian"

    Attribute:
      type: object
      properties:
        attribute_id:
          allOf:
            - $ref: '#/components/schemas/attribute_id'
          description: attribute ID. The value is set to null if the descriptor score is lower than the score threshold.
          nullable: true
        basic_attributes:
          type: object
          properties:
            age:
              $ref: '#/components/schemas/age'
            gender:
              $ref: '#/components/schemas/gender'
            ethnicities:
              $ref: '#/components/schemas/ethnicities'
          required: [age, gender, ethnicities]
        score:
          type: number
          minimum: 0
          maximum: 1
          description: face descriptor quality score.
        url:
          type: string
          format: uri-reference
          nullable: true
          example: /5/attributes/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
          description: location of attribute. The value is set to null if the descriptor score is lower than the score threshold.
        samples:
          type: array
          items:
            $ref: '#/components/schemas/sample_id'
          example: ['a3e8716f-70dc-42ad-8428-7a552e800a37']
          description: resources for attributes.
      required: [attribute_id, url, samples]

    AttributeWithFilter:
      allOf:
        - $ref: '#/components/schemas/Attribute'
      properties:
        filter:
          $ref: '#/components/schemas/extractor_filter'
      required: [attribute_id, url, samples]

    Extracted_Attributes:
      type: array
      items:
        $ref: '#/components/schemas/AttributeWithFilter'

    Face_Reference:
      type: object
      description: face ID as reference for matching
      properties:
        type:
          enum:
          - face
          description: type of reference (face)
        id:
          $ref: '#/components/schemas/face_id'
      required:
      - id
      - type
      example:
        type: "face"
        id: "9c27cb6f-b0c6-43ea-a0e7-b21c7dbd698a"

    Event_Reference:
      type: object
      description: event ID as reference for matching
      properties:
        type:
          enum:
            - event
          description: type of reference (event)
        id:
          $ref: '#/components/schemas/event_id'
      required:
      - id
      - type

    Attribute_Reference:
      type: object
      description: attribute id as reference for matching
      properties:
        type:
          enum:
          - attribute
          description: type of reference (attribute)
        id:
          $ref: '#/components/schemas/attribute_id'
      required:
      - id
      - type

    External_Face_Reference:
      type: object
      description: external face ID as reference for matching
      properties:
        type:
          enum:
            - face_external_id
          description: type of reference (external id)
        id:
          $ref: '#/components/schemas/face_external_id'
      required:
      - id
      - type

    Match_body:
      type: object
      properties:
        candidates:
          type: object
          properties:
            type:
              type: string
              enum: ["lists", "faces"]
              description: resource candidates type. Faces or lists of faces.
            ids:
              type: array
              items:
                $ref: '#/components/schemas/list_id'
              description: list of candidate IDs.
              minItems: 1
              maxItems: 30
          required:
          - ids
          - type
          description: candidates for matching. You can specify the array of face IDs or the array of lists.

        references:
          type: array
          items:
            oneOf:
            - $ref: '#/components/schemas/Face_Reference'
            - $ref: '#/components/schemas/Event_Reference'
            - $ref: '#/components/schemas/Attribute_Reference'
            - $ref: '#/components/schemas/External_Face_Reference'

          description: |
            references for matching. Each reference is matched with all the given candidates. You can specify one or several references of one or several types.
          minItems: 1
          maxItems: 30
      required:
      - references
      - candidates

      example:
        candidates:
          type: "faces"
          ids: ["3772ea92-1198-40ea-8bae-fe912505a379", "557d54ec-29ad-4f3c-93b4-c9092ef12515"]
        references:
          - type: "attribute"
            id: "ef10bb7d-11b3-40b3-b4b0-c996a5f38150"
          - type: "attribute"
            id: "4aca35cf-a3b2-4f77-8d8b-5496a2782d37"
          - type: "face"
            id: "35229c93-85f8-44f3-ab30-3248d7051af9"
          - type: "face_external_id"
            id: "9dd0000-ff99093-1111"
          - type: "event"
            id: "5d56ff7a-be2b-497a-bb73-9099d1ba72ca"

    Candidate_Match_Result:
      type: object
      properties:
        similarity:
          type: number
          minimum: 0
          maximum: 1
        face:
          $ref: '#/components/schemas/Face'
      description: sorted list with match result for the *reference_id* and a luna list or a list of faces.
      required: [similarity, face]

    Matches:
      type: array
      items:
        type: object
        properties:
          candidates:
            type: array
            items:
              $ref: '#/components/schemas/Candidate_Match_Result'
            description: a top similar faces from a luna list or a list of faces.
          list_info:
            type: object
            description: luna list that contains candidates
            properties:
              list_id:
                allOf:
                  - $ref: '#/components/schemas/list_id'
                description: ID of the luna list that contains candidates.
              user_data:
                allOf:
                  - $ref: '#/components/schemas/list_user_data'
                example: "bad guys"
                description: |
                  user data associated with the list. Service cache this value and refresh every 5 minutes for
                  matching process acceleration
            required:
              - list_id
              - user_data
            nullable: true
        required:
        - candidates
        - list_info

    Match_result:
      type: object
      description: |
        match result. If reference count is equal to *n* and candidate list count is equal to *m*, than expected match
        match result count should be equal *mn* (success and fails).
      properties:
        succeeded_matches:
          type: array
          items:
            type: object
            properties:
              reference_id:
                type: string
                description: reference ID.
              face_id:
                allOf:
                  - $ref: '#/components/schemas/uuid4'
                description: face ID, which corresponds to the external ID set as a reference.
              matches:
                allOf:
                  - $ref: '#/components/schemas/Matches'
                description: sorted list with match result for the *reference_id*.
            required: [reference_id, matches]
          description: list of succeeded matches

        failed_matches:
          type: array
          items:
            type: object
            properties:
              reference_id:
                allOf:
                - $ref: '#/components/schemas/uuid4'
                description: reference ID.
              error:
                $ref: '#/components/schemas/Error'
          description: |
            list of failed matches.

            > **WARNING**: if some reference does not exist corresponding error will be duplicate for every
              candidates list

      example:

      - succeeded_matches:
        - reference_id: ef10bb7d-11b3-40b3-b4b0-c996a5f38150
          matches:
          - candidates:
            - similarity: 0.9
              face:
                face_id: 3772ea92-1198-40ea-8bae-fe912505a379
                external_id: 2xQ2gprbMUePw1s9gw9fvA==
                attribute_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
                user_data: some_string
                create_time: '2019-11-11T09:11:41.674Z'
                avatar: '/5/samples/92ba3457-71b5-4744-b94a-2beb37db7d94'
            list_info:
              list_id: 8591e883-b5af-4ebd-a67c-5e9d4b0c474b
              user_data: customers
        - reference_id: 4aca35cf-a3b2-4f77-8d8b-5496a2782d37
          matches:
          - candidates:
            - similarity: 0.234
              face:
                face_id: 3772ea92-1198-40ea-8bae-fe912505a379
                external_id: 2xQ2gprbMUePw1s9gw9fvA==
                attribute_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
                user_data: some_string
                create_time: '2019-11-11T09:11:41.674Z'
                avatar: '/5/samples/92ba3457-71b5-4744-b94a-2beb37db7d94'
            list_info:
              list_id: 8591e883-b5af-4ebd-a67c-5e9d4b0c474b
              user_data: customers
        - reference_id: 35229c93-85f8-44f3-ab30-3248d7051af9
          matches:
          - candidates:
            - similarity: 0.1542
              face:
                face_id: 3772ea92-1198-40ea-8bae-fe912505a379
                external_id: 2xQ2gprbMUePw1s9gw9fvA==
                attribute_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
                user_data: some_string
                create_time: '2019-11-11T09:11:41.674Z'
                avatar: '/5/samples/92ba3457-71b5-4744-b94a-2beb37db7d94'
            list_info:
              list_id: 8591e883-b5af-4ebd-a67c-5e9d4b0c474b
              user_data: customers
        - reference_id: 5d56ff7a-be2b-497a-bb73-9099d1ba72ca
          matches:
          - candidates:
            - similarity: 0.032432
              face:
                face_id: 3772ea92-1198-40ea-8bae-fe912505a379
                external_id: 2xQ2gprbMUePw1s9gw9fvA==
                attribute_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
                user_data: some_string
                create_time: '2019-11-11T09:11:41.674Z'
                avatar: '/5/samples/92ba3457-71b5-4744-b94a-2beb37db7d94'
            list_info:
              list_id: 8591e883-b5af-4ebd-a67c-5e9d4b0c474b
              user_data: customers
        - reference_id: 9dd0000-ff99093-1111
          matches:
          - candidates:
            - similarity: 0.025235
              face:
                face_id: 3772ea92-1198-40ea-8bae-fe912505a379
                external_id: 2xQ2gprbMUePw1s9gw9fvA==
                attribute_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
                user_data: some_string
                create_time: '2019-11-11T09:11:41.674Z'
                avatar: '/5/samples/92ba3457-71b5-4744-b94a-2beb37db7d94'
            list_info:
              list_id: 8591e883-b5af-4ebd-a67c-5e9d4b0c474b
              user_data: customers
          face_id: c1c5c22f-4fc9-4fb5-be31-99c7d1c7030f
        failed_matches:
        - reference_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
          error:
            error_code: 1
            detail: internal server error
            desc: internal server error
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-1
    Sample:
      type: object
      properties:
        sample_id:
          $ref: '#/components/schemas/sample_id'
        url:
          type: string
          format: uri-reference
          description: location of a new sample.
      required: [sample_id, url]
      example:
        sample_id: b5d6fd45-fcca-453d-ac05-3e594054b813
        url: /5/samples/b5d6fd45-fcca-453d-ac05-3e594054b813

    Samples:
      type: array
      items:
        $ref: '#/components/schemas/Sample'

    error_code:
      type: integer
      description: error code.
      example: 22004

    error_link:
      type: string
      description: Link to the documentation website with the error description.
      example: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22004

    errorId:
      type: integer
      example: 10

    errorIds:
      type: string
      format: comma-separate task ids
      minItems: 1
      example: 4,5,6

    taskStatus:
      type: integer
      enum: [0, 1, 2, 3, 4, 5]
      example: 1
      description: |
        task status

        | task status | value |
        |-----------------|---|
        | pending         | 0 |
        | in progress     | 1 |
        | cancelled       | 2 |
        | failed          | 3 |
        | collect results | 4 |
        | done            | 5 |

    subtaskStatus:
      type: integer
      enum: [0, 1, 2, 3, 4]
      example: 2

    taskCount:
      type: object
      properties:
        count:
          type: integer
          minimum: 0
          example: 152
          description: number of tasks

    errorCount:
      type: object
      properties:
        count:
          type: integer
          minimum: 0
          example: 101
          description: errors count

    taskType:
      type: integer
      enum: [0, 1, 2, 3, 4, 6, 7]
      example: 3
      description: |
        task type

        | task type     | value |
        |------------------- |---|
        | unknown            | 0 |
        | linker             | 1 |
        | clustering         | 2 |
        | report             | 3 |
        | garbage collection | 4 |
        | cross match        | 6 |
        | ROC calculation    | 7 |

    taskIds:
      type: string
      format: comma-separate task ids
      description: task IDs.
      example: 1,2,3

    task_description:
      type: string
      maxLength: 128
      description: task description
      example: "task description"

    task_content:
      anyOf:
        - $ref: '#/components/schemas/ClusteringTaskContent'
        - $ref: '#/components/schemas/LinkerTaskContent'
        - $ref: '#/components/schemas/GcAttributesTaskContent'
        - $ref: '#/components/schemas/GcDescriptorsTaskContent'
        - $ref: '#/components/schemas/ReporterTaskContent'
        - $ref: '#/components/schemas/CrossMatchTaskContent'
        - $ref: '#/components/schemas/ROCTaskContent'

    subtask_content:
      type: object
      description: content of subtask
      example: content

    error_description:
      type: string
      description: error description
      example: Faces not found

    error_detail:
      type: string
      description: error detail
      example: One or more faces not found, including face with id '8f4f0070-c464-460b-bf78-fac225df72e9'

    errors_additional_info:
      type: string
      description: additional error info
      example: 8f4f0070-c464-460b-bf78-fac225df72e9

    tasks_objects_type:
      type: string
      description: objects type - faces or events
      enum: ["faces", "events"]

    count_task_parts_done:
      type: integer
      minimum: 0
      description: count of task finished parts
      example: 10

    count_task_parts_all:
      type: integer
      minimum: 1
      description: count of task parts
      example: 100

    status_code:
      type: integer
      minimum: 400
      maximum: 599
      description: error status code
      example: 500

    task_id:
      type: integer
      minimum: 1
      description: task id
      example: 123

    subtask_id:
      type: integer
      minimum: 1
      description: subtask id
      example: 5

    Task:
      type: object
      properties:
        task_id:
          $ref: '#/components/schemas/task_id'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: task create time
        end_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: task end time
          nullable: true
        last_update_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: task last update time
        task_type:
          $ref: '#/components/schemas/taskType'
        task_status:
          $ref: '#/components/schemas/taskStatus'
        result_id:
          allOf:
            - $ref: '#/components/schemas/result_id'
          nullable: true
        count_task_parts_done:
          $ref: '#/components/schemas/count_task_parts_done'
        count_task_parts_all:
          $ref: '#/components/schemas/count_task_parts_all'
        content:
          $ref: '#/components/schemas/task_content'
        description:
          allOf:
            - $ref: '#/components/schemas/task_description'
          nullable: true
      required: [task_id, create_time, last_update_time, task_type, task_status, count_task_parts_done,
                 count_task_parts_all, content, result_id, end_time, description]

    Tasks:
      description: tasks
      type: object
      properties:
        tasks:
          type: array
          items:
            $ref: '#/components/schemas/Task'
          minItems: 0
      required: [tasks]

    SubTask:
      type: object
      properties:
        subtask_id:
          $ref: '#/components/schemas/subtask_id'
        task_id:
          $ref: '#/components/schemas/task_id'
        result_id:
          allOf:
            - $ref: '#/components/schemas/result_id'
          nullable: true
        create_time:
          allOf:
          - $ref: '#/components/schemas/time'
          description: subtask create time
        end_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: subtask end time
        subtask_status:
          $ref: '#/components/schemas/subtaskStatus'
        content:
          $ref: '#/components/schemas/subtask_content'
      required: [subtask_id, task_id, create_time, subtask_status, content, result_id]

    SubTasks:
      type: array
      items:
        $ref: '#/components/schemas/SubTask'
      minItems: 1

    TaskError:
      type: object
      properties:
        error_id:
          $ref: '#/components/schemas/errorId'
        task_id:
          $ref: '#/components/schemas/task_id'
        subtask_id:
          allOf:
            - $ref: '#/components/schemas/subtask_id'
          nullable: true
        error_code:
          $ref: '#/components/schemas/error_code'
        description:
          $ref: '#/components/schemas/error_description'
        detail:
          $ref: '#/components/schemas/error_detail'
        link:
          $ref: '#/components/schemas/error_link'
        additional_info:
          allOf:
            - $ref: '#/components/schemas/errors_additional_info'
          nullable: true
        error_time:
          allOf:
          - $ref: '#/components/schemas/time'
          description: error time
      required: [error_id, task_id, subtask_id, error_code, description, detail, link, error_time, additional_info]

    TaskErrorsArray:
      type: array
      items:
        $ref: '#/components/schemas/TaskError'
      minItems: 0
      maxItems: 100000
      description: array of errors occurred while task processing

    TaskErrors:
      description: task errors
      type: object
      properties:
        errors:
          $ref: '#/components/schemas/TaskErrorsArray'
      required: [errors]

    task_face_filters_no_account:
      description: faces filters mapping
      type: object
      properties:
        create_time__gte:
          allOf:
            - $ref: '#/components/schemas/time'
          description: lower bound for faces create time
        create_time__lt:
          allOf:
            - $ref: '#/components/schemas/time'
          description: upper bound for faces create time.
        list_id:
          allOf:
            - $ref: '#/components/schemas/uuid4'
          description: list ID filter. Only the faces linked to the specified list will be processed.

    task_event_filters_no_account:
      type: object
      properties:
        create_time__gte:
          allOf:
            - $ref: '#/components/schemas/time'
          description: lower bound for events create time.
        create_time__lt:
          allOf:
            - $ref: '#/components/schemas/time'
          description: upper bound for events create time.
        sources:
          description: sources. Each event from result will contain one of the given sources.
          type: array
          items:
            type: string
        event_ids:
          description: events IDs
          type: array
          items:
            $ref: '#/components/schemas/event_id'
        handler_ids:
          description: handler IDs. Each event from the result will contain one of the given handlers.
          type: array
          items:
            $ref: '#/components/schemas/handler_id'
        top_similar_face_list:
          allOf:
            - $ref: '#/components/schemas/uuid4'
          description: list ID with the most similar face
        top_similar_face_ids:
          description: IDs of the most similar faces
          type: array
          items:
            $ref: '#/components/schemas/face_id'
        top_similar_face_similarity__gte:
          allOf:
          - $ref: '#/components/schemas/double01'
          description: the lower including boundary of the most similar face similarity
        top_similar_face_similarity__lt:
          allOf:
          - $ref: '#/components/schemas/double01'
          description: the upper excluding boundary of the most similar face similarity
        age__lt:
          allOf:
          - $ref: '#/components/schemas/age'
          description: age upper excluded bound.
        age__gte:
          allOf:
          - $ref: '#/components/schemas/age'
          description: age lower included bound.
        gender:
          $ref: '#/components/schemas/gender'
        emotions:
          $ref: '#/components/schemas/emotions_map'
        ethnic_groups:
          $ref: '#/components/schemas/ethnicities_enum'
        face_ids:
          description: created face IDs
          type: array
          items:
            allOf:
            - $ref: '#/components/schemas/face_id'
        user_data:
          $ref: '#/components/schemas/event_user_data'
        tags:
          description: list of tags. Each event from result will contain all of the given tags.
          type: array
          items:
            $ref: '#/components/schemas/tag'

    LinkerTaskContent:
      type: object
      description: linker task content
      properties:
        create_list:
          description: |
            create list to link faces to. If set to 1, a new list is created.

            If set to 0, you must specify the existing list ID in the list_id field
          type: integer
          enum: [0, 1]
          example: 1
        list_id:
          allOf:
            - $ref: '#/components/schemas/uuid4'
          description: |
            ID of the list to link faces to. It there is no list with the specified ID, the list is created.

            If create_list is set to 1, the `list_id` field must be deleted from the request body.
        user_data:
          allOf:
            - $ref: '#/components/schemas/list_user_data'
          description: user data to create the list with. It is only used if create_list is set to 1
        objects_type:
          $ref: '#/components/schemas/tasks_objects_type'
        filters:
          anyOf:
            - $ref: '#/components/schemas/task_face_filters_no_account'
            - $ref: '#/components/schemas/task_event_filters_no_account'
      required: [objects_type]

    LinkerTask:
      type: object
      properties:
        description:
          type: string
          description: provided user data for current task
          example: linker task one
        content:
          $ref: '#/components/schemas/LinkerTaskContent'
      required: [objects_type, content]

    GcAttributesTaskContent:
      description: garbage collection task content
      type: object
      properties:
        target:
          type: string
          enum: ['attributes']
        filters:
          type: object
          description: attributes' filter garbage collection
          properties:
            create_time__lt:
              allOf:
                - $ref: '#/components/schemas/time'
              description: create time upper excluding boundary
            account_id:
              $ref: '#/components/schemas/account_id'
      required: [target]

    GcDescriptorsTaskContent:
      description: garbage collecting task content to delete descriptors by version
      type: object
      properties:
        target:
          type: string
          enum: ['descriptors']
        filters:
          type: object
          properties:
            descriptor_version:
              description: version of descriptors to delete
              type: integer
            account_id:
              $ref: '#/components/schemas/account_id'
          required: [descriptor_version]
      required: [target]

    GcTask:
      type: object
      properties:
        description:
          type: string
          description: provided user data for current task
          example: gc task one
          default:
        content:
          allOf:
            - $ref: '#/components/schemas/GcAttributesTaskContent'
          description: garbage collection task content, target "attributes" is to remove unattached attributes
      required: [content]

    ClusteringTaskContent:
      type: object
      description: clustering task content
      properties:
        objects_type:
          $ref: '#/components/schemas/tasks_objects_type'
        filters:
          anyOf:
            - $ref: '#/components/schemas/task_face_filters_no_account'
            - $ref: '#/components/schemas/task_event_filters_no_account'
        threshold:
          description: The minimum acceptable degree of similarity. If the similarity of two descriptors exceeds the specified value, it is considered that they belong to the same person. In this case, both descriptors are added to the same cluster.
          type: number
          maximum: 1
          minimum: 0
          example: 0.5
          default: 0.81
      required: [objects_type]

    ClusteringTask:
      type: object
      properties:
        description:
          type: string
          description: provided user data for current task
          example: clustering faces
        content:
          allOf:
          - $ref: '#/components/schemas/ClusteringTaskContent'
      required: [content]

    GCTaskResult:
      description: Garbage collection task result
      type: object
      properties:
        result:
          description: removed attributes
          type: array
          items:
            description: removed attribute
            type: object
            properties:
              attributes_id:
                description: removed attribute id
                allOf:
                - $ref: '#/components/schemas/attribute_id'
              samples:
                description: samples of the removed attribute
                type: array
                items:
                  description: sample of the removed attribute
                  allOf:
                  - $ref: '#/components/schemas/sample_id'
            required: [attributes_id, samples]
        errors:
          description: errors occurred during the task processing.
          allOf:
          - $ref: '#/components/schemas/TaskErrorsArray'
      required: [errors]

    LinkerTaskResult:
      description: Linking task result
      type: object
      properties:
        errors:
          allOf:
            - $ref: '#/components/schemas/TaskErrorsArray'
          description: errors occurred during the task processing.
        result:
          type: object
          description: linked faces' IDs
          properties:
            list_id:
              $ref: '#/components/schemas/list_id'
            face_ids:
              description: linked faces' IDs
              type: array
              items:
                allOf:
                  - $ref: '#/components/schemas/face_id'
                description: linked face id
          required: [list_id, face_ids]
      required: [errors]

    ClusteringTaskResult:
      description: Clustering task result
      type: object
      properties:
        result:
          description: clustering result
          type: object
          properties:
            clusters:
              description: generated clusters - lists of objects IDs
              type: array
              items:
                description: single cluster - list of objects' IDs
                type: array
                example: ["bf749384-0e30-4b8a-a884-dfdfcafd0a55", "0a2ce15b-a6f7-4713-97ce-64410f55031a", "60bacd78-64a3-4206-9434-bc94c73ff2c1", "cd7bae5a-8144-47e8-8d75-928ed8dc576b", "b20ebff6-1973-40b2-a190-b72ff1ef8927"]
                items:
                  description: object id
                  allOf:
                  - $ref: '#/components/schemas/uuid4'
            total_objects:
              type: integer
              description: total objects count
              example: 5
            total_clusters:
              type: integer
              description: total clusters count
              example: 1
        errors:
          description: errors occurred during the task processing.
          allOf:
          - $ref: '#/components/schemas/TaskErrorsArray'
      required: [errors]

    ReporterTaskContent:
      type: object
      description: reporter task content
      properties:
        filters:
          type: object
          description: reporter task objects' filters
          properties:
            account_id:
              $ref: '#/components/schemas/account_id'
            task_id:
              type: integer
              description: id of task
              example: 146
          required: [task_id]
        columns:
          anyOf:
            - type: array
              items:
                type: string
                description: |
                  Event columns.

                  The default columns are: `"create_time", "external_id", "handler_id", "attribute_id", "source", "top_similar_face_id", "top_similar_face_list", "top_similar_face_similarity", "face_id", "gender", "age", "emotion", "ethnic_group", "user_data"`
                enum: [ "create_time", "external_id", "handler_id", "attribute_id", "source",
                        "top_similar_face_id", "top_similar_face_list", "top_similar_face_similarity",
                        "match_result", "extract_result", "face_id", "attach_result", "gender", "age", "emotion",
                        "ethnic_group", "tags", "user_data" ]
            - type: array
              items:
                type: string
                description: |
                  Face columns.

                  The default columns are: `"user_data", "create_time", "external_id", "attribute_id", "avatar", "event_id"`
                enum: [ "user_data", "create_time", "lists", "external_id", "attribute_id", "avatar", "event_id" ]
        csv_delimiter:
          default: ','
          type: string
          description: CSV delimiter
          maxLength: 1
          minLength: 1
          example: '$'
        save_images:
          default: 0
          type: integer
          enum: [0, 1]
          description: "Whether to save object images. If set, images for each object will be loaded: first sample for an event, avatar for face. Image will be ignored if not available."
          example: 1
      required: [filters]

    ReporterTask:
      type: object
      properties:
        description:
          type: string
          description: provided user data for the current task
          example: report clustering events from cam1
        content:
          $ref: '#/components/schemas/ReporterTaskContent'
      required: [content]

    AttributesFilters:
      description: attributes filters
      type: object

    DetectOrEmitEventJsonRequestBodyUrls:
      type: object
      properties:
        urls:
          $ref: '#/components/schemas/ListOfUrlsWithImages'
      required: [urls]

    DetectOrEmitEventJsonRequestBodySamples:
      type: object
      properties:
        samples:
          type: array
          items:
            allOf:
            - $ref: '#/components/schemas/sample_id'
          minItems: 1
          maxItems: 8
          description: list of sample IDs
          example:
          - "c724fea1-d1bb-44c5-af6d-9833d22f3eb7"
          - "f78c6156-3946-4767-be65-4748f25aefd4"
      required: [samples]

    DetectOrEmitEventJsonRequestBody:
      oneOf:
      - $ref: '#/components/schemas/DetectOrEmitEventJsonRequestBodyUrls'
      - $ref: '#/components/schemas/DetectOrEmitEventJsonRequestBodySamples'

    CrossMatchTaskReferenceFilters:
      description: Object filters for references.
      anyOf:
        - $ref: '#/components/schemas/task_face_filters_no_account'
        - $ref: '#/components/schemas/task_event_filters_no_account'

    CrossMatchTaskCandidateFilters:
      description: Object filters for candidates.
      anyOf:
        - $ref: '#/components/schemas/task_face_filters_no_account'
        - $ref: '#/components/schemas/task_event_filters_no_account'

    CrossMatchTaskContent:
      type: object
      description: cross match task content
      properties:
        filters:
          description: Task objects' filters.
          type: object
          properties:
            account_id:
              $ref: '#/components/schemas/account_id'
            reference_type:
              $ref: '#/components/schemas/tasks_objects_type'
            candidate_type:
              $ref: '#/components/schemas/tasks_objects_type'
            reference_filters:
              $ref: '#/components/schemas/CrossMatchTaskReferenceFilters'
            candidate_filters:
              $ref: '#/components/schemas/CrossMatchTaskCandidateFilters'
          required: [reference_type, candidate_type, reference_filters, candidate_filters]
          example:
            reference_type: events
            candidate_type: faces
            reference_filters:
              gender: 1
              sources: "Main_hall_camera"
            candidate_filters:
              create_time__gte: "2018-02-11T09:11:41.674Z"
              create_time__lt: "2020-02-12T09:11:41.674Z"
              list_id: "557d54ec-29ad-4f3c-93b4-c9092ef12515"
        threshold:
          description: The minimum acceptable degree of similarity. If the similarity of two descriptors is lower then the specified value, the matching result will be ignored. References with all filtered matches also will be ignored.
          type: number
          maximum: 1
          minimum: 0
          example: 0.5
          default: 0.0
        limit:
          description: Maximum number of matching candidates returned for every match.
          type: integer
          minimum: 1
          example: 3
          default: 5
      required: [filters]

    CrossMatchTask:
      type: object
      properties:
        description:
          type: string
          description: provided user data for current task
          example: matching visitors with the list of VIP customers
        content:
          $ref: '#/components/schemas/CrossMatchTaskContent'
      required: [content]

    CrossMatchTaskResult:
      description: Cross Match task result
      type: object
      properties:
        result:
          description: task result
          type: array
          items:
            type: object
            properties:
              reference_id:
                allOf:
                  - $ref: '#/components/schemas/uuid4'
                description: reference ID. The ID corresponds to the specified reference type. The reference type is specified in the `reference_type` field on the `filters` section of the "cross-matching tasks" request.
              candidates:
                description: match candidates for the reference
                type: array
                items:
                  type: object
                  description: match with a candidate
                  properties:
                    candidate_id:
                      allOf:
                        - $ref: '#/components/schemas/uuid4'
                      description: candidate id (see candidate_type field in CrossMatchTask filters)
                    similarity:
                      description: similarity for the reference - candidate pair.
                      type: number
                      minimum: 0
                      maximum: 1
                  required: [candidate_id, similarity]
                minItems: 1
            required: [reference_id, candidates]
          example:
            - reference_id: e99d42df-6859-4ab7-98d4-dafd18f47f30
              candidates:
                - candidate_id: 93de0ea1-0d21-4b67-8f3f-d871c159b740
                  similarity: 0.548252
                - candidate_id: 54860fc6-c726-4521-9c7f-3fa354983e02
                  similarity: 0.62344
            - reference_id: 345af6e3-625b-4f09-a54c-3be4c834780d
              candidates:
                - candidate_id: 6ade1494-1138-49ac-bfd3-29e9f5027240
                  similarity: 0.7123213
                - candidate_id: e0e3c474-9099-4fad-ac61-d892cd6688bf
                  similarity: 0.9543
        errors:
          description: errors occurred during the task processing.
          allOf:
          - $ref: '#/components/schemas/TaskErrorsArray'
      required: [errors]

    ROCTaskContent:
      type: object
      description: roc task content.
      properties:
        markup:
          description: markup of face IDs to labels (group IDs).
          type: array
          minItems: 2
          items:
            type: object
            properties:
              face_id:
                $ref: '#/components/schemas/face_id'
              label:
                type: integer
                description: face label (group id)
                example: 12
            required: [ face_id, label ]
        filters:
          type: object
          properties:
            account_id:
              $ref: '#/components/schemas/account_id'
        threshold_hit_top:
          allOf:
            - $ref: '#/components/schemas/double01'
          description: similarity threshold to calculate hit into the top-N.
          default: 0
        limit:
          description: maximum candidates count for every match.
          type: integer
          minimum: 1
          example: 100
          default: 5
        key_FPRs:
          description: roc-curve key FPR values
          type: array
          items:
            $ref: '#/components/schemas/double01'
          example: [ 0.000001, 0.001 ]
      required: [ markup, filters ]

    ROCTask:
      type: object
      properties:
        description:
          description: provided user data for current task.
          type: string
          example: matching famous people with customers
        content:
          $ref: '#/components/schemas/ROCTaskContent'
      required: [content]

    ROCpoints:
      type: object
      properties:
        FPR:
          allOf:
            - $ref: '#/components/schemas/double01'
          description: false positive rate.
        TPR:
          allOf:
            - $ref: '#/components/schemas/double01'
          description: true positive rate.
        similarity:
          allOf:
            - $ref: '#/components/schemas/double01'
          description: similarity threshold.
      required: [FPR, TPR, similarity]

    ROCTaskResult:
      description: roc task result.
      type: object
      properties:
        result:
          description: roc-curve calculation result.
          type: object
          properties:
            roc:
              type: array
              items:
                $ref: '#/components/schemas/ROCpoints'
              description: roc-curve points.
              example:
                - FPR: 0.1
                  TPR: 0.95
                  similarity: 0.9
                - FPR: 0.15
                  TPR: 0.96
                  similarity: 0.8
            hit_top_probability:
              type: object
              description: propability of hit into the top.
              properties:
                top-1:
                  allOf:
                    - $ref: '#/components/schemas/double01'
                  nullable: true
                  description: propability of hit into the top-1.
                top-2:
                  allOf:
                    - $ref: '#/components/schemas/double01'
                  description: propability of hit into the top-2.
                  nullable: true
                top-3:
                  allOf:
                    - $ref: '#/components/schemas/double01'
                  description: propability of hit into the top-3.
                  nullable: true
                top-4:
                  allOf:
                    - $ref: '#/components/schemas/double01'
                  description: propability of hit into the top-4.
                  nullable: true
                top-5:
                  allOf:
                    - $ref: '#/components/schemas/double01'
                  description: propability of hit into the top-5.
                  nullable: true
              required: [top-1, top-2, top-3, top-4, top-5]
              example:
                top-1: 0.995
                top-2: 0.997
                top-3: 0.999
                top-4: 0.999
                top-5: 0.999
            auc:
              allOf:
                - $ref: '#/components/schemas/double01'
              description: area under the roc-curve.
              example: 0.99
            type_I_and_II_error_rates_equal_point:
              allOf:
                - $ref: '#/components/schemas/ROCpoints'
              description: ROC-curve point where type I error rate (1 - TPR) and type II error rate (FPR) are equal, i.e. intersection point of the ROC-curve and the secondary main diagonal.
              example:
                FPR: 0.15
                TPR: 0.85
                similarity: 0.8
              nullable: true
            key_points:
              type: array
              items:
                $ref: '#/components/schemas/ROCpoints'
              description: roc-curve points.
              example:
                - FPR: 0.000001
                  TPR: 0.95
                  similarity: 0.9
                - FPR: 0.001
                  TPR: 0.96
                  similarity: 0.8
              nullable: true
          required: [roc, hit_top_probability, auc, type_I_and_II_error_rates_equal_point, key_points]
        errors:
          $ref: '#/components/schemas/TaskErrorsArray'
      required: [errors]

    ListOfUrlsWithImages:
      type: array
      items:
        type: string
        format: uri-reference
      minItems: 1
      maxItems: 8
      description: list of urls with images
      example:
      - "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Abbey_Lee_2015.jpg/800px-Abbey_Lee_2015.jpg"
      - "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Yfke-sturm-1326186044.jpg/800px-Yfke-sturm-1326186044.jpg"

    image_binary_for_multipart:
      type: string
      format: binary
      description: |
        Binary image.

        Content-Disposition header must contain actual filename.

        Filenames are used to differentiate images, they must be unique within the request.

        This part must have valid Content-Type header (one of "image/jpeg", "image/png", "image/bmp", "image/tiff",
        "image/x-portable-pixmap")

    image_base64_for_multipart:
      type: string
      description: |
        Image encoded in base64.

        This part must have valid Content-Type header (one of "image/x-jpeg-base64", "image/x-png-base64",
        "image/x-bmp-base64", "image/x-tiff-base64", "image/x-portable-pixmap-base64")

    image_for_multipart:
      oneOf:
        - $ref: '#/components/schemas/image_binary_for_multipart'
        - $ref: '#/components/schemas/image_base64_for_multipart'

    image_list_for_multipart:
      type: array
      items:
        $ref: '#/components/schemas/image_for_multipart'
      minItems: 1

    LivenessMeta:
      type: object
      required: [OS]
      properties:
        OS:
          type: string
          enum: ["IOS", "ANDROID", "DESKTOP", "UNKNOWN"]
          description: device OS.
        MANUFACTURE:
          type: string
          description: device manufacturer.
        MODEL:
          type: string
          description: device model.
      description: |
          Device information. This information can significantly decrease the overall error rate.

          The "meta" object is not mandatory. If you are not sure about any of the parameters, set "UNKNOWN" value or don't pass meta.

          > The specified meta is applied to all the images within the request.
      deprecated: true

    liveness_response:
      type: object
      properties:
        failed_images:
          type: array
          description: list of images which is failed processing
          items:
            type: object
            properties:
              error:
                allOf:
                  - $ref: '#/components/schemas/Error'
                description: errors occurred during the liveness processing
              filename:
                type: string
                example: "penelope.jpeg"
                description: |
                  source image file name (preserved only for multipart-form-data requests, otherwise "Raw Image")
            required: [error, filename]
          example:
            error:
              desc: Failed to decode image data
              detail: File decoding error
              error_code: 32010
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-32010
            filename: n.jpg
        succeeded_images:
          type: array
          items:
            type: object
            description: list of images which is succeeded processing
            properties:
              filename:
                type: string
                example: "claudia.jpg"
                description: |
                  source image file name (preserved only for multipart-form-data requests, otherwise "Raw Image")
              prediction:
                type: object
                description: liveness prediction result
                properties:
                  probability:
                    type: number
                    maximum: 1
                    minimum: 0
                    description: |
                      The parameter shows the probability of a live person being present in the
                      image, i.e. it is not a presentation attack.

                      In general, the estimated probability must exceed the theoretical
                      threshold of 50%. The value may be increased according to your business rules.
                    example: 0.99
                  quality:
                    type: number
                    maximum: 1
                    minimum: 0
                    description: |
                      The parameter describes the integral value of image, facial,
                      and environmental characteristics. In general, the estimated quality must exceed
                      the theoretical threshold of 50%. The threshold may be increased according to
                      the photo shooting conditions.
                    example: 1.0
                required: [probability, quality]
            required: [filename, prediction]
      required: [succeeded_images, failed_images]

    Message_from_ws:
      type: object
      properties:
        event:
          type: object
          description: event format from handler.
          properties:
            samples:
              type: array
              minItems: 1
              description: list of samples assoсiated with the event.
              items:
                $ref: '#/components/schemas/sample_id'
            attributes:
              allOf:
                - $ref: '#/components/schemas/Attribute'
              description: extracted attributes from samples.
            source:
              type: string
              description: additional information that user provides with event.
              nullable: true
              example: "3rd Avenue"
            user_data:
              $ref: '#/components/schemas/event_user_data'
            tags:
              description: tag array.
              type: array
              items:
                $ref: '#/components/schemas/tag'
              example: ['tag1', 'tag2']
              nullable: true
            face:
              type: object
              description: face associated with event
              nullable: true
              properties:
                face_id:
                  $ref: '#/components/schemas/face_id'
                external_id:
                  $ref: '#/components/schemas/face_external_id'
                user_data:
                  $ref: '#/components/schemas/face_user_data'
                avatar:
                  allOf:
                    - $ref: '#/components/schemas/avatar'
                  nullable: true
                lists:
                  type: array
                  items:
                    $ref: '#/components/schemas/list_id'
                  description: list of luna lists, which contain the face.
                event_id:
                  allOf:
                    - $ref: '#/components/schemas/event_id'
                  description: the event ID associated with the face creation.
                url:
                  type: string
                  description: face url
              required: [face_id, external_id, user_data, avatar, lists, event_id, url]
              example:
                face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
                external_id: 2xQ2gprbMUePw1s9gw9fvA==
                user_data: fox1991
                lists: ["429b0e78-4616-426a-b57f-02baa72d638d", '6d037c33-31ec-4d73-b3b3-ec80b09446c2']
                avatar: 'https://st.kp.yandex.net/images/actor_iphone/iphone360_460188.jpg'
                event_id: f9687459-986b-406d-9c1f-0d6289be5256

            event_id:
              $ref: '#/components/schemas/event_id'
            url:
              type: string
              format: uri-reference
              example: /0/events/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
              description: location of event.
            matches:
              allOf:
                - $ref: '#/components/schemas/Matches'
              description: sorted list with match result for the event.
              nullable: true
            external_id:
              $ref: '#/components/schemas/event_external_id'
            detections:
              type: array
              description: all detecticions which was generat the event.
              items:
                type: object
                properties:
                  filename:
                    type: string
                    description: face detection filename
                    example: "penelope.jpeg"
                  sample:
                    type: object
                    description: detection sample
                    properties:
                      url:
                        type: string
                        format: uri-reference
                        description: location of face.
                      detection:
                        allOf:
                          - $ref: '#/components/schemas/FaceDetection'
                        required: [landmarks5, rect]
                      sample_id:
                        $ref: '#/components/schemas/sample_id'
                    required: [url, detection, sample_id]
                required: [filename, sample]
          required: [matches, url, event_id, face, tags, source, attributes, samples, detections, user_data, external_id]
        handler_id:
          allOf:
            - $ref: '#/components/schemas/uuid4'
          description: id of the handler, which has produced the event.
        event-time:
          description: event time
          type: string
          format: date-time
        Luna-Request-id:
          type: string
          example: "1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a"
          pattern: "^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$"
          description: id of the request, which gave birth to the event.
      required: [event, handler_id, event-time, Luna-Request-id]
      description: example message that will be send by websocket

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

    tag:
      type: string
      example: "good"
      maxLength: 36

    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: api
            error:
              error_code: 10017
              desc: Health check error
              detail: Timed out
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11017
            status: 0
          - component: faces
            error:
              error_code: 0
              desc: Success
              detail: Success
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-0
            status: 1
          - component: sender
            error:
              error_code: 0
              desc: Success
              detail: Success
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-0
            status: 1

    login:
      type: string
      minLength: 3
      maxLength: 128
      pattern: '^[a-z0-9_\-\.]+@[a-z]+\.[a-z]{2,}$'
      description: account email
      example: "mylogin"

    password:
      type: string
      minLength: 3
      maxLength: 128
      description: account password

    account_description:
      type: string
      maxLength: 128
      description: account description
      default: ""
      example: "main admin account"

    account_type:
      type: string
      enum: ['advanced_user', 'user', 'admin']
      description: |
        specified user account type:

        - `user` - allows to interact with its own data

        - `advanced_user` - additionally provides possibility to view data of other accounts

        - `admin` - additionally provides administrator privileges

    account_type_for_creation:
      type: string
      enum: ['advanced_user', 'user']
      description: |
        specified user account type:

        - `user` - allows to interact with its own data

        - `advanced_user` - allows to interact with its own data and view other accounts data

    account_base:
      type: object
      properties:
        login:
          $ref: '#/components/schemas/login'
        password:
          $ref: '#/components/schemas/password'
        account_type:
          $ref: '#/components/schemas/account_type_for_creation'
        description:
          $ref: '#/components/schemas/account_description'

    account_to_create:
      allOf:
        - $ref: '#/components/schemas/account_base'
        - required: [login, password, account_type]

    account_creation_response:
      type: object
      properties:
        account_id:
          allOf:
            - $ref: '#/components/schemas/account_id'
          description: ID of the created account.
        url:
          type: string
          format: uri-reference
          description: relative URL of the created account.
      required: [account_id, url]
      example:
        account_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
        url: /1/account

    account_to_receive:
      type: object
      properties:
        account_id:
          allOf:
            - $ref: '#/components/schemas/account_id'
            - example: 557d54ec-29ad-4f3c-93b4-c9092ef12515
        login:
          $ref: '#/components/schemas/login'
        account_type:
          $ref: '#/components/schemas/account_type'
        description:
          $ref: '#/components/schemas/account_description'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: account create time
        last_update_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: account last update time
      required: [ account_id, login, account_type, description, create_time, last_update_time ]

    account_for_patch:
      allOf:
        - $ref: '#/components/schemas/account_base'
        - minProperties: 1

    verifier_login_password:
      type: object
      properties:
        login:
          $ref: '#/components/schemas/login'
        password:
          $ref: '#/components/schemas/password'
      required: [login, password]

    verifier_account_id:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
      required: [account_id]

    verifier_post_data:
      oneOf:
        - $ref: '#/components/schemas/verifier_login_password'
        - $ref: '#/components/schemas/verifier_account_id'

    verification_response:
      type: object
      description: verification response
      properties:
        account_type:
          $ref: '#/components/schemas/account_type'
        account_id:
          $ref: '#/components/schemas/account_id'
      required: [account_type]
    plugin_status:
      type: object
      properties:
        name:
          type: string
          description: Plugin name
        running:
          type: integer
          enum: [0, 1]
          description: Whether plugin is running or not.
      required: [name, running]

    plugins:
      type: object
      properties:
        plugins:
          description: list of imported plugins
          type: array
          items:
            $ref: '#/components/schemas/plugin_status'
      required: [plugins]
      example:
        plugins:
          - name: foo
            running: 1
  responses:
    internal_server_error:
      description: internal server error.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Access-Control-Allow-Origin:
          $ref: '#/components/headers/access_control_allow_origin'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'

    forbidden_error_backport:
      description: forbidden, access to this resouce is denied.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Access-Control-Allow-Origin:
          $ref: '#/components/headers/access_control_allow_origin'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 12042
            desc: Gone
            detail: Access to this resource on the server is no longer available
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12042

    forbidden_events_error:
      description: forbidden, luna-events support is disabled on server
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Access-Control-Allow-Origin:
          $ref: '#/components/headers/access_control_allow_origin'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 11040
            desc: Forbidden
            detail: Luna Events service is disabled
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11040

    forbidden_handlers_error:
      description: forbidden, luna-handlers support is disabled on server
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Access-Control-Allow-Origin:
          $ref: '#/components/headers/access_control_allow_origin'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 11071
            desc: Forbidden
            detail: Luna Handlers service is disabled
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11071

    forbidden_tasks_error:
      description: forbidden, luna-tasks support is disabled on server
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Access-Control-Allow-Origin:
          $ref: '#/components/headers/access_control_allow_origin'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 11039
            desc: Forbidden
            detail: Luna Tasks service is disabled
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11039

    forbidden_sender_error:
      description: forbidden, luna-sender support is disabled on server
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Access-Control-Allow-Origin:
          $ref: '#/components/headers/access_control_allow_origin'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 12010
            desc: Bad/incomplete input data
            detail: This resource needs "Authorization" authorization headers
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12010

    authorization_error:
      description: Authorization error.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Access-Control-Allow-Origin:
          $ref: '#/components/headers/access_control_allow_origin'
        WWW-Authenticate:
          $ref: '#/components/headers/authenticate'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            bad_format:
              value:
                error_code: 11065
                desc: Authorization failed
                detail: Bad format basic authorization header
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-36002
            invalid_login_password:
              value:
                error_code: 11065
                desc: Authorization failed
                detail: Account login or password are incorrect
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11065

    forbidden_resource_error:
      description: Forbidden.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            resource_is_disabled:
              value:
                error_code: 12049
                desc: Forbidden
                detail: Resource is disabled.
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12049"
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
      description: |
          Basic authorization with login and password. See [accounts](#tag/accounts) for details.
          Represents base64-encoded "username:password" credentials

    LunaAccountIdAuth:
      type: http
      scheme: Luna-Account-Id header
      deprecated: true
      description: |
            Authorization using `Luna-Account-Id` header. Deprecated. 
            If `Authorization` header specified, `Luna-Account-Id` will be ignored.
paths:
  /version:
    parameters:
      - $ref: '#/components/parameters/cors_origin'

    get:
      tags:
      - version

      summary: get version
      description: get versions of services
      operationId: getVersion

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: object
                properties:
                  luna-api:
                    $ref: '#/components/schemas/version'
                  luna-faces:
                    $ref: '#/components/schemas/version'
                  luna-image-store-faces-samples:
                    $ref: '#/components/schemas/version'
                  luna-image-store-bodies-samples:
                    $ref: '#/components/schemas/version'
                  luna-image-store-images:
                    $ref: '#/components/schemas/version'
                  luna-remote-sdk:
                    $ref: '#/components/schemas/version'
                  luna-handlers:
                    $ref: '#/components/schemas/version'
                  luna-python-matcher:
                    $ref: '#/components/schemas/version'
                  luna-matcher-proxy:
                    $ref: '#/components/schemas/version'
                  luna-events:
                    $ref: '#/components/schemas/version'
                  LUNA PLATFORM:
                    $ref: '#/components/schemas/base_version_schema'
                  luna-tasks:
                    $ref: '#/components/schemas/version'
                  luna-backport4:
                    $ref: '#/components/schemas/version'
                  luna-lambda:
                    $ref: '#/components/schemas/version'
                required:
                  - luna-api
                  - luna-faces
                  - luna-image-store-faces-samples
                  - luna-image-store-bodies-samples
                  - luna-image-store-images
                  - luna-remote-sdk
                  - LUNA PLATFORM
                  - luna-backport4
              example:
                luna-api: 
                  api: 6
                  major: 3
                  minor: 1
                  patch: 2
                luna-faces: 
                  api: 2
                  major: 2
                  minor: 3
                  patch: 9
                luna-image-store-faces-samples:
                  api: 1
                  major: 2
                  minor: 1
                  patch: 11
                luna-image-store-bodies-samples:
                  api: 1
                  major: 2
                  minor: 1
                  patch: 11
                luna-image-store-images:
                  api: 1
                  major: 2
                  minor: 1
                  patch: 11
                luna-remote-sdk:
                  api: 1
                  major: 1
                  minor: 0
                  patch: 0
                LUNA PLATFORM: 
                  major: 0
                  minor: 0
                  patch: 0
                luna-handlers:
                  api: 1
                  major: 1
                  minor: 2
                  patch: 5
                luna-events: 
                  api: 1
                  major: 1
                  minor: 0
                  patch: 5
                luna-matcher-proxy:
                  api: 1
                  major: 1
                  minor: 2
                  patch: 7
                luna-tasks: 
                  api: 1
                  major: 1
                  minor: 0
                  patch: 13
                luna-backport4:
                  api: 5
                  major: 1
                  minor: 2
                  patch: 3
                luna-lambda:
                  api: 1
                  major: 1
                  minor: 2
                  patch: 3
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - version

      summary: version options
      description: get options for the resource
      operationId: getVersionOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/accounts:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id_new_account'
      - $ref: '#/components/parameters/applicationJsonContent'

    post:
      tags:
      - accounts

      summary: create account
      description: create a new account
      operationId: createAccount
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/account_to_create'

      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: /3/account
              description: location of the account
              required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/account_creation_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:
                extra_fields:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message: ''extra fields not permitted'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message: unexpected value'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        409:
          description: Integrity Error
          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:
                login_already_exists:
                  value:
                    error_code: 41001
                    desc: Integrity Error
                    detail: Account with login 'mylogin' already exists
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-41001
                account_id_already_exists:
                  value:
                    error_code: 41002
                    desc: Integrity Error
                    detail: Account with account_id 'f8996094-9f1c-449a-b9d5-7e7279d345e9' already exists
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-41002
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
        - accounts
      summary: accounts options
      description: Get options for the resource.
      operationId: getAccountsOptions
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/account:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'

    get:
      tags:
      - accounts

      summary: get account
      description: get account
      operationId: getAccount
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
        - $ref: '#/components/parameters/luna_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/account_to_receive'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: account 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'
              examples:
                bad_query_param:
                  value:
                    error_code: 28001
                    desc: Object not found
                    detail: Account with id '8950722f-3fd4-4223-b48f-03f95f0e8dfb' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28001
        500:
          $ref: '#/components/responses/internal_server_error'

    patch:
      tags:
      - accounts

      summary: patch account
      description: patch account. At least one field must be specified
      operationId: patchAccount
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
        - $ref: '#/components/parameters/luna_account_id'
        - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/account_for_patch'

      responses:
        204:
          description: Update success.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            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:
                extra_fields:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''extra_field'',  message: ''extra fields not permitted'''
                no_fields:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message: ''at least 1 field must be specified'''
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          description: Permission denied
          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:
                unallowed_to_change_admin_account_type:
                  value:
                    error_code: 41004
                    desc: Forbidden
                    detail: Account with account_id '8950722f-3fd4-4223-b48f-03f95f0e8dfb' has admin type and its type can't be changed
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-41004
        404:
          description: account 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_query_param:
                  value:
                    error_code: 28001
                    desc: Object not found
                    detail: Account with id '8950722f-3fd4-4223-b48f-03f95f0e8dfb' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28001
        409:
          description: Integrity Error
          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:
                login_already_exists:
                  value:
                    error_code: 41001
                    desc: Integrity Error
                    detail: Account with login 'mylogin' already exists
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-41001
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - accounts
      summary: accounts options
      description: Get options for the resource.
      operationId: getAccountsOptions
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/credentials_verifier:
    parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'

    post:
      tags:
      - accounts

      summary: verify credentials
      description: |
        Verify account or login with password
        * In the case of success `account id` verification, `account_type` will be returned
        * In the case of success `login`/`password` verification, `account_id` and `account_type` will be returned
        * In the case of failure verification, error will be returned
      operationId: verifyCredentials

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/verifier_post_data'

      responses:
        200:
          description: Verification success
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/verification_response'
        400:
          description: Bad input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                request_does_not_contain_json:
                  value:
                    error_code: 12002
                    desc: Bad/incomplete input data
                    detail: Request does not contain json
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12002
        401:
          description: Verification failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                account_not_found:
                  value:
                    error_code: 28001
                    desc: Object not found
                    detail: Account with id '8950722f-3fd4-4223-b48f-03f95f0e8dfb' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28001
                login_password_incorrect:
                  value:
                    error_code: 41006
                    desc: Account credentials wrong
                    detail: Login and password doesn't match any user
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-41006
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - accounts
      summary: credentials verifier options
      description: Get options for the resource.
      operationId: verifyCredentialsOptions
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/detector:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags: [samples]
      summary: detect faces
      description: |
        Detect faces in input images.

        The request enables you to detect faces in input images, create samples, and estimate face properties.

        You can specify thresholds for the head angles. If a head angle exceeds the specified threshold the image is not processed.

        > The estimated face properties are not saved to the Faces database. They are only returned in the response.
      operationId: detectFaces
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/multiple_images_content_type'
      - $ref: '#/components/parameters/estimate_head_pose'
      - $ref: '#/components/parameters/estimate_emotions'
      - $ref: '#/components/parameters/detect_landmarks68'
      - $ref: '#/components/parameters/extract_exif'
      - $ref: '#/components/parameters/estimate_quality'
      - $ref: '#/components/parameters/estimate_gaze'
      - $ref: '#/components/parameters/estimate_eyes_attributes'
      - $ref: '#/components/parameters/estimate_mouth_attributes'
      - $ref: '#/components/parameters/pitch_threshold'
      - $ref: '#/components/parameters/roll_threshold'
      - $ref: '#/components/parameters/yaw_threshold'
      - $ref: '#/components/parameters/warped_image'

      requestBody:
        content:
          image/jpeg:
            schema:
              type: string
              format: binary
          image/png:
            schema:
              type: string
              format: binary
          image/bmp:
            schema:
              type: string
              format: binary
          image/x-portable-pixmap:
            schema:
              type: string
              format: binary
          image/tiff:
            schema:
              type: string
              format: binary
          image/x-jpeg-base64:
            schema:
              type: string
              format: base64
          image/x-png-base64:
            schema:
              type: string
              format: base64
          image/x-bmp-base64:
            schema:
              type: string
              format: base64
          image/x-tiff-base64:
            schema:
              type: string
              format: base64
          image/x-portable-pixmap-base64:
            schema:
              type: string
              format: base64
          multipart/form-data:
            schema:
              type: object
              properties:
                filename:
                  oneOf:
                    - type: array
                      items:
                        anyOf:
                        - type: string
                          format: binary
                        - type: string
                          format: base64
                    - type: string
                      format: binary
                    - type: string
                      format: base64
            encoding:
              filename:
                contentType: image/jpeg, image/png, image/bmp, image/x-portable-pixmap, image/tiff, image/x-jpeg-base64,
                  image/x-png-base64, image/x-bmp-base64, image/x-tiff-base64, image/x-portable-pixmap-base64
          application/json:
            schema:
               $ref: '#/components/schemas/DetectOrEmitEventJsonRequestBody'
        required: true
      responses:
        201:
          description: Created
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detected_images'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'estimate_eyes_attributes'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22011
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_conten_type_download_image:
                  value:
                    error_code: 11028
                    desc: Bad/incomplete input data
                    detail: 'Bad content type of image ''https://www.google.ru'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11028
                bad_conten_type_multepart:
                  value:
                    error_code: 11029
                    desc: Bad/incomplete input data
                    detail: Bad content type of image in multipart body
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11029
                failed_load_image:
                  value:
                    error_code: 11027
                    desc: External request failed
                    detail: 'Failed  to download image by url ''https://www.gooogle.ru'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11027
                boundary_missed_multipart:
                  value:
                    error_code: 11049
                    desc: Bad/incomplete input data
                    detail: "Failed to read multipart: boundary missed for Content-Type: multipart/form-data"
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11049
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - samples

      summary: detector options
      description: get options for the resource
      operationId: geteDetectorOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/samples:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags: [samples]
      summary: save sample
      description: |
        Save sample to the storage.        
      operationId: saveSample
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      - in: header
        name: Content-Type

        schema:
          type: string
          enum: [image/jpeg, image/png, image/bmp, image/tiff, image/gif, image/x-portable-pixmap]

      requestBody:
        content:
          image/jpeg:
            schema:
              $ref: '#/components/schemas/image_binary'
          image/png:
            schema:
              $ref: '#/components/schemas/image_binary'
          image/bmp:
            schema:
              $ref: '#/components/schemas/image_binary'
          image/tiff:
            schema:
              $ref: '#/components/schemas/image_binary'
          image/gif:
            schema:
              $ref: '#/components/schemas/image_binary'
          image/x-portable-pixmap:
            schema:
              $ref: '#/components/schemas/image_binary'
        required: true
      responses:
        201:
          description: created.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
                pattern: ^/5/samples/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
              required: true
              description: sample location.
              example: /5/samples/b5d6fd45-fcca-453d-ac05-3e594054b813
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sample'
              example:
                sample_id: b5d6fd45-fcca-453d-ac05-3e594054b813
                url: /5/samples/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'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_size:
                  value:
                    error_code: 11030
                    desc: Bad/incomplete input data
                    detail: Image size is not equal 250x250
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11030
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - samples

      summary: samples options
      description: get options for the resource
      operationId: getSmplesOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/samples/{sample_id}:
    parameters:
    - in: path
      name: sample_id
      schema:
        $ref: '#/components/schemas/uuid4'
      required: true
    - $ref: '#/components/parameters/cors_origin'

    get:
      tags:
      - samples
      summary: get sample
      description: Get sample by ID.
      operationId: getSample
      security:
        - BasicAuth: [ ]
        - LunaAccountIdAuth: [ ]
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/image_content_type'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            image/jpeg:
              schema:
                $ref: '#/components/schemas/image_binary'
            image/png:
              schema:
                $ref: '#/components/schemas/image_binary'
        404:
          description: Sample not found
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                sample_not_found:
                  value:
                    error_code: 13003
                    desc: Object not found
                    detail: Image with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-13003
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
    head:
      tags:
      - samples
      summary: check to exist a sample
      description: Check existence of the sample with `id=sample_id`.
      operationId: checkSample
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/image_content_type'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        404:
          description: sample not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          description: internal server error.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
    delete:
      tags:
      - samples
      summary: remove sample
      description: Remove sample by ID.
      operationId: deleteSample
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      responses:
        204:
          description: the resource was deleted successfully.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: Sample not found
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                sample_not_found:
                  value:
                    error_code: 13003
                    desc: Object not found
                    detail: Image with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-13003
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - samples

      summary: sample options
      description: get options for the resource
      operationId: getSmpleOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/extractor:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - attributes
      summary: extract attributes
      description: |
        Extract descriptors and basic attributes from samples.
        WARNING: Extracted attributes are temporary. Lifetime of temporary attributes can be configured using *ATTRIBUTES_STORAGE_POLICY.MAX_TTL* setting.
        
      operationId: extractAttributes
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      - $ref: '#/components/parameters/score_threshold'
      - $ref: '#/components/parameters/extract_descriptor'
      - $ref: '#/components/parameters/extract_basic_attributes'
      - $ref: '#/components/parameters/aggregate_attributes'

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/sample_ids'
        required: true

      responses:
        201:
          description: created.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Extracted_Attributes'
        400:
          description: bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'extract_basic_attributes'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
                sample_not_found:
                  value:
                    error_code: 11031
                    desc: Bad/incomplete input data
                    detail: Sample 483037a5-8d67-427d-a498-f8f62bb06fb1 not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11031
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''items'',  message: ''''^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$'' is not valid under any of the given schemas'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        404:
          description: image not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 13003
                desc: Object not found
                detail: Image with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-13003
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - attributes

      summary: extractor options
      description: get options for the resource
      operationId: geteEtractorOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/attributes:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - attributes

      summary: get attributes ids
      description: |
        Get temporary attributes IDs by filters.
        WARNING: Resource works with temporary attributes. Lifetime of temporary attributes can be configured using *ATTRIBUTES_STORAGE_POLICY.MAX_TTL* setting.
      operationId: getAttributesList
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/attribute_ids'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: object
                properties:
                  attributes:
                    type: array
                    items:
                      type: object
                      properties:
                        attribute_id:
                          allOf:
                          - $ref: '#/components/schemas/uuid4'
                          - type: string
                            description: attributes id.
                        create_time:
                          type: string
                          format: date-time
                      required: [attribute_id, create_time]
                    required: [attributes]
              example:
                attributes: [{
                  create_time: "2018-08-11T09:08:29.414Z",
                  attribute_id: "dc8a97d4-e7f5-44f7-af1b-183b6ca8eef9"
                }, {
                  create_time: "2018-05-11T09:08:29.414Z",
                  attribute_id: "dc8a97e4-e7f5-44f7-af1b-183b6ca8eef9"
                }]
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - attributes
      summary: attributes options
      description: get options for the resource
      operationId: getAttributesOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/attributes/count:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - attributes
      summary: get attributes count
      description: |
        Count temporary attributes.
        WARNING: Resource works with temporary attributes. Lifetime of temporary attributes can be configured using *ATTRIBUTES_STORAGE_POLICY.MAX_TTL* setting.
      operationId: getAttributesCount
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'

      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/text_plain'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            text/plain:
              schema:
                type: object
                properties:
                  attributes_count:
                    allOf:
                    - $ref: '#/components/schemas/count'
                    - type: integer
                      description: attributes count
              examples:
                some_attrs_count:
                  value: "123"
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - attributes

      summary: attributes count options
      description: get options for the resource
      operationId: getAttributesCountOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/attributes/{attribute_id}:
    parameters:
    - in: path
      name: attribute_id
      description: attribute id
      schema:
        $ref: '#/components/schemas/uuid4'
      required: true
    - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - attributes
      summary: get basic attributes
      description: |
        Get basic attributes (gender, age, ethnicity) by temporary attribute ID.
        If temporary attribute with specified ID does not exist, try to get face attribute with *face_id* equal to *attribute_id*.
      operationId: getAttributes
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/attributes_with_basic_attributes'
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        404:
          description: attributes not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                  error_code: 22011
                  desc: Object not found
                  detail: Attributes with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                  link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22011
        500:
          $ref: '#/components/responses/internal_server_error'

    head:
      tags:
      - attributes
      summary: check attributes existence 
      description: |
        Check the existence of the attribute with the ID equal to `attribute_id`.
        If temporary attribute with specified ID does not exist, try to check face attribute existence with *face_id* equal to *attribute_id*.
      operationId: checkAttributes
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          description: OK
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: attributes 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:
      - attributes
      summary: delete attributes
      description: |
        Delete the attribute by its ID.
        If temporary attribute with specified ID does not exist, try to delete face attribute existence with *face_id* equal to *attribute_id*.
      operationId: deleteAttributes
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          description: the resource was deleted successfully.
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        404:
          description: attributes not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 22011
                desc: Object not found
                detail: Attributes with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22011
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - attributes

      summary: attribute options
      description: get options for the resource
      operationId: getAttributeOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/attributes/{attribute_id}/samples:
    parameters:
    - in: path
      name: attribute_id
      description: attribute id
      schema:
        $ref: '#/components/schemas/uuid4'
      required: true
    - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - attributes
      summary: get samples of attributes
      description: |
        Get samples associated with attribute ID.
        If temporary attribute with specified ID does not exist, try to get face samples with *face_id* equal to *attribute_id*.
      operationId: getAttributeSamples
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Samples'
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        404:
          description: attributes not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 22011
                desc: Object not found
                detail: Attributes with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22011
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - attributes

      summary: attribute samples options
      description: get options for the resource
      operationId: geteAttributeSamplesOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/faces:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - faces
      summary: create face
      description: |
        Create a new face. 
        
        The face can be attached to one or several lists.      
        
      operationId: createFace
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/New_Face'
          application/octet-stream:
            schema:
              type: object
        required: true
      responses:
        201:
          description: a face is created.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Location:
              schema:
                type: string
                pattern: ^/5/faces/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
              required: true
              description: face location.
              example: /5/faces/b5d6fd45-fcca-453d-ac05-3e594054b813
          content:
            application/json:
              schema:
                type: object
                properties:
                  face_id:
                    $ref: '#/components/schemas/uuid4'
                  url:
                    type: string
                    format: uri-reference
                required:
                - url
                - face_id
              example:
                face_id: b5d6fd45-fcca-453d-ac05-3e594054b813
                url: /5/faces/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'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
    get:
      tags:
      - faces
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/page_size'
      - $ref: '#/components/parameters/time__lt'
      - $ref: '#/components/parameters/time__gte'
      - $ref: '#/components/parameters/face_ids'
      - $ref: '#/components/parameters/external_id'
      - $ref: '#/components/parameters/user_data'
      - $ref: '#/components/parameters/list_id'
      - $ref: '#/components/parameters/get_face_target'

      summary: get faces
      description: Get faces according to filters.
      operationId: getFaces
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Face'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - faces

      summary: faces options
      description: get options for the resource
      operationId: getFacesOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/faces/count:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    get:
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/time__lt'
      - $ref: '#/components/parameters/time__gte'
      - $ref: '#/components/parameters/face_ids'
      - $ref: '#/components/parameters/external_id'
      - $ref: '#/components/parameters/user_data'
      - $ref: '#/components/parameters/list_id'
      tags:
      - faces
      summary: get face count
      description: Count faces according to the filters.
      operationId: getFacesCount
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_plain'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            text/plain:
              schema:
                type: object
                properties:
                  faces_count:
                    $ref: '#/components/schemas/count'
                required:
                - faces_count
              examples:
                some_faces_count:
                  value: "105"
        400:
          description: bad request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - faces

      summary: faces count options
      description: get options for the resource
      operationId: getFacesCountOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/faces/{face_id}:
    parameters:
    - in: path
      name: face_id
      schema:
        $ref: '#/components/schemas/uuid4'
      required: true
      description: ID of the face (face_id received in the "create face" request).
    - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - faces
      summary: get face
      description: Get face by ID.
      operationId: getFace
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/get_face_target'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Face'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 22016
                desc: Bad input data
                detail: '"invalid_target" is not valid target to get faces.
                  Valid target should be one of ["face_id", "attribute_id", "event_id", "user_data", "create_time", "external_id", "avatar", "lists"].'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22016
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: face not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002
        500:
          $ref: '#/components/responses/internal_server_error'
    patch:
      tags:
      - faces
      summary: patch face
      description: |
        Update face fields: user_data, external_id, attribute_id.
      operationId: patchFace
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Update_Face'
        required: true
      responses:
        204:
          description: Updated
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: face not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002
        500:
          $ref: '#/components/responses/internal_server_error'
    delete:
      tags:
      - faces
      summary: remove face
      description: |
        Remove face by ID. 
        
        When a face is removed, attributes (descriptors and basic attributes) linked to the face are deleted. Samples linked to the face are not deleted.
      operationId: deleteFace
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      responses:
        204:
          description: The resource was deleted successfully.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: face not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002
        500:
          $ref: '#/components/responses/internal_server_error'
    head:
      tags:
      - faces
      summary: check to exist a face
      description: Check a face with id=face_id existence
      operationId: checkFace
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: face not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - faces

      summary: face options
      description: get options for the resource
      operationId: getFaceOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/faces/{face_id}/attributes:
    parameters:
    - in: path
      name: face_id
      schema:
        $ref: '#/components/schemas/uuid4'
      required: true
      description: face id (face_id received in the "create face" request).
    - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - faces
      summary: get face attributes
      description: Get face attributes.
      operationId: getFaceAttributes
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Attributes'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: face not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - faces

      summary: face attributes options
      description: get options for the resource
      operationId: getFaceAttributesOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/faces/{face_id}/attributes/samples:
    parameters:
    - in: path
      name: face_id
      description: ID of the face (face_id received in the "create face" request). 
      schema:
        $ref: '#/components/schemas/uuid4'
      required: true
    - $ref: '#/components/parameters/cors_origin'

    get:
      tags:
      - faces
      summary: get samples of faces
      description: |
        Get samples associated with the attribute ID linked to the face.
      operationId: getFaceSamples
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Samples'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: Face not found
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                face_not_found:
                  value:
                    error_code: 22002
                    desc: Object not found
                    detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002
                face_without_attributes:
                  value:
                    error_code: 11032
                    desc: Object not found
                    detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' does not have attributes yet
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11032
                  summary: face does have any attributes

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

    options:
      tags:
      - faces

      summary: face attributes samples options
      description: get options for the resource
      operationId: getFaceAttributesSamplesOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/lists:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - lists
      summary: create list
      description: Create a new list.
      operationId: createList
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/New_List'
      responses:
        201:
          description: Created
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Location:
              schema:
                type: string
                pattern: ^/5/lists/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
              required: true
              description: list location.
              example: /5/lists/b5d6fd45-fcca-453d-ac05-3e594054b813
          content:
            application/json:
              schema:
                type: object
                properties:
                  list_id:
                    allOf:
                    - description: list id
                    - $ref: '#/components/schemas/uuid4'
                  url:
                    type: string
                    format: uri-reference
                    description: list location
                required:
                - url
                - list_id
              example:
                list_id: b5d6fd45-fcca-453d-ac05-3e594054b813
                url: /lists/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'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                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
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
    get:
      tags:
      - lists
      summary: get lists
      description: Get lists according to the filters.
      operationId: getLists
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/list_create_time__lt'
      - $ref: '#/components/parameters/list_create_time__gte'
      - $ref: '#/components/parameters/list_last_update_time__lt'
      - $ref: '#/components/parameters/list_last_update_time__gte'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/page_size10000'
      - $ref: '#/components/parameters/user_data'

      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/List'
        400:
          description: bad request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'user_data'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'


    options:
      tags:
      - lists

      summary: lists options
      description: get options for the resource
      operationId: getListsOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/lists/count:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - lists
      summary: get list count
      description: Count lists according to the filters.
      operationId:  getListCount
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/user_data'
      - $ref: '#/components/parameters/list_create_time__lt'
      - $ref: '#/components/parameters/list_create_time__gte'
      - $ref: '#/components/parameters/list_last_update_time__lt'
      - $ref: '#/components/parameters/list_last_update_time__gte'
      - $ref: '#/components/parameters/list_ids'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/text_plain'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            text/plain:
              schema:
                type: string
              examples:
                some_lists_count:
                  value: "15"
        400:
          description: bad request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'user_data'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - lists

      summary: lists count options
      description: get options for the resource
      operationId: getListsCountOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/lists/{list_id}:
    parameters:
    - in: path
      name: list_id
      schema:
        $ref: '#/components/schemas/uuid4'
      required: true
      description: list id  (list_id received in the "create list" request)
    - $ref: '#/components/parameters/cors_origin'

    get:
      tags:
      - lists
      summary: get list
      description: Get list by id
      operationId: getList
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/List'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: list not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 22003
                desc: Object not found
                detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003
        500:
          $ref: '#/components/responses/internal_server_error'
    head:
      tags:
      - lists
      summary: check list existence
      description:  Check existence of the list with `id=list_id`.
      operationId: checkList
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          description: OK
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: list not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        500:
          $ref: '#/components/responses/internal_server_error'
    patch:
      tags:
      - lists
      summary: update list
      description:  Update the *user_data* field of the list.
      operationId: patchList
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/New_List'
        required: true
      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          description: Updated
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12022
                desc: Bad/incomplete input data
                detail: "Failed to validate input json. Path: 'user_data',  message: 'user_data must be string'"
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                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
                list_not_found:
                  value:
                    error_code: 22003
                    desc: Object not found
                    detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003
        500:
          $ref: '#/components/responses/internal_server_error'
    delete:
      tags:
      - lists
      summary: delete list
      description: Delete list by id
      operationId: deleteList
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      - $ref: '#/components/parameters/with_faces'
      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          description: The resource was deleted successfully.
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: list not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 22003
                desc: Object not found
                detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - lists

      summary: list options
      description: get options for the resource
      operationId: getListOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/lists/{list_id}/faces:
    parameters:
    - in: path
      name: list_id
      schema:
        $ref: '#/components/schemas/uuid4'
      required: true
      description: list id (list_id received in the "create list" request)
    - $ref: '#/components/parameters/cors_origin'

    patch:
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      tags:
      - lists
      summary: attach/detach faces to the list
      description: Attach or detach faces to the list.
      operationId: linkFaces
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Link'
        required: true

      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          description: Updated
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''action'',  message: ''''detach1'' is not one of [''attach'', ''detach'']'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022

                list_not_found:
                  value:
                    error_code: 22003
                    desc: Object not found
                    detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003
                faces_not_found:
                  value:
                    error_code: 22004
                    desc: Object not found
                    detail: One or more faces not found, including face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22004
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: list not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 22003
                desc: Object not found
                detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - lists

      summary: link options
      description: get options for the resource
      operationId: getLinkerOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/matcher:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - matcher
      summary: matching
      description: |
        Matcher API allows to submit tasks to a service that searches for faces similar to a given reference(s) by
        matching them.

        >**Note!** *Descriptors must be extracted for reference(s) and candidate(s). Objects without descriptors cannot be matched.*

        The sources for references are events, attributes, face external IDs and faces. The sources for candidates are faces and lists.

        If reference source is attribute and there is face with specified ID, matching will be executed against attributes of this face.
      operationId: matching
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - in: header
        name: Content-Type
        schema:
          type: string
          enum:
          - application/json
      - in: query
        name: limit
        description: count of match result for each reference by every candidate list.
        schema:
          type: integer
          default: 3
          minimum: 1
          maximum: 100
      - $ref: '#/components/parameters/get_face_target_match'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Match_body'
        required: true
      responses:
        201:
          description: Created
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Match_result'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''action'',  message: ''''detach1'' is not one of [''attach'', ''detach'']'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
                list_not_found:
                  value:
                    error_code: 22003
                    desc: Object not found
                    detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003
                lists_not_found:
                  value:
                    error_code: 22003
                    desc: Object not found
                    detail: One or more lists not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003
                face_not_found:
                  value:
                    desc: Object not found
                    detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    error_code: 22002
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002
                faces_not_found:
                  value:
                    error_code: 22004
                    desc: Object not found
                    detail: One or more faces not found, including face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22004
                descriptor_not_extracted:
                  value:
                    desc: Bad/incomplete input data
                    detail: Descriptor for attribute '793877ae-171a-4810-8d29-ad7c0f404dfe' was not extracted
                    error_code: 11034
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11034
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_events_error'
        500:
          $ref: '#/components/responses/internal_server_error'
    options:
      tags:
      - matcher

      summary: matcher options
      description: get options for the resource
      operationId: getMatcherOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/handlers:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - handlers
      summary: create handler
      description: |
        Create a new handler. 
        
        The handler determines the list of rules (policies) for the processing of input images. 
        
        >After the handler is created, you should use the "create events" request to process images using the handler.        
      operationId: createHandler
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/New_Handler'
        required: true

      responses:
        201:
          description: Created
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Location:
              schema:
                type: string
                pattern: ^/5/handlers/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
              required: true
              description: hahdler location.
              example: /5/handlers/b5d6fd45-fcca-453d-ac05-3e594054b813
          content:
            application/json:
              schema:
                type: object
                properties:
                  handler_id:
                    $ref: '#/components/schemas/uuid4'
                  url:
                    type: string
                    format: uri-reference
                required:
                - handler_id
                - url
              example:
                handler_id: b5d6fd45-fcca-453d-ac05-3e594054b813
                url: /5/handlers/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'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                list_not_found:
                  value:
                    error_code: 22003
                    desc: Object not found
                    detail: List with id 'b5d6fd45-fcca-453d-ac05-3e594054b813' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003
                bad_json:
                  value:
                    error_code: 12027
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Message: ''{''policies'': {''create_face_policy'': {''create_faces'': [''create_faces must be 0 or 1''], ''filters'': {''gender'': [''gender must be 0 or 1'']}}}}'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12027
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
      - handlers
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/page_size'
      # - $ref: '#/components/parameters/time__lt'
      # - $ref: '#/components/parameters/time__gte'
      - in: query
        name: description
        schema:
          type: string
        description: find all the handlers with description similar to this parameter.

      summary: get handlers
      description: Get handlers by filters.
      operationId: getHandlers
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HandlerWithRequiredPolicies'
        400:
          description: bad request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'page'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        500:
          description: internal server error
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                internal_error:
                  value:
                    error_code: 11009
                    detail: internal server error
                    desc: internal server error
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11009
                invalid_handler:
                  value:
                    error_code: 35002
                    detail: Invalid handler with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37'
                    desc: Handler is not supported
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-35002

    options:
      tags:
      - handlers

      summary: handlers options
      description: get options for the resource
      operationId: getHandlersOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/handlers/count:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - handlers
      summary: get handler count
      description: Count handlers.
      operationId:  getHandlerCount
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - in: query
        name: description
        schema:
          type: string
        description: Find all the handlers with description similar to this parameter.
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: object
                properties:
                  handlers_count:
                    $ref: '#/components/schemas/count'
                required:
                - handlers_count
        400:
          description: bad request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'description'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - handlers

      summary: handler count options
      description: get options for the resource
      operationId: getHandlersCountOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/handlers/{handler_id}:
    parameters:
    - in: path
      name: handler_id
      schema:
        $ref: '#/components/schemas/uuid4'
      required: true
      description: handler id
    - $ref: '#/components/parameters/cors_origin'

    get:
      tags:
      - handlers
      summary: get handler
      description: Get handler by ID.
      operationId: getHandler
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HandlerWithRequiredPolicies'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        404:
          description: handler not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 11033
                desc: Object not found
                detail: Handler with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11033
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          description: internal server error
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                internal_error:
                  value:
                    error_code: 11009
                    detail: internal server error
                    desc: internal server error
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11009
                invalid_handler:
                  value:
                    error_code: 35002
                    detail: Invalid handler with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37'
                    desc: Handler is not supported
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-35002
    put:
      tags:
      - handlers
      summary: update handler
      description: |
        Update a handler. You cannot update a part of a handler, so you must specify all the fields for your handler.
      operationId: putHandler
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/New_Handler'
        required: true

      responses:
        204:
          description: Updated
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                list_not_found:
                  value:
                    error_code: 22003
                    desc: Object not found
                    detail: List with id 'b5d6fd45-fcca-453d-ac05-3e594054b813' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003
                bad_json:
                  value:
                    error_code: 12027
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Message: ''{''policies'': {''create_face_policy'': {''create_faces'': [''create_faces must be 0 or 1''], ''filters'': {''gender'': [''gender must be 0 or 1'']}}}}'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12027
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        404:
          description: handler not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 11033
                desc: Object not found
                detail: Handler with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11033
        500:
          $ref: '#/components/responses/internal_server_error'
    head:
      tags:
      - handlers
      summary: check to exist a handler
      description:  Check a handler with `id=handler_id` existence.
      operationId: checkHandler
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          description: OK
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: handler not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
      - handlers
      summary: remove handler
      description: Remove handler by id.
      operationId: removeHandler
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          description: The resource was deleted successfully.
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        404:
          description: handler not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 11033
                desc: Object not found
                detail: Handler not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11033
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - handlers

      summary: handler options
      description: get options for the resource
      operationId: getHandlerOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/handlers/{handler_id}/events:
    parameters:
    - in: path
      name: handler_id
      schema:
        $ref: '#/components/schemas/uuid4'
      required: true
      description: handler id
    - $ref: '#/components/parameters/cors_origin'

    post:
      tags: [events]
      summary: generate events
      description: |
        Process images using the specified handler and generate events.

        If the Events service support is disabled on the server, events will not be saved to the database.
      operationId: generateEvents
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'
      - $ref: '#/components/parameters/luna_event_time'
      - $ref: '#/components/parameters/multiple_images_content_type'
      - in: query
        name: external_id
        schema:
          $ref: '#/components/schemas/event_external_id'
        description: external ID for created faces.
      - in: query
        name: user_data
        schema:
          $ref: '#/components/schemas/event_user_data'
        description: User data for created faces
      - $ref: '#/components/parameters/warped_image'

      - $ref: '#/components/parameters/aggregate_attributes'
      - in: query
        name: source
        schema:
          $ref: '#/components/schemas/Source'
        description: Additional information, provided by user with event.

      - $ref: '#/components/parameters/tags'
      requestBody:
        content:
          image/jpeg:
            schema:
              type: string
              format: binary
          image/png:
            schema:
              type: string
              format: binary
          image/bmp:
            schema:
              type: string
              format: binary
          image/x-portable-pixmap:
            schema:
              type: string
              format: binary
          image/tiff:
            schema:
              type: string
              format: binary
          image/x-jpeg-base64:
            schema:
              type: string
              format: base64
          image/x-png-base64:
            schema:
              type: string
              format: base64
          image/x-bmp-base64:
            schema:
              type: string
              format: base64
          image/x-tiff-base64:
            schema:
              type: string
              format: base64
          image/x-portable-pixmap-base64:
            schema:
              type: string
              format: base64
          multipart/form-data:
            schema:
              type: object
              properties:
                filename:
                  oneOf:
                    - type: array
                      items:
                        anyOf:
                        - type: string
                          format: binary
                        - type: string
                          format: base64
                    - type: string
                      format: binary
                    - type: string
                      format: base64
            encoding:
              filename:
                contentType: image/jpeg, image/png, image/bmp, image/x-portable-pixmap, image/tiff, image/x-jpeg-base64,
                  image/x-png-base64, image/x-bmp-base64, image/x-tiff-base64, image/x-portable-pixmap-base64
          application/json:
            schema:
              $ref: '#/components/schemas/DetectOrEmitEventJsonRequestBody'
        required: true
      responses:
        201:
          description: Created
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: object
                properties:
                  events:
                    type: array
                    items:
                      $ref: '#/components/schemas/EventFromHandler'
                  detections:
                    $ref: '#/components/schemas/Detected_images'
                required: ["events", "detections"]
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'estimate_eyes_attributes'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_conten_type_download_image:
                  value:
                    error_code: 11028
                    desc: Bad/incomplete input data
                    detail: 'Bad content type of image ''https://www.google.ru'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11028
                bad_conten_type_multepart:
                  value:
                    error_code: 11029
                    desc: Bad/incomplete input data
                    detail: Bad content type of image in multipart body
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11029
                failed_load_image:
                  value:
                    error_code: 11027
                    desc: External request failed
                    detail: 'Failed  to download image by url ''https://www.gooogle.ru'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11027
                boundary_missed_multipart:
                  value:
                    error_code: 11049
                    desc: Bad/incomplete input data
                    detail: "Failed to read multipart: boundary missed for Content-Type: multipart/form-data"
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11049
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_handlers_error'
        404:
          description: handler not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 11033
                desc: Object not found
                detail: Handler with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11033
        500:
          description: internal server error
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                internal_error:
                  value:
                    error_code: 11009
                    detail: internal server error
                    desc: internal server error
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11009
                invalid_handler:
                  value:
                    error_code: 35002
                    detail: Invalid handler with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37'
                    desc: Handler is not supported
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-35002

    options:
      tags:
      - events

      summary: generate events options
      description: get options for the resource
      operationId: generateEventsOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/events/statistic:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - events
      summary: get statistics on events.
      description: |
        Get event statistics by target(s) with applied filters.

        Event fields and/or functions (count, min, etc.) can be set as targets for aggregation of events.
               
        Grouping by frequency or grouping by time intervals is available.
      operationId: getEventStats
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/getEventStats'
            example:
              targets:
                - column: event_id
                  aggregator: count
                - column: age
                  aggregator: group_by
                - column: gender
                  aggregator: group_by
              filters:
                - column: source
                  operator: eq
                  value: Main_hall_camera
              period:
                - operator: gt
                  value: 2020-02-04T00:00:00Z
                - operator: lt
                  value: 2020-02-06T00:00:00Z
              group_by: dayOfWeek
        required: true
      responses:
        200:
          description: Created
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: object
                properties:
                  fields:
                    type: array
                    items:
                      type: string
                    description: |
                      Response has the following structure:
                      - The first element of the list is `Group by time` section if request includes time or frequency grouping;
                      - The next elements are fields with the `group_by` function set;   
                      - Other elements are pairs of columns and aggregators for the columns.

                      The fields and functions pairs in the "fields" section are in the same order as in the "stats" section.
                  stats:
                    type: array
                    items:
                      anyOf:
                        - type: integer
                        - type: number
                        - type: string
                        - type: array
                    description: any type of items
              examples:
                count_dayOfWeek:
                  value:
                    fields:
                      - "Group by time: dayOfWeek"
                      - "gender, aggregator 'group_by'"
                      - "age, aggregator 'group_by'"
                      - "event_id, aggregator 'count'"
                    stats:
                    - - Tuesday
                      - 0
                      - 22
                      - 45
                    - - Tuesday
                      - 0
                      - 27
                      - 23
                    - - Tuesday
                      - 1
                      - 27
                      - 45
                    - - Wednesday
                      - 0
                      - 25
                      - 34
                    - - Wednesday
                      - 1
                      - 33
                      - 345

        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_events_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - events

      summary: events statistics options
      description: get options for the resource
      operationId: geteEventsStatisticsOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/events:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - events
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/get_event_target'
      - $ref: '#/components/parameters/create_time__gte'
      - $ref: '#/components/parameters/create_time__lt'
      - $ref: '#/components/parameters/sources'
      - $ref: '#/components/parameters/top_similar_face_list'
      - $ref: '#/components/parameters/top_similar_face_ids'
      - $ref: '#/components/parameters/top_similar_face_similarity__gte'
      - $ref: '#/components/parameters/top_similar_face_similarity__lt'
      - $ref: '#/components/parameters/age__lt'
      - $ref: '#/components/parameters/age__gte'
      - $ref: '#/components/parameters/gender'
      - $ref: '#/components/parameters/emotions'
      - $ref: '#/components/parameters/ethnic_groups'
      - $ref: '#/components/parameters/face_ids'
      - $ref: '#/components/parameters/event_ids'
      - $ref: '#/components/parameters/handler_ids'
      - $ref: '#/components/parameters/external_ids'
      - $ref: '#/components/parameters/user_data'
      - $ref: '#/components/parameters/tags'
      - $ref: '#/components/parameters/order'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/page_size'

      summary: get events
      description: |
        Get events that satisfy filters.
        The `target` parameter determines field that will be shown for each event. If target is not set, the response will contain all the fields.
      operationId: getEvents
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EventsWithCount'
        400:
          description: bad request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'create_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_events_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - events

      summary: events options
      description: get options for the resource
      operationId: geteEventsOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/events/{event_id}:
    parameters:
    - in: path
      name: event_id
      schema:
        $ref: '#/components/schemas/uuid4'
      required: true
      description: event id
    - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - events
      summary: get event
      description: Get event by ID.
      operationId: getEvent
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Event'
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_events_error'
        404:
          description: event not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 23001
                desc: Object not found
                detail: Event with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-23001
        500:
          $ref: '#/components/responses/internal_server_error'
    head:
      tags:
      - events
      summary: check event existence
      description: Check existence of the event with `id=event_id`.
      operationId: checkEvent
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: Event not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - events

      summary: event options
      description: get options for the resource
      operationId: geteEventOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'

  /5/tasks/clustering:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - task processing

      summary: clustering task
      description: |
        Create a new clustering task.

        The Filters section enables to specify filters for faces or events clustering. Objects corresponding to all of the filters will be added to the cluster. 

        Available filters depend on the object type: events or faces. 

      operationId: createClusteringTask
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      - $ref: '#/components/parameters/required_luna_account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClusteringTask'
        required: true

      responses:
        202:
          description: Accepted
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: object
                properties:
                  task_id:
                    $ref: '#/components/schemas/task_id'
                required:
                - task_id
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_json_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'create_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - task processing

      summary: clustering options
      description: get options for the resource
      operationId: getClusteringOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/linker:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - task processing

      summary: linker task
      description: |
        Create a new linker task.

        The task enables you to attach faces to the specified list according to the filters. 
        
        You can use faces or events as objects for the task. When events are used, a new face is created for each of the events.

        A list is required for the task processing:
        - If you specified a list, the Tasks service checks its existence. If there is no such a list, it will be created.
        - If you set new list creation using *create_list = 1*, a new list is created.
        
      operationId: createLinkerTask
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      - $ref: '#/components/parameters/required_luna_account_id'

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LinkerTask'
        required: true

      responses:
        202:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: object
                properties:
                  task_id:
                    $ref: '#/components/schemas/task_id'
                required:
                  - task_id
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  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
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - task processing

      summary: linker options
      description: get options for the resource
      operationId: getTaskLinkerOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/gc:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - task processing

      summary: garbage collection task
      description: |

        Task is not available  because all attributes is temporary and will be removed automatically.

      operationId: createGCTask
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      responses:
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 35000
                    desc: Bad/incomplete input data
                    detail: Attributes gc is not available
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-35000
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - task processing

      summary:  gc options
      description: get options for the resource
      operationId: getGCOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/reporter:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - task processing

      summary: reporter task
      description: |
        Create a report in csv format for a task. 
        
        Now the report is only created for clustering tasks. 
        
        The report contains additional information about clustering objects (faces or events). You can specify additional information that will be added to the report. 
        The first and the second columns in the report always correspond to a cluster number and an object ID.
        
      operationId: createReporterTask
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      - $ref: '#/components/parameters/required_luna_account_id'

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReporterTask'
        required: true

      responses:
        202:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: object
                properties:
                  task_id:
                    $ref: '#/components/schemas/task_id'
                required:
                - task_id
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  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
                task_not_foud:
                  value:
                    error_code: 28001
                    desc: Object not found
                    detail: Task with id '147' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28001
                bad_task_type:
                  value:
                    error_code: 28013
                    desc: Bad/incomplete input data
                    detail: Tasks with type '0' does not support a build report
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28013
                bad_task_status:
                  value:
                    error_code: 28015
                    desc: Bad/incomplete input data
                    detail: Tasks with type '0' does not support a build report
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28015
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'

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

    options:
      tags:
      - task processing

      summary: reporter options
      description: get options for the resource
      operationId: getReporterOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/cross_match:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - task processing

      summary: cross-matching task
      description: |
        Create a new cross-matching task. 
        
        The cross-matching task enables you to compare references (faces or events) with candidates (faces or events) according to the specified filters.
        
        All the references are matched with all the candidates. 
        
        You can limit the number of candidates returned in matching results and set the minimum acceptable similarity threshold.        
      operationId: createCrossMatchTask
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      - $ref: '#/components/parameters/required_luna_account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CrossMatchTask'
        required: true

      responses:
        202:
          description: Accepted
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: object
                properties:
                  task_id:
                    $ref: '#/components/schemas/task_id'
                required:
                - task_id
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_json_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'create_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
    options:
      tags:
      - task processing

      summary: cross match options
      description: get options for the resource
      operationId: getCrossMatchOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/roc:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    post:
      tags:
      - task processing

      summary: ROC-curve calculating task
      description:  |
        create a ROC-curve calculating task. 
        
        ROC (or Receiver Operating Characteristic) is a performance measurement for the classification problem at various threshold settings. The ROC-curve is plotted with TPR (True Positive Rate) against the FPR (False Positive Rate). 
        
        TPR is a true positive match pair count divided by a count of total expected positive match pairs, and FPR is a false positive match pair count divided by a count of total expected negative match pairs. Each point (FPR, TPR) of the ROC-cure corresponds to a certain similarity threshold. 
        
        Using ROC the model performance is determined by looking at the area under the ROC-curve (or AUC) and the ROC-curve and the secondary main diagonal intersection point, where type I and type II error rates are equal. The model performance also determined by getting into the top-N probability, i.e. probability of getting a positive match pair into the top-N for any match result group sorted by similarity.
      operationId: createROCTask
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      - $ref: '#/components/parameters/required_luna_account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ROCTask'
        required: true

      responses:
        202:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                type: object
                properties:
                  task_id:
                    $ref: '#/components/schemas/task_id'
                required:
                  - task_id
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  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
                task_not_foud:
                  value:
                    error_code: 28001
                    desc: Object not found
                    detail: Task with id '147' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28001
                bad_task_type:
                  value:
                    error_code: 28013
                    desc: Bad/incomplete input data
                    detail: Tasks with type '0' does not support a build report
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28013
                bad_task_status:
                  value:
                    error_code: 28015
                    desc: Bad/incomplete input data
                    detail: Tasks with type '0' does not support a build report
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28015
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - task processing

      summary: roc options
      description: get options for the resource
      operationId: getRocOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - tasks

      summary: get tasks
      description: Get tasks according to the filters.
      operationId: getTasks
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/page_size'
      - $ref: '#/components/parameters/create_time__lt'
      - $ref: '#/components/parameters/create_time__gte'
      - $ref: '#/components/parameters/end_time__lt'
      - $ref: '#/components/parameters/end_time__gte'
      - $ref: '#/components/parameters/task_ids'
      - $ref: '#/components/parameters/task_type'
      - $ref: '#/components/parameters/task_status'
      - $ref: '#/components/parameters/luna_account_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tasks'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'create_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - tasks
      summary: tasks options
      description: get options for the resource
      operationId: getTasksOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/count:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - tasks

      summary: get tasks count
      description: Count tasks according to the filters.
      operationId: getTasksCount
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/create_time__lt'
      - $ref: '#/components/parameters/create_time__gte'
      - $ref: '#/components/parameters/end_time__lt'
      - $ref: '#/components/parameters/end_time__gte'
      - $ref: '#/components/parameters/task_ids'
      - $ref: '#/components/parameters/task_type'
      - $ref: '#/components/parameters/task_status'
      - $ref: '#/components/parameters/luna_account_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/taskCount'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'create_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - tasks

      summary: tasks count options
      description: get options for the resource
      operationId: getTasksCountOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/{task_id}:
    parameters:
    - in: path
      name: task_id
      schema:
        type: integer
        minimum: 1
      required: true
      description: task id
    - $ref: '#/components/parameters/cors_origin'

    get:
      tags:
      - tasks

      summary: get task
      description: Get task by ID.
      operationId: getTask
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: 'Luna-Account-Id header is not UUID4, format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          description: task not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 28001
                    desc: Object not found
                    detail: Task with id '146' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28001
        500:
          $ref: '#/components/responses/internal_server_error'

    patch:
      tags:
      - tasks

      summary: cancel task
      description: Cancel task by ID.
      operationId: cancelTask
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'

      responses:
        202:
          description: Canceling
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: task not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 28001
                    desc: Object not found
                    detail: Task with id '146' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28001
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
      - tasks

      summary: delete task
      description: Delete a task and the task results by the task ID.
      operationId: deleteTask
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - in: path
        name: task_id
        schema:
          type: integer
          minimum: 1
        required: true
        description: task id
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_luna_account_id'

      responses:
        204:
          description: Deleted
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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
                task_can_not_canceled:
                  value:
                    error_code: 28019
                    desc: Bad/incomplete input data
                    detail: Task '146' with status 5 can not canceled
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28019
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: task not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 28001
                    desc: Object not found
                    detail: Task with id '146' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28001
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - tasks

      summary: task options
      description: get options for the resource
      operationId: getTaskOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/{task_id}/result:
    parameters:
    - in: path
      name: task_id
      schema:
        type: integer
        minimum: 1
      required: true
      description: task id
    - $ref: '#/components/parameters/cors_origin'

    get:
      tags:
      - tasks

      summary: get task result
      description: Get task result by the task ID.
      operationId: getTaskResult
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              schema:
                type: string
                enum:
                - application/json
                - application/zip
              required: true
              description: content type of body
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Disposition:
              $ref: '#/components/headers/content_disposition'
            Transfer-Encoding:
              $ref: '#/components/headers/transfer_encoding'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/GCTaskResult'
                  - $ref: '#/components/schemas/ClusteringTaskResult'
                  - $ref: '#/components/schemas/LinkerTaskResult'
                  - $ref: '#/components/schemas/CrossMatchTaskResult'
                  - $ref: '#/components/schemas/ROCTaskResult'
            application/zip:
              schema:
                type: string
                format: binary
                description: |
                  zip archive with task result (now zip is supported in tasks on reports).

                  Csv file and optional a folder with images in the case clustering report.

                  | cluster | event_id                             | create_time                      | external_id | handler_id                           | attribute_id                         | source | top_similar_face_id | top_similar_face_list | top_similar_face_similarity | face_id                              | gender | age | emotion | ethnic_group | user_data                         |
                  |---------|--------------------------------------|----------------------------------|-------------|--------------------------------------|--------------------------------------|--------|---------------------|-----------------------|-----------------------------|--------------------------------------|--------|-----|---------|--------------|-----------------------------------|
                  | 0       | 6a4053de-17ab-40b5-bf2b-a1495df39085 | 2019-02-13T18:04:40.723800+03:00 |             | d727b3f5-e8ca-4fca-b092-d170ef5f9e49 | b3f9e82d-1654-4250-b39e-f8bbbca9880c |        |                     |                       |                             | cfb8ca11-4901-4296-a71d-0783d61ccf05 | 1      | 28  |         | 2            | vl test events_with_created_faces |
                  | 1       | 110cc2d3-0350-418e-b956-90ef4dacbd23 | 2019-02-13T18:04:40.723800+03:00 |             | d727b3f5-e8ca-4fca-b092-d170ef5f9e49 | 3e1d0ffb-1fa6-449e-8c8b-8f9b56bfff6d |        |                     |                       |                             | f4f17cbe-9197-4347-b214-692fa4ca9f26 | 0      | 24  |         | 2            | vl test events_with_created_faces |
                  | 2       | 9a9c9445-6a3d-4f4d-b22a-64601f4c8675 | 2019-02-13T18:04:40.723800+03:00 |             | d727b3f5-e8ca-4fca-b092-d170ef5f9e49 | 91a7fd34-0877-46f5-844c-e88fd28d68f0 |        |                     |                       |                             | 83086070-bce2-40b9-a5c4-9df36a52fe4f | 0      | 19  |         | 4            | vl test events_with_created_faces |
                  | 2       | 979be9cd-6363-431a-a8a6-3f3fff806abf | 2019-02-13T18:04:40.723800+03:00 |             | d727b3f5-e8ca-4fca-b092-d170ef5f9e49 | 2cfacb32-fc7a-4abd-8518-0bf759acc4f9 |        |                     |                       |                             | e09228a7-8a7e-4581-b550-d5c0818c871f | 0      | 28  |         | 4            | vl test events_with_created_faces |
                  | 3       | 60b86bf7-3395-40cf-90f0-4e0756f50b9e | 2019-02-13T18:04:40.723800+03:00 |             | d727b3f5-e8ca-4fca-b092-d170ef5f9e49 | 67c823db-8e3c-4638-abf9-63078d2687d5 |        |                     |                       |                             | 301e8eb8-b6af-4c33-b5a1-6861509d2df4 | 1      | 56  |         | 4            | vl test events_with_created_faces |

        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: object not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                task_not_found:
                  value:
                    error_code: 28001
                    desc: Object not found
                    detail: Task with id '146' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28001
                task_result_not_found:
                  value:
                    error_code: 28017
                    desc: Object not found
                    detail: Result of the task '146' not found
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28017
                task_does_not_have_result_yet:
                  value:
                    error_code: 28018
                    desc: Object not found
                    detail: task '146' does not have result yet
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28018
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - tasks
      summary: task result options
      description: get options for the resource
      operationId: getTasksResultOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/{task_id}/errors:
    parameters:
    - in: path
      name: task_id
      schema:
        type: integer
        minimum: 1
      required: true
      description: task id
    - $ref: '#/components/parameters/cors_origin'

    get:
      tags:
      - task errors

      summary: get task errors 
      description: Get errors of a task by the task ID.
      operationId: getTaskErrors
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_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'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskErrors'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'create_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - task errors

      summary: task errors options
      description: get options for the resource
      operationId: getTaskErrorsOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/{task_id}/subtasks:
    parameters:
    - in: path
      name: task_id
      schema:
        type: integer
        minimum: 1
      required: true
      description: task id
    - $ref: '#/components/parameters/cors_origin'

    get:
      tags:
      - tasks

      summary: get subtasks
      description: Get subtasks of a task by ID.
      operationId: getSubTasks
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubTasks'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'create_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - tasks

      summary: subtasks options
      description: get options for the resource
      operationId: getSubTasksOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/errors:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - task errors

      summary: get errors
      description: Get errors according to the filters.
      operationId: getErrors
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/page_size'
      - $ref: '#/components/parameters/task_ids'
      - $ref: '#/components/parameters/error_code'
      - $ref: '#/components/parameters/error_ids'
      - $ref: '#/components/parameters/error_time__lt'
      - $ref: '#/components/parameters/error_time__gte'
      - $ref: '#/components/parameters/task_type'
      - $ref: '#/components/parameters/status_code'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskErrors'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'create_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
    options:
      tags:
      - task errors

      summary: errors options
      description: get options for the resource
      operationId: getErrorsOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/errors/count:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - task errors

      summary: get errors count
      description: Count errors according to the filters.
      operationId: getErrorsCount
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/error_time__lt'
      - $ref: '#/components/parameters/error_time__gte'
      - $ref: '#/components/parameters/task_type'
      - $ref: '#/components/parameters/status_code'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorCount'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'create_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
    options:
      tags:
      - task errors

      summary: task errors count options
      description: get options for the resource
      operationId: getTasksErrorsCountOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/tasks/errors/{error_id}:
    parameters:
    - in: path
      name: error_id
      schema:
        type: integer
        minimum: 1
      required: true
      description: error id
    - $ref: '#/components/parameters/cors_origin'

    get:
      tags:
      - task errors

      summary: get error
      description: Get error by ID.
      operationId: getTaskError
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/error_id'
      - $ref: '#/components/parameters/luna_account_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskError'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'create_time__lt'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    options:
      tags:
      - task errors

      summary: error options
      description: get options for the resource
      operationId: getTasksErrorsOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/liveness:
    parameters:
      - $ref: '#/components/parameters/cors_origin'

    post:
      tags: [liveness]
      summary: predict liveness
      description: |

        Predict liveness probability in input images.

        The response contains the probability that there is a real person in the image, and it is not a presentation attack.

        "meta" and "x_meta" sections of the request are used for backward compatibility and are deprecated now.

        The incoming images should correspond the requirements of the utilized Liveness. See "Administrator’s manual" for details. 

        *Liveness estimation is not supported for samples (warped images).* 

      operationId: predictLiveness
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_account_id'
      - $ref: '#/components/parameters/multiple_images_content_type'

      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              description: filename in the header of the subpart (content-disposition header) MUST be supplied.
              properties:
                meta:
                  $ref: '#/components/schemas/LivenessMeta'
                  deprecated: true
                x_meta:
                  type: object
                  description: The JSON string with any additional information
                  deprecated: true
                image:
                  $ref: '#/components/schemas/image_list_for_multipart'
              required: [image]
            encoding:
              image:
                contentType: image/jpeg, image/png, image/bmp, image/x-portable-pixmap, image/tiff, image/x-jpeg-base64,
                  image/x-png-base64, image/x-bmp-base64, image/x-tiff-base64, image/x-portable-pixmap-base64
          application/json:
            schema:
              type: object
              properties:
                meta:
                  $ref: '#/components/schemas/LivenessMeta'
                x_meta:
                  type: object
                  description: The JSON string with any additional information
                  deprecated: true
                urls:
                  $ref: '#/components/schemas/ListOfUrlsWithImages'
              required: [urls]
          image/jpeg:
            schema:
              type: string
              format: binary
          image/png:
            schema:
              type: string
              format: binary
          image/bmp:
            schema:
              type: string
              format: binary
          image/x-portable-pixmap:
            schema:
              type: string
              format: binary
          image/tiff:
            schema:
              type: string
              format: binary
          image/x-jpeg-base64:
            schema:
              type: string
              format: byte
          image/x-png-base64:
            schema:
              type: string
              format: byte
          image/x-bmp-base64:
            schema:
              type: string
              format: byte
          image/x-tiff-base64:
            schema:
              type: string
              format: byte
          image/x-portable-pixmap-base64:
            schema:
              type: string
              format: byte
        required: true
      responses:
        200:
          description: Success
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/liveness_response'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'devices'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_conten_type_download_image:
                  value:
                    error_code: 11028
                    desc: Bad/incomplete input data
                    detail: 'Bad content type of image ''https://www.google.ru'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11028
                bad_conten_type_multepart:
                  value:
                    error_code: 11029
                    desc: Bad/incomplete input data
                    detail: Bad content type of image in multipart body
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12029
                failed_load_image:
                  value:
                    error_code: 11027
                    desc: External request failed
                    detail: 'Failed  to download image by url ''https://www.gooogle.ru'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11027
                boundary_missed_multipart:
                  value:
                    error_code: 11049
                    desc: Bad/incomplete input data
                    detail: "Failed to read multipart: boundary missed for Content-Type: multipart/form-data"
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11049
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/ws:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    get:
      tags:
      - ws
      summary: ws handshake
      description: |
        ws handshake
        > ### 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
      security:
        - BasicAuth: []
        - LunaAccountIdAuth: []
      parameters:
        - $ref: '#/components/parameters/required_luna_account_id'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/handler_ids'
        - $ref: '#/components/parameters/sources'
        - $ref: '#/components/parameters/top_similar_face_lists'
        - $ref: '#/components/parameters/top_similar_face_similarity__gte'
        - $ref: '#/components/parameters/top_similar_face_similarity__lt'
        - $ref: '#/components/parameters/age__lt'
        - $ref: '#/components/parameters/age__gte'
        - $ref: '#/components/parameters/gender'
        - $ref: '#/components/parameters/ethnic_groups'
        - $ref: '#/components/parameters/tags'

      responses:
        101:
          description: Success handshake
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message_from_ws'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
          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 'estimate_quality'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_sender_error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/docs/spec:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    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'
  /5/docs/dev:
    parameters:
      - $ref: '#/components/parameters/cors_origin'
    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'
  /5/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-22011
        500:
          $ref: '#/components/responses/internal_server_error'
  /5/plugins:
    get:
      tags:
        - plugins
      summary: get list of plugins
      description: |
        Get list of service plugins
      operationId: getPlugins
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/plugins'
        500:
          $ref: '#/components/responses/internal_server_error'
  /metrics:

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

    options:
      tags:
        - health

      summary: health options
      description: get options for the resource
      operationId: getHealthOptions

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Allow:
              $ref: '#/components/headers/allow_methods'
            Access-Control-Allow-Origin:
              $ref: '#/components/headers/access_control_allow_origin'
            Access-Control-Allow-Headers:
              $ref: '#/components/headers/access_control_allow_headers'
            Access-Control-Allow-Methods:
              $ref: '#/components/headers/access_control_allow_methods'
            Access-Control-Max-Age:
              $ref: '#/components/headers/access_control_max_age'
        500:
          $ref: '#/components/responses/internal_server_error'
  /healthcheck:
    get:
      tags:
        - health
      summary: get health (redirect)
      description: get health of service (redirect)
      operationId: healthcheck(redirect)
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/include_luna_services'
      responses:
        200:
          description: OK (redirected)
          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'
        308:
          description: Moved permanently
          headers:
            Location:
              schema:
                type: string
                enum:
                  - "/6/healthcheck"
              required: true
              description: redurect to the versioned resource
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        500:
          $ref: '#/components/responses/internal_server_error'

        502:
          description: Unhealthy (redirected)
          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'