openapi: 3.0.0
info:
  version: 'v.1.2.0'
  title: 'Luna-Handlers'
  description: 'VisionLabs Luna Handlers API'

servers:
- description: SwaggerHub API Auto Mocking
  url: https://virtserver.swaggerhub.com/visionlabs/Luna3API/v.1.2.0


components:
  headers:
    application_json:
      schema:
        type: string
        enum:
        - application/json
      required: true
      description: content type is application/json

    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]{4}$
      description: request id. Helps to uniquely identify messages that correspond to particular requests, in system logs.
      required: true

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

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

    application_json_or_msgpack_content:
      schema:
        type: string
        default: application/json
        enum:
          - application/json
          - application/msgpack
      description: The response content type header.  Depends on Accept header in the request.
  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, system will set it in default format ("timestamp,UUID"). It will be returned with response.
      name: Luna-Request-Id

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

    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"

    city:
      in: query
      name: city
      schema:
        $ref: '#/components/schemas/location_str'
      description: Event city
      example: "New-York"

    area:
      in: query
      name: area
      schema:
        $ref: '#/components/schemas/location_str'
      description: Event area
      example: "central park"

    district:
      in: query
      name: district
      schema:
        $ref: '#/components/schemas/location_str'
      description: Event district
      example: "mitino"

    street:
      in: query
      name: street
      schema:
        $ref: '#/components/schemas/location_str'
      description: Event street
      example: "arbat"

    house_number:
      in: query
      name: house_number
      schema:
        $ref: '#/components/schemas/location_str'
      description: Event house number
      example: "1/2str3"

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

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

    detector_multiface_policy:
      in: query
      name: multiface_policy
      schema:
        $ref: '#/components/schemas/multiface_policy'
      description: |
        multiple face detection policy:

        - *`0`* - multiple face detection not allowed

        - *`1`* - multiple face detection allowed

        - *`2`* - get best face detection from the image

    detect_face:
      in: query
      name: detect_face
      schema:
        allOf:
          - default: 0
          - $ref: '#/components/schemas/detect_face'
      description: |
        whether to detect faces on the image.

    detect_body:
      in: query
      name: detect_body
      schema:
        allOf:
          - default: 0
          - $ref: '#/components/schemas/detect_body'
      description: |
        whether to detect human bodies on the image.

    estimate_body_warp:
      in: query
      name: estimate_body_warp
      schema:
        $ref: '#/components/schemas/estimate_head_pose'
      description: |
        whether to estimate human body warp on the image.

    estimate_face_warp:
      in: query
      name: estimate_face_warp
      schema:
        $ref: '#/components/schemas/estimate_head_pose'
      description: |
        whether to estimate human face warp on the image.

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

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

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

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

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

    extract_exif:
      in: query
      name: extract_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.

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

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

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

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

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

    estimate_liveness:
      in: query
      name: estimate_liveness
      schema:
        $ref: '#/components/schemas/int01'
      description: |
        whether to estimate liveness on the image.

        ⚠ **Good quality only on webcam or selfie photos**: otherwise the result may be incorrect.

    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.

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

      description: |
        filter by mask states.

        | masks      | value |
        |----------------|---|
        | missing        | 1 |
        | medical_mask   | 2 |
        | occluded       | 3 |

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

    estimate_body_descriptor:
      in: query
      name: estimate_body_descriptor
      schema:
        $ref: '#/components/schemas/extract_descriptor'
      description: |
          whether to estimate human body descriptor(s).

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

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

      description: |
          whether to aggregate face descriptor(s).

          If true, all extracted attributes will be aggregated and stored as a single attribute.
          Otherwise, all attributes will be stored for each sample.

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

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

    score_threshold:
      in: query
      name: score_threshold
      schema:
        $ref: '#/components/schemas/score_threshold'
      description: |
        descriptor quality score threshold. All the attributes with 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).

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


    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.

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

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

    descriptor_version:
      in: query
      name: descriptor_version
      schema:
        type: integer
        enum: [46, 52, 54, 56]
      description: |
          Descriptor version. Default descriptor version from config is used if not specified.
          Used only if *extract_descriptor* equal *1*.
      required: false
      example: 54

    force_upgrade:
      in: query
      name: force_upgrade
      schema:
        type: integer
        enum: [0, 1]
        default: 0
      description: whether to force update existing attribute's samples
      required: false

    is_dynamic:
      in: query
      name: is_dynamic
      schema:
        $ref: '#/components/schemas/is_dynamic'
      description: whether to get only dynamic (1) or non-dynamic (0) handlers
      required: false

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

    longitude:
      in: query
      name: longitude
      schema:
        type: number
        minimum: -180
        maximum: 180
      description: |
        longitude in degrees, a part of composite geo position.
        Geo position is considered as properly specified if both *longitude* and *latitude* are set.
      example: 36.616

    latitude:
      in: query
      name: latitude
      schema:
        type: number
        minimum: -90
        maximum: 90
      description: |
        latitude in degrees, a part of composite geo position.
        Geo position is considered as properly specified if both *longitude* and *latitude* are set.
      example: 55.752

    image_type:
      in: query
      name: image_type
      schema:
        type: integer
        default: 0
        enum: [0,1,2]
        description: image type of input image.  0 - raw image, 1 - face warped image, 2 - body warped image

    ttl:
      in: query
      name: ttl
      schema:
        type: integer
        default: 300
        maximum: 86400
        minimum: 1
      description: lifetime for temporary attribute (seconds)

    source:
      in: query
      name: source
      schema:
        $ref: '#/components/schemas/source'
      description: Additional information, provided by user with event.
      example: "3rd Avenue"

    verifier_description:
      in: query
      name: description
      schema:
        type: string
      description: verifier description - verifiers with description similar to this parameter will be processed.

    json_or_msgpack_content:
      in: header
      name: Content-Type
      schema:
        type: string
        enum:
          - application/json
          - application/msgpack
      description: Format of a request body data

    face_ids:
      in: query
      name: face_ids
      schema:
        type: string
        format: list of uuid.
      description: list of 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 uuid.
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc38'
      description: a list of comma-separated event ids.

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

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

    track_id:
      in: query
      name: track_id
      schema:
        type: string
        pattern: '^[a-zA-Z0-9_\-](1, 36)$'
      description: event track id
      example: "useful_track_id_number_1"

    use_exif_info:
      in: query
      name: use_exif_info
      schema:
        type: integer
        enum: [0, 1]
        default: 1
      description: |
        whether to try to auto orient image based on exif data

        *Has no effect with tiff images (they're always auto oriented).*

        *Ignored with warped images (see `warped_image` or `image_type` parameter).*
      example: 1

    application_json_or_msgpack_accept:
      in: header
      name: Accept
      schema:
        type: string
        default: application/json
        enum:
          - application/json
          - application/msgpack
      description: The response content type header.
  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.
      required:
      - error_code
      - detail
      - desc
      example:
        error_code: 11009
        detail: internal server error
        desc: internal server error

    common_id:
      description: user-defined id.
      type: string
      maxLength: 36
      example: "3.1415926"

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

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

    attribute_id:
      allOf:
      - $ref: '#/components/schemas/uuid'
      - nullable: true
      - description: Attribute id. Will be null if not stored.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    sample_id:
      allOf:
      - $ref: '#/components/schemas/uuid'
      - nullable: true
      - description: Sample id. Will be null if not stored.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    external_id:
      description: user-defined external id
      type: string
      default: ""
      maxLength: 36
      example: "b668c4a5-2191-some-important-words"

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

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

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

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

    account_id:
      allOf:
      - $ref: '#/components/schemas/uuid'
      - description: account id.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    face_avatar:
      type: string
      format: uri
      default: ""
      maxLength: 256
      description: avatar for the face, references to a sample or a user-defined reference.

    input_url:
      type: string
      format: uri
      description: url

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

    int01:
      type: integer
      default: 0
      enum: [0,1]

    int02:
      type: integer
      default: 1
      enum: [0,1,2]

    int0100:
      type: integer
      minimum: 0
      maximum: 100

    int0180:
      type: integer
      minimum: 0
      maximum: 180

    number01:
      type: number
      minimum: 0
      maximum: 1

    sdk_descriptor:
      type: string
      format: byte
      description: sdk descriptor (descriptor version, signature, descriptor bytes)

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

    location_str:
      type: string
      maxLength: 36

    longitude:
      type: number
      minimum: -180
      maximum: 180
      description: longitude in degrees
      example: 36.616

    latitude:
      type: number
      minimum: -90
      maximum: 90
      description: latitude in degrees
      example: 55.752

    geo_position:
      type: object
      description: geo position specified by geographic coordinates - longitude and latitude.
      properties:
        longitude:
          $ref: '#/components/schemas/longitude'
        latitude:
          $ref: '#/components/schemas/latitude'
      required: [longitude, latitude]

    house_number:
      allOf:
      - $ref: '#/components/schemas/location_str'
      - description: house number where event is incidented
    city:
      allOf:
      - $ref: '#/components/schemas/location_str'
      - description: city where event is incidented
    area:
      allOf:
      - $ref: '#/components/schemas/location_str'
      - description: area where event is incidented
    district:
      allOf:
      - $ref: '#/components/schemas/location_str'
      - description: district where event is incidented
    street:
      allOf:
      - $ref: '#/components/schemas/location_str'
      - description: street where event is incidented

    location:
      type: object
      description: information about a place where event is incidented
      properties:
        city:
          allOf:
          - $ref: '#/components/schemas/city'
          - nullable: true
        area:
          allOf:
          - $ref: '#/components/schemas/area'
          - nullable: true
        district:
          allOf:
          - $ref: '#/components/schemas/district'
          - nullable: true
        street:
          allOf:
          - $ref: '#/components/schemas/street'
          - nullable: true
        house_number:
          allOf:
          - $ref: '#/components/schemas/house_number'
          - nullable: true
        geo_position:
          allOf:
            - $ref: '#/components/schemas/geo_position'
            - nullable: true
      required: [city, area, district, street, house_number, geo_position]

    input_location:
      type: object
      description: information about a place where event is incidented
      properties:
        city:
          $ref: '#/components/schemas/city'
        area:
          $ref: '#/components/schemas/area'
        district:
          $ref: '#/components/schemas/district'
        street:
          $ref: '#/components/schemas/street'
        house_number:
          $ref: '#/components/schemas/house_number'
        geo_position:
          $ref: '#/components/schemas/geo_position'

    multiface_policy:
      allOf:
        - $ref: '#/components/schemas/int02'
        - type: integer
        - description: |
            multiple face detection policy:

            - *`0`* - do not process images with several detected faces.

              If *`detect_body`* is enabled, the system will attempt to detect a human body related to the detected face. If a human body is detected, its detection will be associated with the same event as the face.

              If there is no face detected in the image, no human body detections will be returned. Thus there will be no human body detection returned if *`detect_face`* is disabled.


            - *`1`* - process images with several detected faces and/or human bodies.

              If *`detect_body`* is enabled, all the detections of human bodies will be returned. Face detection and human body detection of the same person will be associated with the same event.

              The detections of human bodies are returned even if there were no faces found.


            - *`2`* - get the best face detection from the image. A single face of the best quality is detected in the image.

              If *`detect_body`* is enabled, the system will attempt to detect a human body related to the detected face. If a human body is detected, its detection will be associated with the same event as the face.

              If there is no face detected in the image, no human body detections will be returned. Thus there will be no human body detection returned if *`detect_face`* is disabled.

    estimate_head_pose:
      allOf:
      - $ref: '#/components/schemas/int01'
      - type: integer
      - description: |
      description: |
        whether to estimate head pose on the image.

        *Not supported with warped images (see `warped_image` or `image_type` parameter).*

    estimate_emotions:
      allOf:
      - $ref: '#/components/schemas/int01'
      - type: integer
      - description: |
          whether to estimate emotions on the image.

    estimate_quality:
      allOf:
      - $ref: '#/components/schemas/int01'
      - type: integer
      - description: |
          whether to estimate input face image quality.

    estimate_gaze:
      allOf:
      - $ref: '#/components/schemas/int01'
      - type: integer
      - description: |
          whether to estimate eye gaze on the image.

          *Not supported with warped images (see `warped_image` or `image_type` parameter).*

    estimate_eyes_attributes:
      allOf:
      - $ref: '#/components/schemas/int01'
      - type: integer
      - description: |
          whether to estimate eye attributes on the image.

          *Not supported with warped images (see `warped_image` or `image_type` parameter).*

    estimate_mouth_attributes:
      allOf:
      - $ref: '#/components/schemas/int01'
      - type: integer
      - description: |
          whether to estimate mouth attributes on the image.

    estimate_mask:
      allOf:
      - $ref: '#/components/schemas/int01'
      - description: |
          whether to estimate mask on the image.

    estimate_glasses:
      allOf:
      - $ref: '#/components/schemas/int01'
      - description: |
          whether to estimate glasses on the image.

    detect_landmarks68:
      allOf:
      - $ref: '#/components/schemas/int01'
      - type: integer
      - description: |
          whether to detect basic 68-point facial landmarks on the image.

          *Not supported with warped images (see `warped_image` or `image_type` parameter).*

    detect_landmarks5:
      allOf:
      - $ref: '#/components/schemas/int01'
      - type: integer
      - description: |
          whether to detect basic 5-point facial landmarks on the image.

          *Not supported with warped images (see `warped_image` or `image_type` parameter).*

    extract_exif:
      allOf:
      - $ref: '#/components/schemas/int01'
      - type: integer
      - description: |
          whether to extract EXIF meta information from input 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:
      allOf:
      - $ref: '#/components/schemas/int0180'
      - type: integer
      - description: |
          maximum deviation pitch angle from 0.

    roll_threshold:
      allOf:
      - $ref: '#/components/schemas/int0180'
      - type: integer
      - description: |
          maximum deviation roll angle from 0.

    yaw_threshold:
      allOf:
      - $ref: '#/components/schemas/int0180'
      - type: integer
      - description: |
          maximum deviation yaw angle from 0.

    mask_states:
      type: array
      items:
        type: integer
        enum: [1, 2, 3]
      minItems: 1
      nullable: true
      description: |
        filter by mask states

        | masks      | value |
        |----------------|---|
        | missing        | 1 |
        | medical_mask   | 2 |
        | occluded       | 3 |

    detect_face:
      allOf:
        - default: 1
        - $ref: '#/components/schemas/int01'
        - description: |
            whether to detect faces from the image.

    detect_body:
      allOf:
        - default: 0
        - $ref: '#/components/schemas/int01'
        - description: |
            whether to detect bodies from the image.

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

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

    extract_body_descriptor:
      allOf:
        - default: 0
        - $ref: '#/components/schemas/int01'
        - description: |
            whether to extract body descriptor(s).

    aggregate_attributes:
      allOf:

      - type: integer
        enum: [0, 1]
        description: |
          whether to aggregate attribute(s).

          If true, all extracted attributes will be aggregated and stored as a single attribute.
          Otherwise, all attributes will be stored for each sample.
        default: 0

    score_threshold:
      type: number
      minimum: 0
      maximum: 1
      example: 0.99
      default: 0
      description: |
        face descriptor quality score threshold. All the attributes with 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).

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

    age:
      allOf:
        - $ref: '#/components/schemas/int0100'
        - description: Age

    user_data:
      description: user data assosiated with object.
      type: string
      maxLength: 128
      example: "some data"
      default: ""

    face_user_data:
      description: face user data
      allOf:
        - $ref: '#/components/schemas/user_data'

    event_user_data:
      description: event user data
      allOf:
        - $ref: '#/components/schemas/user_data'

    user_data_filter:
      allOf:
        - $ref: '#/components/schemas/user_data'
        - default: null

    is_dynamic:
      description: dynamic handler flag (a handler without policies; use it to send policies while emiting each event)
      type: boolean
      default: false

    detect_policy:
      type: object
      properties:
        detect_face:
          $ref: '#/components/schemas/detect_face'

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

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

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

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

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

        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:
          $ref: '#/components/schemas/yaw_threshold'

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

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

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

      description:  |
        policy determinates parameters for face and/or body detection.

        > **NOTE** If *`detect_face`* parameter is set to 0, all face detection targets & filters
        (i.e. *`estimate_head_pose`*, *`estimate_emotions`*, *`estimate_quality`*, *`estimate_gaze`*, *`estimate_eyes_attributes`*,
        *`estimate_mouth_attributes`*, *`detect_landmarks68`*, *`yaw_threshold`*, *`roll_threshold`*, *`pitch_threshold`*, *`mask_states`*)
        will be ignored.

    detect_policy_required:
      allOf:
        - $ref: '#/components/schemas/detect_policy'
        - required:
          - detect_face
          - detect_body
          - multiface_policy
          - estimate_head_pose
          - estimate_emotions
          - estimate_mask
          - estimate_quality
          - estimate_gaze
          - estimate_eyes_attributes
          - estimate_mouth_attributes
          - detect_landmarks68
          - extract_exif
          - yaw_threshold
          - roll_threshold
          - mask_states

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

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

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

        extract_body_descriptor:
          $ref: '#/components/schemas/extract_body_descriptor'
      description: policy determinates parameters for attributes extraction.

    extract_policy_required:
      allOf:
        - $ref: '#/components/schemas/extract_policy'
        - required: [extract_basic_attributes, extract_face_descriptor, fd_score_threshold, extract_body_descriptor]

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

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

    age_gte_filter:
      allOf:
        - description: upper included bound for reference age.
        - example: 30
        - $ref: '#/components/schemas/age'

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

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

    emotions_enum:
      description: |
        predominant emotions.

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

      type: array
      items:
        $ref: '#/components/schemas/emotion'

    masks_enum:
      description: |
        predominant masks.

        | masks      | value |
        |----------------|---|
        | missing        | 1 |
        | medical_mask   | 2 |
        | occluded       | 3 |

      type: array
      items:
        $ref: '#/components/schemas/mask'

    label:
      type: string
      description: label for matching candidates
      example: "good guys"
      maxLength: 36

    match_filter:
      type: object
      properties:
        label:
          allOf:
          - $ref: '#/components/schemas/label'
          description: label for matching candidates | must be equal to one of the matching policy labels
        similarity__lte:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: upper included bound for best match by the list.
        similarity__gte:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: lower included bound for best match by the list.
      required: [label]

    match_origin_faces:
      type: string
      enum: ["faces"]
      description: resource candidates type. Faces or events.

    match_origin_events:
      type: string
      enum: ["events"]
      description: resource candidates type. Faces or events.

    face_ids:
      type: array
      items:
        $ref: '#/components/schemas/face_id'
      description: list of face ids
      minItems: 1
      maxItems: 1000

    face_id__gte:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: face id lower included boundary

    face_id__lt:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: face id upper excluded boundary

    external_ids:
      type: array
      items:
        $ref: '#/components/schemas/external_id'
      description: list of face external ids
      minItems: 1
      maxItems: 1000

    create_time__gte:
      type: string
      format: date-time
      example: "2018-08-11T09:11:41.674Z"
      description: create time lower included boundary

    create_time__lt:
      type: string
      format: date-time
      example: "2018-08-11T09:11:41.674Z"
      description: create time upper exluded boundary

    _base_face_filters:
      type: object
      description: candidate face filters
      properties:
        origin:
          $ref: '#/components/schemas/match_origin_faces'
        face_ids:
          $ref: '#/components/schemas/face_ids'
        account_id:
          $ref: '#/components/schemas/account_id'
        external_ids:
          $ref: '#/components/schemas/external_ids'
        user_data:
          $ref: '#/components/schemas/user_data_filter'
        create_time__gte:
          $ref: '#/components/schemas/create_time__gte'
        create_time__lt:
          $ref: '#/components/schemas/create_time__lt'
        face_id__gte:
          $ref: '#/components/schemas/face_id__gte'
        face_id__lt:
          $ref: '#/components/schemas/face_id__lt'
      required: [origin]
      minProperties: 1

    request_face_filters:
      allOf:
        - $ref: '#/components/schemas/_base_face_filters'
        - properties:
            list_id:
              $ref: '#/components/schemas/list_id'

    tags:
      description: list of tags.
      type: array
      items:
        type: string
        maxLength: 36
      example: ['tag1', 'tag2']

    areas:
      description: List of areas. Each event from result will contain one of the given areas in location.
      type: array
      items:
        $ref: '#/components/schemas/location_str'
      example: ['area1', 'area2']
      minItems: 1
      maxItems: 1000

    cities:
      type: array
      items:
        $ref: '#/components/schemas/location_str'
      description: List of cities. Each event from result will contain one of the given cities in location.
      example: ["moscow", "New-York"]
      minItems: 1
      maxItems: 1000

    districts:
      type: array
      items:
        $ref: '#/components/schemas/location_str'
      description: List of districts. Each event from result will contain one of the given districts in location.
      example: ["mitino", "central park"]
      minItems: 1
      maxItems: 1000

    streets:
      type: array
      items:
        $ref: '#/components/schemas/location_str'
      description: List of streets. Each event from result will contain one of the given streets in location.
      example: ["arbat, schepkina"]
      minItems: 1
      maxItems: 1000

    house_numbers:
      type: array
      items:
        $ref: '#/components/schemas/location_str'
      description: List of house numbers. Each event from result will contain one of the given house numbers in location.
      example: ["1", "1/2str3"]
      minItems: 1
      maxItems: 1000

    age__lt:
      allOf:
        - $ref: '#/components/schemas/age'
          description: age upper excluded bound.

    age__gte:
      allOf:
        - $ref: '#/components/schemas/age'
          description: age lower included bound.

    source:
      type: string
      maxLength: 128
      description: some additional information that user provided with event.
      example: "3rd Avenue"

    sources:
      type: array
      items:
        $ref: '#/components/schemas/source'
      description: list of sources. Each event from result will contain one of the given sources in location.
      example: ['cam1', 'cam2']
      minItems: 1
      maxItems: 1000

    event_ids:
      type: array
      items:
        $ref: '#/components/schemas/event_id'
      description: list of event ids associated with face
      minItems: 1
      maxItems: 1000

    event_id__gte:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: event id lower included boundary

    event_id__lt:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: event id upper excluded boundary

    top_matching_candidates_label:
      description: top matching candidates label.
      type: string
      maxLength: 36
      example: good guys

    top_similar_object_ids:
      type: array
      items:
        $ref: '#/components/schemas/uuid'
      description: list of top similar object ids.
      minItems: 1
      maxItems: 1000

    similarity:
      $ref: '#/components/schemas/number01'

    top_similar_object_similarity__gte:
      allOf:
      - $ref: '#/components/schemas/similarity'
      description: top similar object similarity lower included bound.

    top_similar_object_similarity__lt:
      allOf:
      - $ref: '#/components/schemas/similarity'
      description: top similar object similarity upper excluded bound.

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

    mask:
      type: integer
      enum: [1, 2, 3]

    handler_ids:
      type: array
      items:
        $ref: '#/components/schemas/handler_id'
      description: list of handler ids.
      minItems: 1
      maxItems: 1000

    ethnic_group:
      type: integer
      enum: [1,2,3,4]

    ethnic_groups:
      type: array
      items:
        $ref: '#/components/schemas/ethnic_group'
      description: |
        list of ethnic group. Each event from result will contain one of the given ethnic groups.

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

    geo_position_bbox:
      description: |
          geo position filter is a bounding box specified by coordinates of its center (origin) and some delta.
          WARNING: boxes with a vertex or border on the International Date Line (IDL) or the North or South pole are
          not fully supported due to features of database spatial index - filter result may be unexpected.
      properties:
        origin_longitude:
          allOf:
            - $ref: '#/components/schemas/longitude'
            - description: origin longitude in degrees
        origin_latitude:
          allOf:
            - $ref: '#/components/schemas/latitude'
            - description: origin latitude in degrees
        longitude_delta:
          description: |
              longitude delta in degrees. Box edges more than 180 degrees long are not allowed.
              Boundaries of valid range are **exclusive**. NOTE: highly recommended for citywide use only.
          type: number
          minimum: 0
          maximum: 90
          default: 0.01
          example: 0.01
        latitude_delta:
          description: |
              latitude delta in degrees. Box edges more than 180 degrees long are not allowed.
              Boundaries of valid range are **exclusive**. NOTE: highly recommended for citywide use only.
          type: number
          minimum: 0
          maximum: 90
          default: 0.01
          example: 0.01
      required: [origin_longitude, origin_latitude]

    request_reply_event_filters:
      type: object
      description: candidate event filters
      properties:
        origin:
          $ref: '#/components/schemas/match_origin_events'
        event_ids:
          $ref: '#/components/schemas/event_ids'
        account_id:
          $ref: '#/components/schemas/account_id'
        event_id__gte:
          $ref: '#/components/schemas/event_id__gte'
        event_id__lt:
          $ref: '#/components/schemas/event_id__lt'
        create_time__gte:
          $ref: '#/components/schemas/create_time__gte'
        create_time__lt:
          $ref: '#/components/schemas/create_time__lt'
        handler_ids:
          $ref: '#/components/schemas/handler_ids'
        external_ids:
          $ref: '#/components/schemas/external_ids'
        top_matching_candidates_label:
          $ref: '#/components/schemas/top_matching_candidates_label'
        top_similar_object_ids:
          $ref: '#/components/schemas/top_similar_object_ids'
        top_similar_object_similarity__gte:
          $ref: '#/components/schemas/top_similar_object_similarity__gte'
        top_similar_object_similarity__lt:
          $ref: '#/components/schemas/top_similar_object_similarity__lt'
        age__gte:
          $ref: '#/components/schemas/age__gte'
        age__lt:
          $ref: '#/components/schemas/age__lt'
        gender:
          $ref: '#/components/schemas/gender'
        emotions:
          $ref: '#/components/schemas/emotions_enum'
        masks:
          $ref: '#/components/schemas/masks_enum'
        ethnic_groups:
          $ref: '#/components/schemas/ethnic_groups'
        face_ids:
          $ref: '#/components/schemas/face_ids'
        user_data:
          $ref: '#/components/schemas/user_data_filter'
        sources:
          $ref: '#/components/schemas/sources'
        tags:
          $ref: '#/components/schemas/tags'
        cities:
          $ref: '#/components/schemas/cities'
        areas:
          $ref: '#/components/schemas/areas'
        districts:
          $ref: '#/components/schemas/districts'
        streets:
          $ref: '#/components/schemas/streets'
        house_numbers:
          $ref: '#/components/schemas/house_numbers'
        geo_position:
          $ref: '#/components/schemas/geo_position_bbox'
        track_ids:
          $ref: '#/components/schemas/track_ids'
      required: [origin]
      minProperties: 1

    matching_threshold:
      allOf:
      - $ref: '#/components/schemas/number01'
      description: matching similarity threshold

    matching_limit:
      type: integer
      minimum: 1
      maximum: 100
      default: 3
      description: count of match result for candidate list

    detect_time:
      allOf:
        - $ref: "#/components/schemas/time"
        - description: detection time
      example: "2018-08-11T09:11:41.674Z"

    image_origin:
      type: string
      maxLength: 256
      description: the image url - source of the detection
      nullable: true
      example: "/6/images/b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    face_matching_targets:
      type: array
      items:
        type: string
        enum: ["face_id", "account_id", "event_id", "user_data", "create_time", "external_id", "avatar", "lists"]

    event_matching_targets:
      type: array
      items:
        type: string
        enum: ["event_id", "account_id", "create_time", "external_id", "handler_id", "source", "top_match",
               "match_result", "face_detections", "body_detections", "face_id", "attach_result", "gender", "age",
               "emotion", "ethnic_group", "tags", "user_data", "location", "mask", "track_id"]

    matching_targets:
      description: |
        List of face/event fields.
        If set, each face/event from result will contain only specified fields, otherwise, faces/events with all fields will be returned.
        If targets do not specified, all targets will return.
      oneOf:
        - $ref: '#/components/schemas/face_matching_targets'
        - $ref: '#/components/schemas/event_matching_targets'

    handler_match_policy:
      type: array
      items:
        type: object
        properties:
          label:
            allOf:
            - $ref: '#/components/schemas/label'
            default: ""
          candidates:
            oneOf:
              - $ref: '#/components/schemas/request_face_filters'
              - $ref: '#/components/schemas/request_reply_event_filters'
          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.
            minProperties: 1
          limit:
            $ref: '#/components/schemas/matching_limit'
          targets:
            $ref: '#/components/schemas/matching_targets'
          threshold:
            $ref: '#/components/schemas/matching_threshold'
        required: [candidates]
      minItems: 0
      maxItems: 30
      description: |
        Match attributes policy. This policy will be used for each event which descriptor was extracted successfully and which satisfies the filters.

    link_to_lists_policy:
      type: array
      items:
        type: object
        properties:
          list_id:
            $ref: '#/components/schemas/list_id'
          filters:
            allOf:
            - $ref: '#/components/schemas/emit_events_filters'
            - description: filters determine whether to link stored face to the list.
        required: [list_id]
      minItems: 0
      maxItems: 30
      description: a set of luna lists with filters for attaching stored faces.

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

    face_storage_policy:
      type: object
      description: Whether to store a face and link it to lists.
      properties:
        store_face:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: Whether to store a face.
          default: 0
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_filters'
          - description: Filters determine whether to store a face. Only the faces corresponding to the specified filters will be stored.
        set_sample_as_avatar:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: Whether to set a sample as an avatar for stored faces.
          default: 1
        link_to_lists_policy:
          $ref: '#/components/schemas/link_to_lists_policy'

    face_storage_policy_required:
      # must be same as face_storage_policy
      type: object
      description: Whether to store a face and link it to lists.
      properties:
        store_face:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: Whether to store a face.
          default: 0
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_filters'
          - description: Filters determine whether to store a face. Only the faces corresponding to the specified filters will be stored.
        set_sample_as_avatar:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: Whether to set a sample as an avatar for stored faces.
          default: 1
        link_to_lists_policy:
          $ref: '#/components/schemas/link_to_lists_policy_required'
      required: [storage_face, set_sample_as_avatar, filters, link_to_lists_policy]

    face_sample_storage_policy:
      type: object
      description: Face sample storing policy.
      properties:
        store_sample:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: Whether to store a face sample.
          default: 1
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_filters'
          - description: Filters determine whether to store a face sample or not. Only the samples corresponding to the specified filters will be stored.

    face_sample_storage_policy_required:
      # must be same as face_sample_storage_policy
      allOf:
        - $ref: '#/components/schemas/face_sample_storage_policy'
        - required: [store_sample, filters]

    body_sample_storage_policy:
      type: object
      description: Human body sample storing policy.
      properties:
        store_sample:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: Whether to store a human body sample.
          default: 1
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_filters'
          - description: Filters determine whether to store a human body sample or not. Only the samples corresponding to the specified filters will be stored.

    body_sample_storage_policy_required:
      # must be same as face_sample_storage_policy
      allOf:
        - $ref: '#/components/schemas/body_sample_storage_policy'
        - required: [store_sample, filters]

    image_origin_storage_policy:
      type: object
      description: Image origin policy.
      properties:
        store_image:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: Whether to store an origin image of the detection.
          default: 0
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_filters'
          - description: Filters determine whether to store an origin image or not. Only the images corresponding to the specified filters will be stored.

    image_origin_storage_policy_required:
      # must be same as image_origin_storage_policy
      allOf:
        - $ref: '#/components/schemas/image_origin_storage_policy'
        - required: [store_image, filters]

    attribute_storage_policy:
      type: object
      description: Attribute storing policy.
      properties:
        store_attribute:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: Whether to store an attribute.
          default: 0
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_filters'
          - description: Filters determine whether to store an attribute or not. Only the attributes corresponding to the specified filters will be stored.
        ttl:
          type: integer
          minimum: 0
          maximum: 86400
          default: 300
          description: Attribute storage duration (sec). Attribute will be removed after this time runs out.

    attribute_storage_policy_required:
      # must be same as attribute_storage_policy
      allOf:
        - $ref: '#/components/schemas/attribute_storage_policy'
        - required: [store_attribute, filters, ttl]

    event_storage_policy:
      type: object
      description: Event storing policy.
      properties:
        store_event:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: Whether to store an event.
          default: 1
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_filters'
          - description: Filters determine whether to store an event or not. Only the events corresponding to the specified filters will be stored.
        wait_saving:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: |
            Whether to wait for events saving to the Events service before sending the response. The request will be
            executed faster if this feature is disabled, but it is not guaranteed that the events will be saved to
            the Events database.
          default: 1
    event_storage_policy_required:
      # must be same as event_storage_policy
      allOf:
        - $ref: '#/components/schemas/event_storage_policy'
        - required: [store_event, filters, wait_saving]

    conditional_tag_policy:
      type: object
      properties:
        tag:
          $ref: '#/components/schemas/tag'
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_filters'
          - description: filters determine whether to add the tag to event.
      required: [tag]

    conditional_tags_policy:
      type: array
      items:
        $ref: '#/components/schemas/conditional_tag_policy'
      minItems: 0
      maxItems: 30
      description: a set of event tags for adding to event by conditions.


    conditional_tags_policy_required:
      type: array
      items:
        allOf:
          - $ref: '#/components/schemas/conditional_tag_policy'
          - required: [tag, filters]
      minItems: 0
      maxItems: 30
      description: a set of event tags for adding to event by conditions.


    int_version:
      type: integer
      minimum: 0

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

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

    base_face:
      type: object
      description: face object
      properties:
        face_id:
          $ref: '#/components/schemas/face_id'
        event_id:
          allOf:
          - $ref: '#/components/schemas/event_id'
          - description: event id associated with the face creation.
        user_data:
          $ref: '#/components/schemas/face_user_data'
        external_id:
          $ref: '#/components/schemas/external_id'
        avatar:
          $ref: '#/components/schemas/face_avatar'
        lists:
          type: array
          items:
            $ref: '#/components/schemas/list_id'
          minItems: 0
          description: list of luna lists, which contain the face.
      example:
        face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
        account_id: d5c0a8c6-5509-4e5b-8a01-e2ab426542d6
        event_id: f9687459-986b-406d-9c1f-0d6289be5256
        user_data: fox1991
        external_id: 2xQ2gprbMUePw1s9gw9fvA==
        avatar: 'https://st.kp.yandex.net/images/actor_iphone/iphone360_460188.jpg'
        lists: ["429b0e78-4616-426a-b57f-02baa72d638d", '6d037c33-31ec-4d73-b3b3-ec80b09446c2']

    input_event_face:
      description: face structure of input event
      required: []
      allOf:
        - $ref: '#/components/schemas/base_face'
        - properties:
            url:
              type: string
              description: face location url
              format: uri
        - example:
          face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
          event_id: f9687459-986b-406d-9c1f-0d6289be5256
          user_data: fox1991
          external_id: 2xQ2gprbMUePw1s9gw9fvA==
          avatar: 'https://st.kp.yandex.net/images/actor_iphone/iphone360_460188.jpg'
          lists: ["429b0e78-4616-426a-b57f-02baa72d638d", '6d037c33-31ec-4d73-b3b3-ec80b09446c2']
          url: "http://127.0.0.1:5030/3/faces/426542d6-5509-4e5b-8a01-e2abd5c0a8c6"

    event_face:
      description: handler generated face
      allOf:
        - $ref: '#/components/schemas/base_face'
        - properties:
            url:
              type: string
              description: face location url
              nullable: true
              format: uri
            external_id:
              nullable: true
        - example:
          face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
          event_id: f9687459-986b-406d-9c1f-0d6289be5256
          user_data: fox1991
          external_id: 2xQ2gprbMUePw1s9gw9fvA==
          avatar: 'https://st.kp.yandex.net/images/actor_iphone/iphone360_460188.jpg'
          lists: ["429b0e78-4616-426a-b57f-02baa72d638d", '6d037c33-31ec-4d73-b3b3-ec80b09446c2']
          url: "http://127.0.0.1:5030/3/faces/426542d6-5509-4e5b-8a01-e2abd5c0a8c6"

        - required: [face_id, event_id, user_data, create_time, external_id, avatar, lists, url]

    face:
      description: face
      allOf:
        - $ref: '#/components/schemas/base_face'
        - properties:
            account_id:
              - $ref: '#/components/schemas/account_id'
            external_id:
              nullable: true
        - example:
          account_id: 12345459-bfbf-406d-9c1f-0d6289aaaaa
          face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
          event_id: f9687459-986b-406d-9c1f-0d6289be5256
          user_data: fox1991
          external_id: 2xQ2gprbMUePw1s9gw9fvA==
          avatar: 'https://st.kp.yandex.net/images/actor_iphone/iphone360_460188.jpg'
          lists: ["429b0e78-4616-426a-b57f-02baa72d638d", '6d037c33-31ec-4d73-b3b3-ec80b09446c2']

    emit_events_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: a list of policies based on match results.
          maxItems: 30

    storage_policy:
      description: Objects storage policy.
      properties:
        face_sample_policy:
          $ref: '#/components/schemas/face_sample_storage_policy'
        body_sample_policy:
          $ref: '#/components/schemas/body_sample_storage_policy'
        image_origin_policy:
          $ref: '#/components/schemas/image_origin_storage_policy'
        attribute_policy:
          $ref: '#/components/schemas/attribute_storage_policy'
        face_policy:
          $ref: '#/components/schemas/face_storage_policy'
        event_policy:
          $ref: '#/components/schemas/event_storage_policy'

    storage_policy_required:
      # must be same as storage_policy
      properties:
        face_sample_policy:
          $ref: '#/components/schemas/face_sample_storage_policy_required'
        body_sample_policy:
          $ref: '#/components/schemas/body_sample_storage_policy_required'
        image_origin_policy:
          $ref: '#/components/schemas/image_origin_storage_policy_required'
        attribute_policy:
          $ref: '#/components/schemas/attribute_storage_policy_required'
        face_policy:
          $ref: '#/components/schemas/face_storage_policy_required'
        event_policy:
          $ref: '#/components/schemas/event_storage_policy_required'
      required: [face_sample_policy, body_sample_policy, image_origin_policy, attribute_policy, face_policy, event_policy]

    Policies:
      type: object
      description: a set of rules, that determines input images processing
      properties:
        detect_policy:
          allOf:
          - $ref: '#/components/schemas/detect_policy'
          - description: face detection policy.
        extract_policy:
          allOf:
          - $ref: '#/components/schemas/extract_policy'
          - description: extract attributes policy.
        match_policy:
          $ref: '#/components/schemas/handler_match_policy'
        storage_policy:
          $ref: '#/components/schemas/storage_policy'
        conditional_tags_policy:
          $ref: '#/components/schemas/conditional_tags_policy'

    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'
            - type: object
              description: face detection policy.
        extract_policy:
          allOf:
            - $ref: '#/components/schemas/extract_policy_required'
            - description: extract attributes policy.
        match_policy:
          $ref: '#/components/schemas/handler_match_policy'
        storage_policy:
          $ref: '#/components/schemas/storage_policy_required'
        conditional_tags_policy:
          $ref: '#/components/schemas/conditional_tags_policy_required'
      required: [detect_policy, extract_policy, match_policy, storage_policy, link_to_lists_policy,
        conditional_tags_policy]

    New_Handler:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
        description:
          type: string
          maxLength: 128
          description: user description.
          example: second avenue
        policies:
          $ref: '#/components/schemas/Policies'
        is_dynamic:
          $ref: '#/components/schemas/is_dynamic'
      required: [account_id]

    HandlerInResponse:
      type: object
      properties:
        handler_id:
          $ref: '#/components/schemas/handler_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        description:
          type: string
          maxLength: 128
          description: user description.
        policies:
          allOf:
          - $ref: '#/components/schemas/PoliciesWithRequired'
          - nullable: true
        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.
        is_dynamic:
          $ref: '#/components/schemas/is_dynamic'
      required: [handler_id, account_id, description, create_time, last_update_time, policies, is_dynamic]

    event_detection_samples:
      type: object
      properties:
        filename:
          $ref: '#/components/schemas/filename'
        samples:
          type: object
          description: |
            body & face related samples that refer to the one person.
            If one of **body** or **face** field is *null*, it means that either the corresponding detection is disabled
            (see *detect_face*, *detect_body* parameters in [handler detect policy](#operation/createHandler)),
            or the detection has been filtered. Both **body** and **face** fields can not be *null* at the same time.
          properties:
            body:
              allOf:
                - $ref: '#/components/schemas/body_detection_sample'
                - nullable: true
            face:
              allOf:
                - $ref: '#/components/schemas/face_detection_sample'
                - nullable: true
          required: [ body, face ]
        detect_time:
          $ref: "#/components/schemas/detect_time"
        image_origin:
          $ref: "#/components/schemas/image_origin"
      required: [filename, samples, detect_time, image_origin]

    input_event_detection_samples:
      type: object
      description: user detected samples
      properties:
        filename:
          default: ""
          allOf:
          - $ref: '#/components/schemas/filename'
        samples:
          type: object
          description: |
            body & face related samples that refer to the one person.
          properties:
            body:
              allOf:
                - $ref: '#/components/schemas/input_event_body_detection_sample'
                - nullable: true
            face:
              allOf:
                - $ref: '#/components/schemas/input_event_face_detection_sample'
                - nullable: true
        detect_time:
          $ref: "#/components/schemas/detect_time"
        image_origin:
          $ref: "#/components/schemas/image_origin"

      required: [samples]

    EventFromHandler:
      type: object
      description: event format from handler.
      properties:
        face_attributes:
          allOf:
          - description: extracted face attributes from samples.
          - $ref: '#/components/schemas/Attribute'
          - nullable: true
        body_attributes:
          allOf:
            - description: extracted body attributes from samples.
            - $ref: '#/components/schemas/BodyAttribute'
            - nullable: true
        source:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/source'
        tags:
          $ref: '#/components/schemas/Tags'
        external_id:
          allOf:
          - description: user-defined external id for event
          - nullable: true
          - $ref: '#/components/schemas/external_id'
        user_data:
          $ref: '#/components/schemas/event_user_data'
        face:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/event_face'
        event_id:
          allOf:
          - $ref: '#/components/schemas/event_id'
          - description: Event id.
        url:
          type: string
          format: uri
          example: /0/events/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
          description: location of event, null if event was not stored
          nullable: true
        matches:
          allOf:
          - nullable: true
          - $ref: '#/components/schemas/Matches'
        location:
          $ref: '#/components/schemas/location'
        detections:
          description: list of body & face related detections
          type: array
          items:
            $ref: '#/components/schemas/event_detection_samples'
        track_id:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/track_id'
      required: [matches, url, event_id, face, tags, source, face_attributes, body_attributes, location, user_data, external_id, detections, track_id]

    Tags:
      description: tag array.
      type: array
      items:
        $ref: '#/components/schemas/tag'
      example: ['tag1', 'tag2']

    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

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

    mouth_attributes:
      description: mouth attributes.
      type: object
      properties:
        score:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: mouth detection confidence.
        smile:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: smile probability.
        opened:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: opened mouth probability.
        occluded:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: occlusion probability.
      required: [score, smile, occluded, opened]

    eye_attributes:
      description: eye attributes.
      type: object
      properties:
        state:
          type: string
          enum: [open, closed, occluded]
          description: eye state.
        iris_landmarks:
          allOf:
          - $ref: '#/components/schemas/landmarks34'
          - 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]

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

    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.
        mask:
          $ref: '#/components/schemas/masks'
        head_pose:
          allOf:
          - $ref: '#/components/schemas/head_pose'
          - description: head pose estimation.
        gaze:
          allOf:
          - $ref: '#/components/schemas/gaze_direction'
          - description: gaze direction estimation.
      example:
        mouth_attributes:
          occluded: 0.0
          opened: 0.0
          score: 1.0
          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"
        mask:
          estimations:
            medical_mask: 0.7108324766
            missing: 0.0700698048
            occluded: 0.2190976739
          predominant_mask: "medical_mask"
        head_pose:
          pitch: 18.6827487945557
          roll: -10.3542232513428
          yaw: 15.4102487564087
        gaze:
          pitch: 9.26744079589844
          yaw: -19.4657287597656

    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:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: low value means under-exposured face area (i.e. due to backlight, poor lighting, sensor underexposure).
        light:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: low value means over-exposured face area (i.e. overbright lighting, sensor overexposure).
        illumination:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: low value means illumination nonuniformity.
        specularity:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: low value means low specularity.
        blurriness:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: low value means blurred image (e.g. due to depth of field or motion blur). High value means sharp image.
      required: [blurriness, specularity, illumination, light, dark]
      example:
        light: 0.87
        dark: 0.13
        illumination: 0.1
        specularity: 0.1
        blurriness: 0.2

    warped_image:
      type: integer
      description: |
        Whether input image is a warped or arbitrary image.
        The warped image has the following properties: |
        * it's 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.

      maximum: 1
      minimum: 0

    detection_filter_reason:
      type: object
      properties:
        filter_name:
          type: string
          enum: ['pitch_threshold', 'roll_threshold', 'yaw_threshold', 'score_threshold', 'mask_states']
          description: |
            Filter name. For resource */detector* available values are: 'pitch_threshold', 'roll_threshold',
            'yaw_threshold', For resources */handlers/{handler_id}/events* and */verifiers/{verifier_id}/verifications* all values are available.
        object_value:
          type: number
          description: estimate value
        threshold_value:
          oneOf:
          - type: number
            description: threshold value
          - type: array
            items:
              type: integer
            minItems: 1
            description: threshold values

      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_reasons:
          properties:
            filter_name:
              type: string
              enum: ['score_threshold']
              description: filter name
            object_value:
              type: number
              description: estimate value
            threshold_value:
              type: number
              description: threshold value
          required:
          - filter_name
          - object_value
          - threshold_value
      description: extractor filters

    face_detection:
      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.

    event_face_detection:
      type: object
      description: saved with event face detection
      properties:
        rect:
          allOf:
            - $ref: '#/components/schemas/rect'
            - description: face detection bounding box.

    body_detection:
      type: object
      description: body detection
      properties:
        rect:
          allOf:
          - $ref: '#/components/schemas/rect'
          - description: body detection bounding box.

    event_body_detection:
      type: object
      description: saved with event body detection
      properties:
        rect:
          allOf:
            - $ref: '#/components/schemas/rect'
            - description: body detection bounding box.
    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).
        gps:
          type: object
          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]
        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)
      example:
        dateTime: "2011:01:04 09:58:48"
        orientation: "Top-left"
        software: "Adobe Photoshop CS5 Macintosh"

    face_detection_sample:
      type: object
      description: face detection sample
      properties:
        sample_id:
          $ref: '#/components/schemas/sample_id'
        detection:
          $ref: '#/components/schemas/face_detection'
        url:
          type: string
          nullable: true
          format: uri
          example: /0/samples/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
          description: location of the sample, null if sample was not stored
      required:
      - detection
      - sample_id
      - url

    input_event_face_detection_sample:
      type: object
      description: face detection sample
      properties:
        sample_id:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/sample_id'
        detection:
          $ref: '#/components/schemas/face_detection'
        url:
          description: |
            user saved face sample location. If user does not set it and sample id is not null it will
            be generated automatically.
          example:
            http://127.0.0.1:5020/2/buckets/123/images/45838c8b-04a1-4230-bda0-b5f77609b695
          allOf:
            - $ref: '#/components/schemas/input_url'
      required:
      - detection
      - sample_id

    body_detection_sample:
      type: object
      description: body detection sample
      properties:
        sample_id:
          $ref: '#/components/schemas/sample_id'
        detection:
          $ref: '#/components/schemas/body_detection'
        url:
          type: string
          nullable: true
          format: uri
          example: /0/samples/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
          description: location of the sample, null if sample was not stored
      required:
        - detection
        - sample_id
        - url

    input_event_body_detection_sample:
      type: object
      description: face detection sample
      properties:
        sample_id:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/sample_id'
        detection:
          $ref: '#/components/schemas/body_detection'
        url:
          description: |
            user saved body sample location. If user does not set it and sample id is not null it will
            be generated automatically.
          example:
            http://127.0.0.1:5020/2/buckets/123/images/45838c8b-04a1-4230-bda0-b5f77609b695
          allOf:
            - $ref: '#/components/schemas/input_url'
      required:
      - detection
      - sample_id

    filename:
      type: string
      example: "penelope.jpeg"
      description: |
        source image file name (preserved only for multipart-form-data requests, otherwise "Raw Image")

    image_error:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/Error'
        filename:
          $ref: '#/components/schemas/filename'
      required:
        - error
        - filename
      example:
        error:
          desc: Failed to decode image data
          detail: Failed to decode image image data.
          error_code: 3001
        filename: n.jpg

    image_status:
      type: integer
      enum: [0, 1]
      description: image status. 0 - processing image is failed, 1 - success image processed

    verification_status:
      type: boolean
      description: |
        status of verification. `true` - the service assumes that a reference and candidates are same person.


    filtered_detections:
      type: object
      properties:
        face_detections:
          type: array
          items:
            type: object
            description: filtered detection
            properties:
              filter_reasons:
                type: array
                items:
                  $ref: '#/components/schemas/detection_filter_reason'
                minItems: 1
              detection:
                $ref: '#/components/schemas/face_detection'
            required: [filter_reasons, detection]
      required: [face_detections]

    processed_image:
      type: object
      description: |
        processed image. Status 1 means that the image was processed without errors. Status 0 means
        that the image was processed with errors, information about error is contained in field `error`
        (error `Success` means that image was processed without errors with status `1`).
      properties:
        filename:
          allOf:
            - $ref: '#/components/schemas/filename'
          description: source image file name
        status:
          $ref: '#/components/schemas/image_status'
        error:
          $ref: '#/components/schemas/Error'
        exif:
          $ref: '#/components/schemas/exif'
      required: [filename, status, error]

    detector_samples:
      properties:
        face:
          allOf:
          - $ref: '#/components/schemas/face_detection_sample'
          - description: face detection
      description: only face sample now

    detector_detections:
      description: |
        all detections on image which are separated on samples (entity for followig a descriptor extraction) and
        filtered detections (it is debug information).
      properties:
        samples:
          type: array
          items:
            $ref: '#/components/schemas/detector_samples'
          description: detections list which satisfy filters criteria
        filtered_detections:
          $ref: '#/components/schemas/filtered_detections'
      required: [samples, filtered_detections]

    detected_image:
      allOf:
      - $ref: '#/components/schemas/processed_image'
      - type: object
        properties:
          detections:
            $ref: '#/components/schemas/detector_detections'
        required: [detections]
      - description: processed image from detector

    detected_images:
      type: object
      description: processed images from detector
      properties:
        images:
          type: array
          items:
            $ref: '#/components/schemas/detected_image'
          description: proceeded images list
      required: [images]

    handler_processed_images:
      type: array
      description: processed images from a handler
      items:
        $ref: '#/components/schemas/processed_image'

    event_filtered_detections:
      type: object
      properties:
        face_detections:
          type: object
          properties:
            filter_reasons:
              type: array
              items:
                $ref: '#/components/schemas/detection_filter_reason'
              minItems: 1
            detection:
              type: object
              properties:
                filename:
                  $ref: '#/components/schemas/filename'
                sample:
                  type: object
                  properties:
                    detection:
                      $ref: '#/components/schemas/face_detection'
                  required: [detection]
              required: [filename, sample]
          required: [filter_reasons, detection]
      required: [face_detections]

    emit_event_reply:
      type: object
      properties:
        events:
          type: array
          items:
            $ref: '#/components/schemas/EventFromHandler'
        images:
          $ref: '#/components/schemas/handler_processed_images'
        filtered_detections:
          $ref: '#/components/schemas/event_filtered_detections'
      required: ["events", "images", "filtered_detections"]

    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"

    basic_attributes:
      type: object
      properties:
        age:
          allOf:
            - $ref: '#/components/schemas/age'
            - example: 29
        gender:
          allOf:
            - $ref: '#/components/schemas/gender'
            - example: 1

        ethnicities:
          $ref: '#/components/schemas/ethnicities'
      required: [age, gender, ethnicities]

    attribute_samples:
      type: array
      items:
        $ref: '#/components/schemas/sample_id'
      minItems: 1
      example: [ 'a3e8716f-70dc-42ad-8428-7a552e800a37' ]
      description: resource for attributes

    ReextractedAttribute:
      type: object
      properties:
        face_id:
          nullable: true
          allOf:
            - description: face id, null if descriptor score is lower than score treshold
            - $ref: '#/components/schemas/face_id'
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
        score:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: face descriptor quality score.
        url:
          nullable: true
          type: string
          format: uri
          example: /1/faces/24d405ce-bc56-4bf7-98e1-bdc962b4cf34/attributes
          description: location of attributes, null if attribute was not stored
        samples:
          $ref: '#/components/schemas/attribute_samples'
        filter:
          $ref: '#/components/schemas/extractor_filter'

      required: [face_id, url, samples]

    Attribute:
      type: object
      properties:
        attribute_id:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/attribute_id'
            - description: attribute id, null if descriptor score is lower than score treshold
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
        score:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: face descriptor quality score.
        url:
          nullable: true
          type: string
          format: uri
          example: /0/attributes/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
          description: location of attributes, null if attribute was not stored
        samples:
          $ref: '#/components/schemas/attribute_samples'
        filter:
          $ref: '#/components/schemas/extractor_filter'

      required: [attribute_id, url, samples]

    input_event_face_attribute:
      type: object
      description: user extracted event face attributes
      nullable: true
      properties:
        attribute_id:
          $ref: '#/components/schemas/attribute_id'
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
        score:
          default: 1
          allOf:
            - $ref: '#/components/schemas/number01'
          description: face descriptor quality score.
        samples:
          minItems: 0
          maxItems: 8
          allOf:
          - $ref: '#/components/schemas/attribute_samples'
        descriptor:
          $ref: '#/components/schemas/sdk_descriptor'
        url:
          description: |
            attributes location url. If user does not set it and `attribute_id` is not null service will generates
            it automaticaly
          allOf:
            - $ref: '#/components/schemas/input_url'

    BodyAttribute:
      type: object
      properties:
        score:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: |
            body descriptor quality score.
            > **WARNING** If body descriptor was extracted, the value is always set to 1.
        samples:
          type: array
          items:
            $ref: '#/components/schemas/sample_id'
          example: ['a3e8716f-70dc-42ad-8428-7a552e800a37']
          description: Stored attribute samples.

      required: [samples]

    input_event_body_attribute:
      type: object
      description: user extracted event body attributes
      nullable: true
      properties:
        score:
          allOf:
            - $ref: '#/components/schemas/number01'
          description: body descriptor quality score.
        samples:
          $ref: '#/components/schemas/attribute_samples'
        descriptor:
          $ref: '#/components/schemas/sdk_descriptor'

    extracted_attributes:
      type: array
      items:
        $ref: '#/components/schemas/Attribute'

    candidate_match_result_face:
      type: object
      properties:
        similarity:
          allOf:
          - $ref: '#/components/schemas/similarity'
          - description: face match similarity
        face:
          $ref: '#/components/schemas/face'
      description: match result for the event and a face.
      required: [similarity, face]

    top_match_face:
      type: object
      properties:
        label:
          $ref: '#/components/schemas/label'
        similarity:
          description: similarity to the most similar face.
          allOf:
            - $ref: '#/components/schemas/similarity'
        face_id:
          $ref: '#/components/schemas/face_id'
      required: [label, similarity, face_id]

    top_match_event:
      type: object
      properties:
        label:
          $ref: '#/components/schemas/top_matching_candidates_label'
        similarity:
          description: similarity to the most similar event.
          allOf:
            - $ref: '#/components/schemas/similarity'
        event_id:
          $ref: '#/components/schemas/event_id'
      required: [label, similarity, event_id]

    candidate_event:
      type: object
      description: event candidate object in the response
      properties:
        event_id:
          $ref: '#/components/schemas/event_id'
        account_id:
          $ref: '#/components/schemas/face_id'
        create_time:
          allOf:
            - $ref: "#/components/schemas/time"
            - description: time of the event creation.
        external_id:
          $ref: '#/components/schemas/external_id'
        handler_id:
          $ref: '#/components/schemas/handler_id'
        source:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/source'
        top_match:
          nullable: true
          description: top match result from match policy
          oneOf:
            - $ref: '#/components/schemas/top_match_face'
            - $ref: '#/components/schemas/top_match_event'
        match_result:
          type: array
          nullable: true
          description: saved event matches by faces or events
          items:
            $ref: '#/components/schemas/event_match_result'
        face_detections:
          nullable: true
          type: array
          items:
            properties:
              sample_id:
                $ref: '#/components/schemas/sample_id'
              detection:
                $ref: '#/components/schemas/event_face_detection'
              detect_time:
                $ref: "#/components/schemas/detect_time"
              image_origin:
                $ref: "#/components/schemas/image_origin"
            required: [sample_id, detect_time, image_origin]
        body_detections:
          nullable: true
          type: array
          items:
            properties:
              sample_id:
                $ref: '#/components/schemas/sample_id'
              detection:
                $ref: '#/components/schemas/event_body_detection'
              detect_time:
                $ref: "#/components/schemas/detect_time"
              image_origin:
                $ref: "#/components/schemas/image_origin"
            required: [sample_id, detect_time, image_origin]
        face_id:
          allOf:
            - $ref: '#/components/schemas/face_id'
            - nullable: true
        attach_result:
          type: array
          items:
            $ref: '#/components/schemas/list_id'
          nullable: true
        gender:
          allOf:
            - $ref: '#/components/schemas/gender'
            - nullable: true
        age:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/age'
        emotion:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/emotion'
        mask:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/mask'
        ethnic_group:
          allOf:
          - $ref: '#/components/schemas/ethnic_group'
          - nullable: true
        tags:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/tags'
        user_data:
          $ref: '#/components/schemas/event_user_data'
        location:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/location'
        track_id:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/track_id'

    Candidate_Match_Result_Event:
      type: object
      properties:
        similarity:
          allOf:
          - $ref: '#/components/schemas/similarity'
          - description: face match similarity
        event:
          $ref: '#/components/schemas/candidate_event'
      description: sorted list with match result for the event and a event.
      required: [similarity, event]

    match_candidates_faces:
      type: object
      properties:
        label:
          $ref: '#/components/schemas/top_matching_candidates_label'
        candidates:
          type: array
          description: list of faces candidates
          items:
            $ref: '#/components/schemas/candidate_match_result_face'
      required: [label, candidates]

    match_candidates_events:
      type: object
      properties:
        label:
          $ref: '#/components/schemas/top_matching_candidates_label'
        candidates:
          type: array
          description: list of events candidates
          items:
            $ref: '#/components/schemas/Candidate_Match_Result_Event'
      required: [label, candidates]

    match_candidates_face_in_event_candidates_in_target_match_result:
      type: object
      properties:
        face:
          type: object
          properties:
            face_id:
              allOf:
                - $ref: '#/components/schemas/face_id'
                - nullable: true
            user_data:
              allOf:
                - $ref: '#/components/schemas/event_user_data'
                - nullable: true
            create_time:
              allOf:
                - $ref: '#/components/schemas/create_time'
                - nullable: true
            external_id:
              allOf:
                - $ref: '#/components/schemas/external_id'
                - nullable: true
          required: [face_id, user_data, create_time, external_id]
        similarity:
          allOf:
          - $ref: '#/components/schemas/similarity'
          description: face candidate similarity
      required: [face, similarity]

    create_time:
      allOf:
        - $ref: "#/components/schemas/time"
        - description: time of the obejct creation.

    match_candidates_events_in_event_candidates_in_target_match_result:
      type: object
      description: event candidate object in the response
      properties:
        event:
          type: object
          properties:
            event_id:
              allOf:
                - $ref: '#/components/schemas/event_id'
                - nullable: true
            user_data:
              $ref: '#/components/schemas/event_user_data'
            create_time:
              allOf:
                - $ref: '#/components/schemas/create_time'
                - nullable: true
            external_id:
              allOf:
                - $ref: '#/components/schemas/external_id'
                - nullable: true
            handler_id:
              allOf:
                - $ref: '#/components/schemas/handler_id'
                - nullable: true
            source:
              allOf:
                - $ref: '#/components/schemas/source'
                - nullable: true
          required: [event_id, user_data, create_time, external_id, handler_id, source]
        similarity:
          allOf:
          - $ref: '#/components/schemas/similarity'
          description: event candidate similarity
      required: [event, similarity]

    event_match_result:
      type: object
      description: saved event matches by a set of candidates
      properties:
        label:
          $ref: '#/components/schemas/label'
        candidates:
          oneOf:
          - type: array
            description: saved event matches by faces
            items:
              $ref: '#/components/schemas/match_candidates_face_in_event_candidates_in_target_match_result'
          - type: array
            description: saved event matches by events
            items:
              $ref: '#/components/schemas/match_candidates_events_in_event_candidates_in_target_match_result'
      required: [label, candidates]



    match_candidates_reply:
      oneOf:
        - $ref: '#/components/schemas/match_candidates_faces'
        - $ref: '#/components/schemas/match_candidates_events'

    Matches:
      description: sorted list with match result for the event.
      type: array
      items:
        $ref: '#/components/schemas/match_candidates_reply'
      example:
        [{
           label: good guys,
           candidates: [{
                          face:{
                            face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6,
                            external_id: 2xQ2gprbMUePw1s9gw9fvA==,
                            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
                          },
                          similarity: 0.5
                        }]},
         {
           label: bad guys,
           candidates: [{
                          event:{
                            event_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7,
                            external_id: 2xQ2gprbMUePw1s9gw9fvA==,
                            user_data: fox1991,
                            create_time: "2018-08-11T09:11:41.674Z",
                            handler_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7,
                            source: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7
                          },
                          similarity: 0.3
                        }]}]

    detect_json_with_base_64:
      type: object
      properties:
        image:
          type: string
          description: image in base64
        mimetype:
          type: string
          enum: ["image/x-jpeg-base64", "image/x-png-base64", "image/x-bmp-base64", "image/x-tiff-base64",
                 "image/x-portable-pixmap-base64"]
          description: image mimetype
        face_bounding_boxes:
          allOf:
            - description: array with face bounding boxes for image (now support only 1 bounding box)
            - $ref: '#/components/schemas/base_bounding_boxes'
      required: [image, mimetype, face_bounding_boxes]

    sdk_json_with_base_64:
      type: object
      properties:
        image:
          type: string
          description: image in base64
        mimetype:
          type: string
          enum: ["image/x-jpeg-base64", "image/x-png-base64", "image/x-bmp-base64", "image/x-tiff-base64",
                 "image/x-portable-pixmap-base64"]
          description: image mimetype
        face_bounding_boxes:
          allOf:
            - description: array with face bounding boxes for image (now support only 1 bounding box)
            - $ref: '#/components/schemas/base_bounding_boxes'
        body_bounding_boxes:
          allOf:
            - description: array with body bounding boxes for image (now support only 1 bounding box)
            - $ref: '#/components/schemas/base_bounding_boxes'
      required: [image, mimetype]

    handler_json_with_base_64:
      type: object
      properties:
        image:
          type: string
          description: image or raw descriptor in base64
        mimetype:
          type: string
          enum: ["image/x-jpeg-base64", "image/x-png-base64", "image/x-bmp-base64", "image/x-tiff-base64",
                 "image/x-portable-pixmap-base64", "application/x-sdk-descriptor-base64", "application/x-vl-xpk-base64"]
          description: image mimetype
        face_bounding_boxes:
          allOf:
            - description: array with face bounding boxes for image (now support only 1 bounding box)
            - $ref: '#/components/schemas/base_bounding_boxes'
        body_bounding_boxes:
          allOf:
            - description: array with body bounding boxes for image (now support only 1 bounding box)
            - $ref: '#/components/schemas/base_bounding_boxes'
      required: [image, mimetype]

    json_request_body_urls:
      type: object
      properties:
        urls:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
                format: uri
                description: image url
                example: "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Abbey_Lee_2015.jpg/800px-Abbey_Lee_2015.jpg"
              face_bounding_boxes:
                allOf:
                  - description: array with face bounding boxes for image (now support only 1 bounding box)
                  - $ref: '#/components/schemas/base_bounding_boxes'
            required: [url]
          minItems: 1
          maxItems: 8
      required: [urls]

    sdk_json_request_body_urls:
      type: object
      properties:
        urls:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
                format: uri
                description: image url
                example: "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Abbey_Lee_2015.jpg/800px-Abbey_Lee_2015.jpg"
              face_bounding_boxes:
                allOf:
                  - description: array with face bounding boxes for image (now support only 1 bounding box)
                  - $ref: '#/components/schemas/base_bounding_boxes'
              body_bounding_boxes:
                allOf:
                  - description: array with body bounding boxes for image (now support only 1 bounding box)
                  - $ref: '#/components/schemas/base_bounding_boxes'
            required: [url]
          minItems: 1
          maxItems: 8
      required: [urls]

    list_samples:
      type: object
      properties:
        samples:
          type: array
          items:
            allOf:
            - $ref: '#/components/schemas/sample_id'
          minItems: 1
          maxItems: 8
          description: |
            list of sample ids

            > **WARNING** The type of samples is determined by *`image_type`* / *`warped_image`* parameter.
            The detector stage of image processing pipeline is triggered for non-warped images and skipped for warps.

          example:
          - "c724fea1-d1bb-44c5-af6d-9833d22f3eb7"
          - "f78c6156-3946-4767-be65-4748f25aefd4"
      required: [samples]

    emit_event_json_request_body:
      oneOf:
      - $ref: '#/components/schemas/handler_json_with_base_64'
      - $ref: '#/components/schemas/json_request_body_urls'
      - $ref: '#/components/schemas/list_samples'

    detect_json_request_body:
      oneOf:
      - $ref: '#/components/schemas/detect_json_with_base_64'
      - $ref: '#/components/schemas/json_request_body_urls'
      - $ref: '#/components/schemas/list_samples'

    sdk_json_request_body:
      oneOf:
      - $ref: '#/components/schemas/sdk_json_with_base_64'
      - $ref: '#/components/schemas/sdk_json_request_body_urls'
      - $ref: '#/components/schemas/list_samples'

    verify_json_request_body:
      oneOf:
      - $ref: '#/components/schemas/verify_json_with_base_64'
      - $ref: '#/components/schemas/json_request_body_urls'
      - $ref: '#/components/schemas/list_samples'

    verify_json_with_base_64:
      type: object
      properties:
        image:
          type: string
          description: image or raw descriptor in base64
        mimetype:
          type: string
          enum: ["image/x-jpeg-base64", "image/x-png-base64", "image/x-bmp-base64", "image/x-tiff-base64",
                 "image/x-portable-pixmap-base64", "application/x-sdk-descriptor-base64", "application/x-vl-xpk-base64"]
          description: image/descriptor mimetype
        face_bounding_boxes:
          allOf:
            - description: array with face bounding boxes for image (now support only 1 bounding box)
            - $ref: '#/components/schemas/base_bounding_boxes'
      required: [image, mimetype]

    image:
       type: string
       format: binary or byte

    multipart_images:
      type: array
      items:
        $ref: '#/components/schemas/image'
      description: Content-Disposition header must contains actual filename.
        It is only possible to send many images with different filenames.
        This part must have valid Content-Type header (one of "image/x-jpeg-base64", "image/jpeg",
        "image/x-png-base64", "image/png", "image/x-bmp-base64", "image/bmp", "image/x-tiff-base64",
        "image/tiff", "image/x-portable-pixmap-base64", "image/x-portable-pixmap")

    base_bounding_boxes:
      type: array
      description: array with bounding boxes
      items:
        $ref: '#/components/schemas/rect'
      minItems: 1

    face_bounding_boxes:
       type: array
       description: map with image filenames and arrays of face bounding boxes
       items:
         type: object
         properties:
           filename:
             type: string
             description: Image filename. It must be the same as one of 'image' request part filename
           face_bounding_boxes:
              allOf:
                - description: array with face bounding boxes for image (now support only 1 bounding box)
                - $ref: '#/components/schemas/base_bounding_boxes'
         required: [filename, face_bounding_boxes]
       minItems: 1

    body_bounding_boxes:
      type: array
      description: map with image filenames and arrays of body bounding boxes
      items:
        type: object
        properties:
          filename:
            type: string
            description: Image filename. It must be the same as one of 'image' request part filename
          body_bounding_boxes:
            allOf:
              - description: array with body bounding boxes for image (now support only 1 bounding box)
              - $ref: '#/components/schemas/base_bounding_boxes'
        required: [filename, body_bounding_boxes]
      minItems: 1

    multipart_image_schema:
      type: object
      properties:
        image:
          $ref: '#/components/schemas/image_list_for_multipart'
        face_bounding_boxes:
          $ref: '#/components/schemas/face_bounding_boxes'
      required: [image]

    multipart_sdk_image_schema:
      type: object
      properties:
        image:
          $ref: '#/components/schemas/multipart_images'
        face_bounding_boxes:
          $ref: '#/components/schemas/face_bounding_boxes'
        body_bounding_boxes:
          $ref: '#/components/schemas/body_bounding_boxes'
      required: [image]

    multipart_raw_data_schema_with_policies:
      type: object
      properties:
        policies:
          $ref: '#/components/schemas/Policies'
        image:
          $ref: '#/components/schemas/raw_data_list_for_multipart'
        face_bounding_boxes:
          $ref: '#/components/schemas/face_bounding_boxes'
        body_bounding_boxes:
          $ref: '#/components/schemas/body_bounding_boxes'
      required: [image]

    multipart_verifier_payload:
      type: object
      properties:
        image:
          $ref: '#/components/schemas/raw_data_list_for_multipart'
        face_bounding_boxes:
          $ref: '#/components/schemas/face_bounding_boxes'
      required: [image]

    accept_docs_handler:
      type: string
      enum: [application/x-yaml, text/html]

    extracted_sdk_descriptor:
      description: sdk descriptor.
      type: object
      properties:
        sdk_descriptor:
          $ref: '#/components/schemas/sdk_descriptor'
        score:
          allOf:
          - $ref: '#/components/schemas/number01'
          - description: descriptor score (always 1 for body descriptor)

    face_warp:
      type: string
      format: byte
      description: face warped image in jpg format

    body_warp:
      type: string
      format: byte
      description: human body warped image in jpg format

    mask_estimations:
      type: object
      description: raw mask estimations
      properties:
        medical_mask:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: The probability that the `medical mask` exists on the face and is worn properly
        missing:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: The probability that the `medical mask` doesn't exist on the face
        occluded:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: The probability that the face is occluded by other object (not by `medical mask`)
      required: [medical_mask, missing, occluded]

    mask_predominant:
      type: string
      enum: [medical_mask, missing, occluded]
      description: most likely mask state

    masks:
      type: object
      description: estimated face mask state
      properties:
        estimations:
          $ref: '#/components/schemas/mask_estimations'
        predominant_mask:
          $ref: '#/components/schemas/mask_predominant'
      required: [estimations, predominant_mask]

    glasses_estimations:
      type: string
      enum: [no_glasses, eyeglasses, sunglasses]
      description: glasses estimation

    glasses:
      type: object
      description: estimated glasses
      properties:
        glasses:
          $ref: '#/components/schemas/glasses_estimations'
      required: [estimations]

    sdk_face_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_direction'
            - description: gaze direction estimation.
        descriptor:
          $ref: '#/components/schemas/extracted_sdk_descriptor'
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
        mask:
          $ref: '#/components/schemas/masks'
        glasses:
          $ref: '#/components/schemas/glasses'
        liveness:
          $ref: '#/components/schemas/liveness'

    liveness:
      type: object
      description: liveness prediction
      properties:
        prediction:
          type: string
          enum: [spoof, real, unknown]
          description: liveness prediction name
        estimation:
          type: object
          description: liveness estimation
          properties:
            quality:
              allOf:
                - $ref: '#/components/schemas/number01'
              description: liveness quality score
            score:
              allOf:
                - $ref: '#/components/schemas/number01'
              description: liveness prediction score
          required: [quality, score]
      required: [prediction, estimation]

    sdk_face_detections:
      type: object
      properties:
        attributes:
          allOf:
            - $ref: '#/components/schemas/sdk_face_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.
        warp:
          $ref: '#/components/schemas/face_warp'


    sdk_face_estimations:
      description: face detection estimations
      type: object
      properties:
        detection:
          $ref: '#/components/schemas/sdk_face_detections'
      required: [detection]
      nullable: true

    sdk_body_attributes:
      description: human body attributes.
      type: object
      properties:
        descriptor:
          $ref: '#/components/schemas/extracted_sdk_descriptor'

    sdk_body_detections:
      type: object
      properties:
        attributes:
          $ref: '#/components/schemas/sdk_body_attributes'
        rect:
          allOf:
            - $ref: '#/components/schemas/rect'
            - description: face detection bounding box.
        warp:
          $ref: '#/components/schemas/body_warp'

    sdk_body_estimations:
      description: human body detection estimations
      type: object
      properties:
        detection:
          $ref: '#/components/schemas/sdk_body_detections'
      required: [detection]
      nullable: true

    one_image_estimation:
      type: object
      properties:
        filename:
          $ref: '#/components/schemas/filename'
        estimations:
          description: |
            list of related detections, i.e. body & face related samples that refer to the one person.
            If one of **body** or **face** field is *null*, it means that either the corresponding detection is disabled
            (see *detect_face*, *detect_body* parameters), or the detection has been filtered.
            Both **body** and **face** fields in a related detection can not be *null* at the same time.
          type: array
          items:
            type: object
            properties:
              face:
                $ref: '#/components/schemas/sdk_face_estimations'
              body:
                $ref: '#/components/schemas/sdk_body_estimations'
            required: [face, body]
      required: [filename, estimations]

    aggregate_estimations:
      type: object
      description: |
        aggregated attributes.
        If one of **body** or **face** field is *null*, it means that either the corresponding aggregation is disabled
        (see *aggregate_attributes*, *estimate_face_descriptor*, *estimate_body_descriptor* parameters),
        or the attribute has been filtered.
      properties:
        body:
          type: object
          properties:
            attributes:
              description: human body aggregate estimations
              type: object
              properties:
                descriptor:
                  $ref: '#/components/schemas/extracted_sdk_descriptor'
          required: [attributes]
          nullable: true
        face:
          type: object
          properties:
            attributes:
              description: face aggregate estimations
              type: object
              properties:
                descriptor:
                  $ref: '#/components/schemas/extracted_sdk_descriptor'
                basic_attributes:
                  $ref: '#/components/schemas/basic_attributes'
          required: [attributes]
          nullable: true
      required: [face, body]

    sdk_response_json:
      type: object
      properties:
        images_estimations:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/one_image_estimation'
              - $ref: '#/components/schemas/image_error'
        aggregate_estimations:
          $ref: '#/components/schemas/aggregate_estimations'
      required: [images_estimations]

    sdk_response_msgpack:
      type: object
      properties:
        images_estimations:
          type: array
          items:
            oneOf:
              - allOf:
                - properties:
                    estimations:
                      items:
                        properties:
                          face:
                            properties:
                              detection:
                                properties:
                                  warp:
                                    format: binary
                                  attributes:
                                    properties:
                                      descriptor:
                                        properties:
                                          sdk_descriptor:
                                            format: binary
                            body:
                              properties:
                                detection:
                                  properties:
                                    warp:
                                      format: binary
                                    attributes:
                                      properties:
                                        descriptor:
                                          properties:
                                            sdk_descriptor:
                                              format: binary
                - $ref: '#/components/schemas/one_image_estimation'
              - $ref: '#/components/schemas/image_error'
        aggregate_estimations:
          allOf:
          - properties:
              face:
                properties:
                  attributes:
                    properties:
                      descriptor:
                        properties:
                          sdk_descriptor:
                            format: binary
              body:
                attributes:
                  properties:
                    descriptor:
                      properties:
                        sdk_descriptor:
                          format: binary
          - $ref: '#/components/schemas/aggregate_estimations'
      required: [ images_estimations ]

    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

    raw_data_binary_for_multipart:
      type: string
      format: binary
      description: |
        Binary image or raw descriptror data (SDK descripror or XPK file).

        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", "application/x-sdk-descriptor", "application/x-vl-xpk")

    raw_data_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",
        "application/x-sdk-descriptor-base64", "application/x-vl-xpk-base64")

    raw_data_for_multipart:
      oneOf:
        - $ref: '#/components/schemas/raw_data_binary_for_multipart'
        - $ref: '#/components/schemas/raw_data_base64_for_multipart'

    raw_data_list_for_multipart:
      type: array
      items:
        $ref: '#/components/schemas/raw_data_for_multipart'
      minItems: 1

    verifier_detect_policy:
      type: object
      properties:
        multiface_policy:
          allOf:
            - description: |
                  multiple face detection policy:
                  - *`0`* - multiple face detection not allowed
                  - *`1`* - multiple face detection allowed
                  - *`2`* - get best face detection from the image
            - $ref: '#/components/schemas/multiface_policy'
        estimate_head_pose:
          $ref: '#/components/schemas/estimate_head_pose'
        estimate_emotions:
          $ref: '#/components/schemas/estimate_emotions'
        estimate_mask:
          $ref: '#/components/schemas/estimate_mask'
        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
        mask_states:
          $ref: '#/components/schemas/mask_states'

      description:  |
        policy determinates parameters for face detection.

    verifier_detect_policy_required:
      allOf:
        - $ref: '#/components/schemas/verifier_detect_policy'
        - required: [multiface_policy, estimate_head_pose, estimate_emotions, estimate_mask, estimate_quality,
                     estimate_gaze, estimate_eyes_attributes, estimate_mouth_attributes, detect_landmarks68,
                     extract_exif, yaw_threshold, roll_threshold, pitch_threshold, mask_states]

    verifier_extract_policy:
      type: object
      properties:
        extract_basic_attributes:
          $ref: '#/components/schemas/extract_basic_attributes'
        fd_score_threshold:
          $ref: '#/components/schemas/score_threshold'
      description: policy determinates parameters for attributes extraction.

    verifier_extract_policy_required:
      allOf:
        - $ref: '#/components/schemas/verifier_extract_policy'
        - required: [extract_basic_attributes, fd_score_threshold]

    verifier_storage_policy:
      description: verifier object's storing policy
      type: object
      properties:
        attribute_policy:
          description: attribute storing policy
          type: object
          properties:
            store_attribute:
              allOf:
                - description: whether to store attribute
                - $ref: '#/components/schemas/int01'
              default: 0
          example:
            store_attribute: 0
        face_sample_policy:
          description: face sample storing policy
          type: object
          properties:
            store_sample:
              allOf:
                - description: whether to store face sample
                - $ref: '#/components/schemas/int01'
              default: 0
          example:
            store_sample: 0

    verifier_storage_policy_required:
      $ref: '#/components/schemas/verifier_storage_policy'

    verification_threshold:
      allOf:
      - $ref: '#/components/schemas/number01'
      description: verification similarity threshold

    new_verifier:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
        description:
          type: string
          maxLength: 128
          description: verifier user description.
          example: strict verifier
        policies:
          type: object
          properties:
            verification_threshold:
              allOf:
                - $ref: '#/components/schemas/verification_threshold'
              default: 0.9
            detect_policy:
              $ref: '#/components/schemas/verifier_detect_policy'
            extract_policy:
              $ref: '#/components/schemas/verifier_extract_policy'
            storage_policy:
              $ref: '#/components/schemas/verifier_storage_policy'
      required: [account_id]

    verifier_response:
      type: object
      properties:
        verifier_id:
          $ref: '#/components/schemas/handler_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        description:
          type: string
          maxLength: 128
          description: user description.
        policies:
          type: object
          properties:
            verification_threshold:
              $ref: '#/components/schemas/verification_threshold'
            detect_policy:
              $ref: '#/components/schemas/verifier_detect_policy_required'
            extract_policy:
              $ref: '#/components/schemas/verifier_extract_policy_required'
            storage_policy:
              $ref: '#/components/schemas/verifier_storage_policy_required'
          required: [verification_threshold, detect_policy, extract_policy, storage_policy]
        create_time:
          type: string
          format: date-time
          description: the verifier creation time.
        last_update_time:
          type: string
          format: date-time
          description: the verifier last update time.
        version:
          description: verifier current version (increases on update)
          type: integer
          minimum: 0
          example: 111
      required: [verifier_id, account_id, description, create_time, last_update_time, policies, version]

    raw_descriptor:
      type: string
      format: binary
      description: raw descriptor

    descriptor_data:
      type: object
      description: descriptor and descriptor version
      properties:
        descriptor:
          $ref: '#/components/schemas/raw_descriptor'
        version:
          $ref: '#/components/schemas/descriptor_version'
      required: [descriptor, version]

    descriptor_version:
      type: integer
      description: the descriptor version
      enum: [46, 52, 54, 56]
      example: 56

    xpk_file:
      type: string
      format: binary
      description:  xpk file with descriptors

    identification_id:
      allOf:
      - $ref: '#/components/schemas/common_id'
      - description:  id for identification in the match results
      - example: 3456d

    raw_descriptor_entity_binary:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: ["raw_descriptor"]
        data:
          $ref: '#/components/schemas/descriptor_data'
      required: [id, type, data]

    raw_descriptor_entity_base64:
      allOf:
      - type: object
        properties:
          data:
            type: object
            properties:
              descriptor:
                type: string
                format: byte
      - $ref: '#/components/schemas/raw_descriptor_entity_binary'

    sdk_descriptor_entity_binary:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: ["sdk_descriptor"]
          description:  type corresponds to a `x-vl-face-descriptor` content type
        data:
          $ref: '#/components/schemas/sdk_descriptor'
      required: [id, type, data]

    sdk_descriptor_entity_base64:
      allOf:
      - type: object
        properties:
          data:
            type: string
            format: byte
      - $ref: '#/components/schemas/sdk_descriptor_entity_binary'

    xpk_file_entity_binary:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: ["xpk_file"]
          description: type corresponds to a `application/x-vl-xpk` content type
        data:
          $ref: '#/components/schemas/xpk_file'
      required: [id, type, data]

    xpk_file_entity_base64:
      allOf:
      - type: object
        properties:
          data:
            type: string
            format: byte
      - $ref: '#/components/schemas/xpk_file_entity_binary'

    raw_verification_request_json:
      type: object
      properties:
        references:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/xpk_file_entity_base64'
              - $ref: '#/components/schemas/sdk_descriptor_entity_base64'
              - $ref: '#/components/schemas/raw_descriptor_entity_base64'
          description: reference list for verification
          minItems: 1
        candidates:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/xpk_file_entity_base64'
              - $ref: '#/components/schemas/sdk_descriptor_entity_base64'
              - $ref: '#/components/schemas/raw_descriptor_entity_base64'
          minItems: 1
          description: candidates for verification
      required: [references, candidates]

    raw_verification_request_msgpack:
      type: object
      properties:
        references:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/xpk_file_entity_binary'
              - $ref: '#/components/schemas/sdk_descriptor_entity_binary'
              - $ref: '#/components/schemas/raw_descriptor_entity_binary'
          description: reference list for verification
          minItems: 1
        candidates:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/xpk_file_entity_binary'
              - $ref: '#/components/schemas/sdk_descriptor_entity_binary'
              - $ref: '#/components/schemas/raw_descriptor_entity_binary'
          minItems: 1
          description: candidates for verification
      required: [references, candidates]

    raw_match_reference_id:
      allOf:
      - description: reference id for identification in the match results
      - example: 123456s
      - $ref: '#/components/schemas/common_id'

    raw_match_candidate_id:
      allOf:
      - description: candidate id for identification in the match results
      - example: 56789t
      - $ref: '#/components/schemas/common_id'

    raw_verification_response:
      type: object
      properties:
        matches:
          type: array
          items:
            type: object
            properties:
              reference_id:
                $ref: '#/components/schemas/raw_match_reference_id'
              matches:
                type: array
                items:
                  description: sorted list with success match result for the *reference_id* vs candidate batch.
                  type: object
                  properties:
                    candidate_id:
                      $ref: '#/components/schemas/raw_match_candidate_id'
                    similarity:
                      $ref: '#/components/schemas/similarity'
                    status:
                      $ref: '#/components/schemas/verification_status'
                  required: [candidate_id, similarity, status]
                minItems: 1
                description: reference vs candidates matches
            required: [reference_id, matches]
          minItems: 1
          description: list of matches
      required: [matches]

    verifier_base_verification:
      type: object
      properties:
        similarity:
          allOf:
          - $ref: '#/components/schemas/similarity'
          description: similarity score
        status:
          $ref: '#/components/schemas/verification_status'
          description: verification result
      required: [similarity, status]

    verifier_event_verification:
      allOf:
        - $ref: '#/components/schemas/verifier_base_verification'
        - type: object
          properties:
            event:
              type: object
              properties:
                event_id:
                  $ref: '#/components/schemas/event_id'
              required: [event_id]
      description: Verification against an event id
      required: [event]

    verifier_face_verification:
      allOf:
        - $ref: '#/components/schemas/verifier_base_verification'
        - type: object
          properties:
            face:
              type: object
              properties:
                face_id:
                  $ref: '#/components/schemas/face_id'
              required: [face_id]
      description: Verification against a face
      required: [face]

    verifier_face_detection_face_attributes:
      type: object
      properties:
        attribute_id:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/attribute_id'
          description: attribute id, null if descriptor score is lower than score treshold
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
        score:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: face descriptor quality score.
        url:
          nullable: true
          type: string
          format: uri
          example: /0/attributes/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
          description: location of attributes, null if descriptor score is lower than score treshold
        samples:
          type: array
          items:
            $ref: '#/components/schemas/sample_id'
          minItems: 1
          example: ['a3e8716f-70dc-42ad-8428-7a552e800a37']
          description: resource for attributes.

      required: [attribute_id, url, samples]

    verifier_face_detection:
      type: object
      properties:
        verifications:
          type: array
          items:
            oneOf:
            - $ref: '#/components/schemas/verifier_face_verification'
            - $ref: '#/components/schemas/verifier_event_verification'

        face_attributes:
          $ref: '#/components/schemas/verifier_face_detection_face_attributes'

        sample:
          type: object
          properties:
            face:
              allOf:
              - $ref: '#/components/schemas/face_detection'
              properties:
                rect:
                  allOf:
                  - $ref: '#/components/schemas/rect'
                  description: face detection bounding box. Absent in case of verifying against warp.
                sample_id:
                  $ref: '#/components/schemas/sample_id'
                url:
                  type: string
                  nullable: true
                  format: uri
                  example: /0/samples/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
                  description: location of the sample, null if sample was not stored
          required: [face]
      required: [verifications, face_attributes, sample]

    verifier_id_verification_response:
      type: object
      properties:
        images:
          description: Verification results for provided images/descriptors.
          type: array
          items:
            type: object
            description: processed image.
            properties:
              error:
                allOf:
                  - $ref: '#/components/schemas/Error'
                  - example:
                      error_code: 0
                      detail: Success
                      desc: Success
              status:
                allOf:
                  - $ref: '#/components/schemas/image_status'
                  - example: 1
                    description: |
                      Status 1 means that the image was processed without errors. Status 0 means
                      that the image was processed with errors, information about error is contained in field `error`

              filename:
                $ref: '#/components/schemas/filename'
              exif:
                $ref: '#/components/schemas/exif'
              detections:
                type: object
                description: detections lists
                properties:
                  face_detections:
                    type: array
                    items:
                      $ref: '#/components/schemas/verifier_face_detection'
                  filtered_detections:
                    $ref: '#/components/schemas/filtered_detections'
                required: [face_detections, filtered_detections]
            required: [error, status, filename, detections]
      required: [images]

    track_id:
      description: event track id
      type: string
      pattern: '^[a-zA-Z0-9_\-](1, 36)$'
      example: "useful_track_id_number_1"

    track_ids:
      type: array
      items:
        $ref: '#/components/schemas/track_id'
      description: list of track ids. Each event from result will contain one of the given track ids.
      minItems: 1
      maxItems: 1000

    raw_event:
      type: object
      description: user generated events
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
        detections:
          description: list of body & face related detections
          type: array
          maxItems: 100
          items:
            $ref: '#/components/schemas/input_event_detection_samples'
        source:
          $ref: '#/components/schemas/source'
        location:
          $ref: '#/components/schemas/input_location'
        external_id:
          $ref: '#/components/schemas/external_id'
        user_data:
          $ref: '#/components/schemas/event_user_data'
        track_id:
          $ref: '#/components/schemas/track_id'
        face:
          $ref: '#/components/schemas/input_event_face'
        matches:
          maxItems: 30
          allOf:
          - $ref: '#/components/schemas/Matches'
        face_attributes:
          $ref: '#/components/schemas/input_event_face_attribute'
        body_attributes:
          $ref: '#/components/schemas/input_event_body_attribute'
        tags:
          allOf:
          - $ref: '#/components/schemas/tags'
          - maxItems: 100
        create_time:
          allOf:
            - $ref: "#/components/schemas/time"
            - description: time of the event creation.
      required: [account_id]
    example:
      account_id: 9cf8e1fb-0637-4689-a55b-f9ffe455bc9c
      face_attributes:
        attribute_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
        basic_attributes:
          age: 29
          gender: 1
          ethnicities:
            estimations:
              african_american: 1.92238889737406e-12
              asian: 0.954671621322632
              caucasian: 0.045328326523304
              indian: 7.65100649502415e-10
            predominant_ethnicity: asian
        score: 0.7525901794
        url: "/6/attributes/24d405ce-bc56-4bf7-98e1-bdc962b4cf34"
        samples:
          - a3e8716f-70dc-42ad-8428-7a552e800a37
      source: 3rd Avenue
      tags:
        - tag1
        - tag2
      external_id: b668c4a5-2191-some-important-words
      user_data: string
      face:
        face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
        event_id: f9687459-986b-406d-9c1f-0d6289be5256
        user_data: fox1991
        external_id: 2xQ2gprbMUePw1s9gw9fvA==
        avatar: "/6/samples/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c"
        lists:
          - 429b0e78-4616-426a-b57f-02baa72d638d
          - 6d037c33-31ec-4d73-b3b3-ec80b09446c2
        url: "/6/faces/24d405ce-bc56-4bf7-98e1-bdc962b4cf34"
      matches:
        - label: good guys
          candidates:
            - face:
                face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
                external_id: 2xQ2gprbMUePw1s9gw9fvA==
                user_data: fox1991
                create_time: '2018-08-11T09:11:41.674Z'
                lists:
                  - 429b0e78-4616-426a-b57f-02baa72d638d
                  - 6d037c33-31ec-4d73-b3b3-ec80b09446c2
                avatar: "/6/samples/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c"
                event_id: f9687459-986b-406d-9c1f-0d6289be5256
              similarity: 0.5
        - label: bad guys
          candidates:
            - event:
                event_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7
                external_id: 2xQ2gprbMUePw1s9gw9fvA==
                user_data: fox1991
                create_time: '2018-08-11T09:11:41.674Z'
                handler_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7
                source: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7
              similarity: 0.3
      location:
        city: Moscow
        area: ZAO
        district: Arbat
        street: Arbat
        house_number: "10"
        geo_position:
          longitude: 36.616
          latitude: 55.752
      detections:
        - filename: penelope.jpeg
          samples:
            body:
              sample_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
              detection:
                rect:
                  height: 240
                  width: 209
                  x: 170
                  y: 198
              url: "/6/samples/bodies/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c"
            face:
              sample_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
              detection:
                attributes:
                  mouth_attributes:
                    occluded: 0
                    opened: 0
                    score: 1
                    smile: 0
                  emotions:
                    estimations:
                      anger: 0.00894705578684807
                      disgust: 9.65219624049496e-06
                      fear: 0.00121302821207792
                      happiness: 0.00129503419157118
                      neutral: 0.986027479171753
                      sadness: 0.00187553185969591
                      surprise: 0.000632198702078313
                    predominant_emotion: neutral
                  mask:
                    estimations:
                      medical_mask: 0.7108324766
                      missing: 0.0700698048
                      occluded: 0.2190976739
                    predominant_mask: medical_mask
                  head_pose:
                    pitch: 18.6827487945557
                    roll: -10.3542232513428
                    yaw: 15.4102487564087
                  gaze:
                    pitch: 9.26744079589844
                    yaw: -19.4657287597656
                quality:
                  light: 0.87
                  dark: 0.13
                  illumination: 0.1
                  specularity: 0.1
                  blurriness: 0.2
                rect:
                  height: 240
                  width: 209
                  x: 170
                  y: 198
              url: "/6/samples/faces/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c"
          detect_time: '2018-08-11T09:11:41.674Z'
          image_origin: "/6/images/b668c4a5-2191-476e-a261-3b4f9ce2e25e"
      track_id: useful_track_id_number_1

    saved_event:
      type: object
      properties:
        event_id:
          $ref: '#/components/schemas/event_id'
        url:
          type: string
          format: uri
      required:
        - event_id
        - url
      example:
        event_id: b5d6fd45-fcca-453d-ac05-3e594054b813
        url: http://127.0.0.1:5040/2/events/b5d6fd45-fcca-453d-ac05-3e594054b813


  responses:
    internal_server_error:
      description: internal server error.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'

    server_timeout_error:
      description: server timeout error.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
            example:
              error_code: 9
              detail: Request timeout
              desc: Request timeout on http://127.0.0.1:5090/{...}, method {...}

    verifier_not_found:
      description: verifier not found
      headers:
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Content-Type:
          $ref: '#/components/headers/application_json'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 34004
            desc: Object not found
            detail: Verifier with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found

    handler_not_found:
      description: handler not found
      headers:
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Content-Type:
          $ref: '#/components/headers/application_json'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 11033
            desc: Object not found
            detail: Handler with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
paths:
  /version:
    get:
      tags:
      - version

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

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/version'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/detector:
    post:
      tags: [samples]
      summary: detect faces
      description: detect faces in input images.
      operationId: detectFaces
      parameters:
      - $ref: '#/components/parameters/account_id_required'
      - $ref: '#/components/parameters/luna_request_id'
      - 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
      - $ref: '#/components/parameters/detector_multiface_policy'
      - $ref: '#/components/parameters/estimate_head_pose'
      - $ref: '#/components/parameters/estimate_emotions'
      - $ref: '#/components/parameters/estimate_mask'
      - $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'
      - $ref: '#/components/parameters/use_exif_info'

      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: 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
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/multipart_image_schema'
            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/detect_json_request_body'

        required: true
      responses:
        201:
          description: Created
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
          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'
          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'
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                bad_conten_type_download_image:
                  value:
                    error_code: 11028
                    desc: Bad/incomplete input data
                    detail: 'Bad content type of image ''https://www.google.ru'''
                bad_conten_type_multepart:
                  value:
                    error_code: 11029
                    desc: Bad/incomplete input data
                    detail: Bad content type of image in multipart body
                failed_load_image:
                  value:
                    error_code: 11027
                    desc: External request failed
                    detail: 'Failed  to download image by url ''https://www.gooogle.ru'''
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/extractor:
    post:
      tags:
      - attributes
      summary: extract attributes
      description: extract attributes from samples.
      operationId: extractAttributes
      parameters:
      - $ref: '#/components/parameters/account_id_required'
      - $ref: '#/components/parameters/luna_request_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'
      - $ref: '#/components/parameters/ttl'

      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/uuid'
              maxItems: 8
              minItems: 1
              description: sample id list
        required: true

      responses:
        201:
          description: created.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          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'
          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
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'extract_basic_attributes'
                sample_not_found:
                  value:
                    error_code: 11031
                    desc: Bad/incomplete input data
                    detail: Sample 483037a5-8d67-427d-a498-f8f62bb06fb1 not found
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'samples',  message: 'ensure this value has at least 1 items'"
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/extractor/upgrade:
    post:
      tags:
      - attributes
      summary: upgrade face attribute
      description: Append a descriptor of non-default version and/or replace basic attributes from samples.
      operationId: upgradeAttributes
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'

      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/score_threshold'
      - $ref: '#/components/parameters/extract_descriptor'
      - $ref: '#/components/parameters/extract_basic_attributes'
      - $ref: '#/components/parameters/descriptor_version'

      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                samples:
                  type: array
                  items:
                    $ref: '#/components/schemas/uuid'
                  maxItems: 8
                  minItems: 1
                  description: sample id list
                face_id:
                  $ref: '#/components/schemas/face_id'
              required: [face_id, samples]
        required: true

      responses:
        201:
          description: success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReextractedAttribute'
        400:
          description: bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'extract_basic_attributes'
                sample_not_found:
                  value:
                    error_code: 11031
                    desc: Bad/incomplete input data
                    detail: Sample 483037a5-8d67-427d-a498-f8f62bb06fb1 not found
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'samples.0',  message: 'value is not a valid uuid'"
        403:
          description: descriptor version is not supported
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 34001
                desc: Forbidden
                detail: Descriptor version 53 is not supported
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/handlers:
    post:
      tags:
      - handlers
      summary: create handler
      description: |
        Create a new handler. The handler determinates a list of rules for
        processing of input images. You can set parameters for detecting faces and/or human bodies and
        extracting attributes. You can set rules for matching attributes and
        creating faces from them.
      operationId: createHandler
      parameters:
      - $ref: '#/components/parameters/luna_request_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'
          content:
            application/json:
              schema:
                type: object
                properties:
                  handler_id:
                    $ref: '#/components/schemas/uuid'
                  url:
                    type: string
                    format: uri
                required:
                - handler_id
                - url
              example:
                handler_id: b5d6fd45-fcca-453d-ac05-3e594054b813
                url: /1/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'
          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
                list_not_found:
                  value:
                    error_code: 22003
                    desc: Object not found
                    detail: List with id 'b5d6fd45-fcca-453d-ac05-3e594054b813' not found
                bad_json:
                  value:
                    error_code: 12027
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'policies.match_policy',  message: 'ensure this value has at most 30 items'"
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
      - handlers
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/is_dynamic'
      - $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 handlers with description similar to this parameter.

      summary: get handlers
      description: Get handlers by filters
      operationId: getHandlers
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HandlerInResponse'
        400:
          description: bad request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'page'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/handlers/count:
    get:
      tags:
      - handlers
      summary: get handler count
      description: Get handler count
      operationId:  getHandlerCount
      parameters:
      - $ref: '#/components/parameters/account_id'
      - in: query
        name: description
        schema:
          type: string
        description: find all handlers with description similar to this parameter.
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/is_dynamic'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
          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'
          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'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/handlers/{handler_id}:
    parameters:
    - in: path
      name: handler_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: handler id

    get:
      tags:
      - handlers
      summary: get handler
      description: Get handler by id
      operationId: getHandler
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'

            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HandlerInResponse'
        404:
          $ref: '#/components/responses/handler_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
    put:
      tags:
      - handlers
      summary: Replace handler
      description: |
        Replace the handler. You can not update a part of handler.
      operationId: putHandler
      parameters:
      - $ref: '#/components/parameters/luna_request_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'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                list_not_found:
                  value:
                    error_code: 22003
                    desc: Object not found
                    detail: List with id 'b5d6fd45-fcca-453d-ac05-3e594054b813' not found
                bad_json:
                  value:
                    error_code: 12027
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'policies.match_policy',  message: 'ensure this value has at most 30 items'"
        404:
          $ref: '#/components/responses/handler_not_found'
        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
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        200:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'

          description: OK
        404:
          description: handler not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
      - handlers
      summary: remove handler
      description: Remove handler by id
      operationId: removeHandler
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'

          description: The resource was deleted successfully.
        404:
          $ref: '#/components/responses/handler_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/handlers/{handler_id}/events:
    parameters:
    - in: path
      name: handler_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: handler id
    post:
      tags: [events]
      summary: generate events
      description: |
        Generate events from images and/or raw descriptor data.
        If luna-events support is disabled on server, events will not be saved.
        Do not forget to send policies for a dynamic handler along with emitting events.
      operationId: generateEvents
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id_required'
      - $ref: '#/components/parameters/luna_event_time'
      - $ref: '#/components/parameters/city'
      - $ref: '#/components/parameters/area'
      - $ref: '#/components/parameters/district'
      - $ref: '#/components/parameters/street'
      - $ref: '#/components/parameters/house_number'
      - $ref: '#/components/parameters/longitude'
      - $ref: '#/components/parameters/latitude'
      - $ref: '#/components/parameters/track_id'
      - $ref: '#/components/parameters/use_exif_info'
      - 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
          - application/x-sdk-descriptor
          - application/x-sdk-descriptor-base64
          - application/x-vl-xpk
          - application/x-vl-xpk-base64
      - in: query
        name: external_id
        schema:
          $ref: '#/components/schemas/external_id'
        description: external id for created faces
      - in: query
        name: user_data
        schema:
          description: user data for objects that will be generated
          allOf:
            - $ref: '#/components/schemas/user_data'

        description: User data for created faces
      - $ref: '#/components/parameters/image_type'

      - $ref: '#/components/parameters/aggregate_attributes'
      - $ref: '#/components/parameters/source'
      - in: query
        name: no_cache
        schema:
          type: boolean
          default: false
        description: Flag to disable handler caching.

      - $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
          application/x-sdk-descriptor:
            schema:
              $ref: '#/components/schemas/sdk_descriptor'
          application/x-vl-xpk:
            schema:
              $ref: '#/components/schemas/xpk_file'
          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: binary
          application/x-sdk-descriptor-base64:
            schema:
              allOf:
              - type: string
                format: byte
              - $ref: '#/components/schemas/sdk_descriptor'
          application/x-vl-xpk-base64:
            schema:
              allOf:
              - type: string
                format: byte
              - $ref: '#/components/schemas/xpk_file'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/multipart_raw_data_schema_with_policies'
            encoding:
              filename:
                contentType: |
                  image/jpeg, image/png, image/bmp, image/x-portable-pixmap, image/tiff,
                  application/x-sdk-descriptor, application/x-vl-xpk,
                  image/x-jpeg-base64, image/x-png-base64, image/x-bmp-base64, image/x-tiff-base64,
                  image/x-portable-pixmap-base64, application/x-sdk-descriptor-base64, application/x-vl-xpk-base64
          application/json:
            schema:
              $ref: '#/components/schemas/emit_event_json_request_body'

        required: true
      responses:
        201:
          description: Created
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Cache-Handler-Version:
              schema:
                type: string
                format: date-time
              description: If handler from cache is used, this field contains version of the handler.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/emit_event_reply'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'estimate_eyes_attributes'
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                bad_conten_type_download_image:
                  value:
                    error_code: 11028
                    desc: Bad/incomplete input data
                    detail: 'Bad content type of image ''https://www.google.ru'''
                bad_content_type_multepart:
                  value:
                    error_code: 11029
                    desc: Bad/incomplete input data
                    detail: Bad content type of image in multipart body
                failed_load_image:
                  value:
                    error_code: 11027
                    desc: External request failed
                    detail: 'Failed  to download image by url ''https://www.gooogle.ru'''
                bad_multipart_input:
                  value:
                    error_code: 11027
                    desc: Bad/incomplete input data
                    detail: 'Not available to send new policies to non-dynamic handler'
                bad_input_data:
                  value:
                    error_code: 11027
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'policies.match_policy',  message: 'ensure this value has at most 30 items'"
                missing_image:
                  value:
                    error_code: 11049
                    desc: Bad/incomplete input data
                    detail: |
                      Required field 'image' not found in request
                unsupported_descriptor_version:
                  value:
                    error_code: 34001
                    desc: Forbidden
                    detail: Descriptor version 42 is not supported
                bad_sdk_descriptor:
                  value:
                    error_code: 12038
                    desc: Bad/incomplete input data
                    detail: SDK descriptor is not valid
                bad_xpk:
                  value:
                    error_code: 12035
                    desc: Bad/incomplete input data
                    detail: Failed to parse xpk file
                aggregation_not_supported:
                  value:
                    error_code: 34003
                    desc: Bad/incomplete input data
                    detail: Aggregation is not supported for raw descriptors

        403:
          description: Access to this resource on the server is 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:
                events_is_disabled:
                  value:
                    error_code: 11040
                    desc: Forbidden
                    detail: Luna Events service is disabled
                one_rect_available:
                  value:
                    error_code: 11045
                    desc: Forbidden
                    detail: Only one detection rect for each image available at the moment
        404:
          $ref: '#/components/responses/handler_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/handlers/{handler_id}/events/raw:
    parameters:
    - in: path
      name: handler_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: dynamic handler id
    post:
      tags: [events]
      summary: save event
      description: |
        save event which was generated by the user. The event structure is similar to an event from handler response. Input events
         will send to the Sender also and to plugins. Therefore these events are the same events except that the events were 
        generated an `external handler`. Handler ID must belong to a dynamic handler.
      operationId: saveEvent
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/raw_event'
        required: true
      responses:
        201:
          description: Created
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Location:
              schema:
                type: string
                format: url
                example: http://127.0.0.1:5020/2/events/b5d6fd45-fcca-453d-ac05-3e594054b813
              description: location of new events
              required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/saved_event'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                bad_input_data:
                  value:
                    error_code: 11027
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'source',  message: 'str type expected'"
        403:
          description: Access to this resource on the server is 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:
                not_dynamic_handler_error:
                  value:
                    error_code: 34007
                    desc: Forbidden
                    detail: Allowed to use only dynamic handler
                events_is_disabled:
                  value:
                    error_code: 11040
                    desc: Forbidden
                    detail: Luna Events service is disabled
        404:
          $ref: '#/components/responses/handler_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/sdk:
    post:
      tags: [sdk]
      summary: sdk resource
      description: |
        detect faces, human bodies and estimate attributes on input images. Resource estimates only available attributes
        for corresponding images. For example, if user sends warped face image and wants to calculate a body descriptor,
        landmarks5 and basic attributes - only basic attributes will be estimated.

        Order of input images is corresponding to order elements in output json. If an image is broken resource will
        returns error for it image, other images will be correct processing.

        > **WARNING**: this resource is unstable. A resource API can be changes in any release.
      operationId: sdk
      parameters:
      - $ref: '#/components/parameters/application_json_or_msgpack_accept'
      - $ref: '#/components/parameters/luna_request_id'
      - in: header
        name: Content-Type

        schema:
          type: string
          enum:
          - application/json
          - multipart/form-data
          - 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
      - $ref: '#/components/parameters/image_type'
      - $ref: '#/components/parameters/multiface_policy'
      - $ref: '#/components/parameters/detect_face'
      - $ref: '#/components/parameters/detect_body'
      - $ref: '#/components/parameters/estimate_head_pose'
      - $ref: '#/components/parameters/estimate_emotions'
      - $ref: '#/components/parameters/estimate_landmarks68'
      - $ref: '#/components/parameters/estimate_landmarks5'
      - $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/estimate_mask'
      - $ref: '#/components/parameters/estimate_glasses'
      - $ref: '#/components/parameters/estimate_liveness'
      - $ref: '#/components/parameters/estimate_face_descriptor'
      - $ref: '#/components/parameters/estimate_basic_attributes'
      - $ref: '#/components/parameters/estimate_body_descriptor'
      - $ref: '#/components/parameters/estimate_body_warp'
      - $ref: '#/components/parameters/estimate_face_warp'
      - $ref: '#/components/parameters/aggregate_attributes'
      - $ref: '#/components/parameters/pitch_threshold'
      - $ref: '#/components/parameters/roll_threshold'
      - $ref: '#/components/parameters/yaw_threshold'
      - $ref: '#/components/parameters/score_threshold'
      - $ref: '#/components/parameters/mask_states'
      - $ref: '#/components/parameters/use_exif_info'

      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: 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
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/multipart_sdk_image_schema'
            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/sdk_json_request_body'

        required: true
      responses:
        200:
          description: Estimated
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json_or_msgpack_content'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/sdk_response_json'
              examples:
                all:
                 value:
                   images_estimations:
                     - filename: raw image
                       estimations:
                         - face:
                             detection:
                               rect:
                                 x: 71
                                 'y': 45
                                 width: 134
                                 height: 178
                               landmarks5:
                                 - - 25
                                   - 25
                                 - - 83
                                   - 83
                                 - - 47
                                   - 47
                                 - - 33
                                   - 33
                                 - - 82
                                   - 82
                               landmarks68:
                                 - - 1
                                   - 1
                                 - - 1
                                   - 1
                                 - - 4
                                   - 4
                                 - - 8
                                   - 8
                                 - - 14
                                   - 14
                                 - - 23
                                   - 23
                                 - - 33
                                   - 33
                                 - - 43
                                   - 43
                                 - - 60
                                   - 60
                                 - - 78
                                   - 78
                                 - - 96
                                   - 96
                                 - - 112
                                   - 112
                                 - - 124
                                   - 124
                                 - - 132
                                   - 132
                                 - - 135
                                   - 135
                                 - - 137
                                   - 137
                                 - - 138
                                   - 138
                                 - - 1
                                   - 1
                                 - - 8
                                   - 8
                                 - - 17
                                   - 17
                                 - - 26
                                   - 26
                                 - - 35
                                   - 35
                                 - - 59
                                   - 59
                                 - - 73
                                   - 73
                                 - - 86
                                   - 86
                                 - - 100
                                   - 100
                                 - - 113
                                   - 113
                                 - - 47
                                   - 47
                                 - - 45
                                   - 45
                                 - - 44
                                   - 44
                                 - - 43
                                   - 43
                                 - - 37
                                   - 37
                                 - - 42
                                   - 42
                                 - - 47
                                   - 47
                                 - - 54
                                   - 54
                                 - - 61
                                   - 61
                                 - - 14
                                   - 14
                                 - - 20
                                   - 20
                                 - - 29
                                   - 29
                                 - - 36
                                   - 36
                                 - - 28
                                   - 28
                                 - - 19
                                   - 19
                                 - - 69
                                   - 69
                                 - - 77
                                   - 77
                                 - - 86
                                   - 86
                                 - - 95
                                   - 95
                                 - - 88
                                   - 88
                                 - - 78
                                   - 78
                                 - - 33
                                   - 33
                                 - - 38
                                   - 38
                                 - - 45
                                   - 45
                                 - - 50
                                   - 50
                                 - - 57
                                   - 57
                                 - - 69
                                   - 69
                                 - - 82
                                   - 82
                                 - - 72
                                   - 72
                                 - - 60
                                   - 60
                                 - - 52
                                   - 52
                                 - - 45
                                   - 45
                                 - - 38
                                   - 38
                                 - - 36
                                   - 36
                                 - - 46
                                   - 46
                                 - - 51
                                   - 51
                                 - - 58
                                   - 58
                                 - - 77
                                   - 77
                                 - - 58
                                   - 58
                                 - - 51
                                   - 51
                                 - - 45
                                   - 45
                               attributes:
                                 eyes_attributes:
                                   left_eye:
                                     iris_landmarks:
                                       - - 92
                                         - 92
                                       - - 92
                                         - 92
                                       - - 93
                                         - 93
                                       - - 93
                                         - 93
                                       - - 94
                                         - 94
                                       - - 95
                                         - 95
                                       - - 96
                                         - 96
                                       - - 98
                                         - 98
                                       - - 99
                                         - 99
                                       - - 100
                                         - 100
                                       - - 101
                                         - 101
                                       - - 102
                                         - 102
                                       - - 103
                                         - 103
                                       - - 104
                                         - 104
                                       - - 105
                                         - 105
                                       - - 105
                                         - 105
                                       - - 105
                                         - 105
                                       - - 105
                                         - 105
                                       - - 105
                                         - 105
                                       - - 104
                                         - 104
                                       - - 103
                                         - 103
                                       - - 102
                                         - 102
                                       - - 101
                                         - 101
                                       - - 100
                                         - 100
                                       - - 98
                                         - 98
                                       - - 97
                                         - 97
                                       - - 96
                                         - 96
                                       - - 95
                                         - 95
                                       - - 94
                                         - 94
                                       - - 93
                                         - 93
                                       - - 93
                                         - 93
                                       - - 92
                                         - 92
                                     state: open
                                   right_eye:
                                     iris_landmarks:
                                       - - 152
                                         - 152
                                       - - 153
                                         - 153
                                       - - 153
                                         - 153
                                       - - 154
                                         - 154
                                       - - 154
                                         - 154
                                       - - 155
                                         - 155
                                       - - 157
                                         - 157
                                       - - 158
                                         - 158
                                       - - 159
                                         - 159
                                       - - 161
                                         - 161
                                       - - 162
                                         - 162
                                       - - 163
                                         - 163
                                       - - 164
                                         - 164
                                       - - 165
                                         - 165
                                       - - 166
                                         - 166
                                       - - 166
                                         - 166
                                       - - 166
                                         - 166
                                       - - 166
                                         - 166
                                       - - 166
                                         - 166
                                       - - 165
                                         - 165
                                       - - 164
                                         - 164
                                       - - 163
                                         - 163
                                       - - 162
                                         - 162
                                       - - 161
                                         - 161
                                       - - 159
                                         - 159
                                       - - 158
                                         - 158
                                       - - 157
                                         - 157
                                       - - 156
                                         - 156
                                       - - 154
                                         - 154
                                       - - 154
                                         - 154
                                       - - 153
                                         - 153
                                       - - 153
                                         - 153
                                     state: open
                                 head_pose:
                                   pitch: 12.7464532852
                                   roll: -2.9892115593
                                   yaw: 17.7173442841
                                 gaze:
                                   yaw: -5.9912848473
                                   pitch: -10.2646684647
                                 emotions:
                                   predominant_emotion: neutral
                                   estimations:
                                     anger: 8.682e-7
                                     disgust: 1.0670000000000001e-7
                                     fear: 4.386e-7
                                     happiness: 0.45658952
                                     sadness: 4.951e-7
                                     surprise: 0.0000029291
                                     neutral: 0.543405652
                                 mask:
                                  estimations:
                                    medical_mask: 0.7108324766
                                    missing: 0.0700698048
                                    occluded: 0.2190976739
                                  predominant_mask: "medical_mask"
                                 glasses:
                                  glasses: "no_glasses"
                                 mouth_attributes:
                                   score: 1.0
                                   opened: 0.3884400725
                                   occluded: 1.4000000000000001e-9
                                   smile: 0.6115599275
                                 basic_attributes:
                                   ethnicities:
                                     predominant_ethnicity: caucasian
                                     estimations:
                                       asian: 0.0000025556
                                       indian: 6.417e-7
                                       caucasian: 0.9999949932000001
                                       african_american: 0.0000017718000000000001
                                   age: 24
                                   gender: 0
                                 descriptor:
                                   sdk_descriptor: ZHAAADgAAAB0k4SAf...IB6gHyAgH19fQ==
                                   score: 0.7854047418000001
                               quality:
                                 blurriness: 0.9769582748000001
                                 dark: 0.9542820454000001
                                 illumination: 0.8248310089
                                 specularity: 0.8472354412
                                 light: 0.8179533482
                               warp: /9j/4AAQSkZJRgABAQAAAQABA..C4gb+KneZD/erEHWn0/asOTzP/9k=
                         - body:
                             detection:
                               rect:
                                 x: 32
                                 'y': 4
                                 width: 224
                                 height: 255
                               warp: /9j/4AAQSkZJRgABAQAAAQABAA...CX6kdapTi1qS00f/Z
                               attributes:
                                 descriptor:
                                   sdk_descriptor: ZHAAAGUAAAC....AfX9
                                   score: 1

                with_error:
                  value:
                    images_estimations:
                      - error:
                          error_code: 100033
                          desc: Unsupported image type
                          detail: Unsupported type
                        filename: bad_image.jpg
                      - filename: Claudia_Schiffer_warp.jpg
                        estimations:
                          - face:
                              detection:
                                rect:
                                  x: 71
                                  'y': 45
                                  width: 134
                                  height: 178
                with_aggregation:
                  value:
                    images_estimations:
                      - filename: image1.jpg
                        estimations:
                          - body:
                              detection:
                                rect:
                                  x: 118
                                  'y': -17
                                  width: 410
                                  height: 627
                      - filename: image2.jpg
                        estimations:
                          - body:
                              detection:
                                rect:
                                  x: 7
                                  'y': -60
                                  width: 1682
                                  height: 2523
                    aggregate_estimations:
                      body:
                        attributes:
                          descriptor:
                            sdk_descriptor: ZHAAAGUAAACBeX1w==
                            score: 0
            application/msgpack:
              schema:
                $ref: '#/components/schemas/sdk_response_msgpack'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'estimate_eyes_attributes'
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                bad_content_type_download_image:
                  value:
                    error_code: 11028
                    desc: Bad/incomplete input data
                    detail: 'Bad content type of image ''https://www.google.ru'''
                bad_content_type_multepart:
                  value:
                    error_code: 11029
                    desc: Bad/incomplete input data
                    detail: Bad content type of image in multipart body
                failed_load_image:
                  value:
                    error_code: 11027
                    desc: External request failed
                    detail: 'Failed  to download image by url ''https://www.gooogle.ru'''
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/verifiers:
    post:
      tags:
      - verifiers
      summary: create verifier
      description: |
        Create a new verifier. The verifier determinates a list of rules for
        processssing & verification of input images. You can set parameters for detecting faces and
        extracting attributes.
      operationId: createVerifier
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/new_verifier'
        required: true

      responses:
        201:
          description: Created
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                type: object
                properties:
                  verifier_id:
                    $ref: '#/components/schemas/uuid'
                  url:
                    type: string
                    format: uri
                required:
                - verifier_id
                - url
              example:
                verifier_id: b5d6fd45-fcca-453d-ac05-3e594054b813
                url: /1/verifiers/b5d6fd45-fcca-453d-ac05-3e594054b813
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                bad_json:
                  value:
                    error_code: 12027
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'policies.match_policy.0.label',  message: 'ensure this value has at most 36 characters'"
        500:
          $ref: '#/components/responses/internal_server_error'


    get:
      tags:
        - verifiers
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/verifier_description'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'

      summary: get verifiers
      description: Get verifiers by filters
      operationId: getVerifiers
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/verifier_response'
        400:
          description: bad request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'page'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/verifiers/count:
    get:
      tags:
      - verifiers
      summary: count verifiers
      description: Count verifiers that satisfy the filters
      operationId:  countVerifiers
      parameters:
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/verifier_description'
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                type: object
                properties:
                  verifiers_count:
                    $ref: '#/components/schemas/count'
                required:
                - verifiers_count
        400:
          description: bad request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/verifiers/{verifier_id}:
    parameters:
    - in: path
      name: verifier_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: verifier id

    get:
      tags:
      - verifiers
      summary: get verifier
      description: Get verifier by id.
      operationId: getVerifier
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/verifier_response'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
        404:
          $ref: '#/components/responses/verifier_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'

    put:
      tags:
      - verifiers
      summary: replace verifier
      description: |
        Replace the verifier. You can not update a part of verifier.
      operationId: putVerifier
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/new_verifier'
        required: true
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  version:
                    description: verifier current version (increases on update)
                    type: integer
                    minimum: 1
                    example: 111
                required:
                  - version
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                bad_json:
                  value:
                    error_code: 12027
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Message: ''{''policies'': {''verification_threshold'': [''Not a valid float.'']}}'''
        404:
          $ref: '#/components/responses/verifier_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'

    head:
      tags:
      - verifiers
      summary: check verifier
      description:  Check the verifier existense.
      operationId: checkVerifier
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        200:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          description: OK
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        404:
          description: verifier not found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
      - verifiers
      summary: remove verifier
      description: Remove verifier by id.
      operationId: removeVerifier
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          description: Deleted.
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
        404:
          $ref: '#/components/responses/verifier_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/verifiers/{verifier_id}/raw:
    parameters:
    - in: path
      name: verifier_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: verifier id

    post:
      tags:
      - verifiers
      summary: raw verification
      description: |
        Raw API allows to do similarity and verification status calculations for input descriptors.
      operationId: rawVerification
      parameters:
      - $ref: '#/components/parameters/json_or_msgpack_content'
      - $ref: '#/components/parameters/luna_request_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/raw_verification_request_json'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/raw_verification_request_msgpack'
        required: true
      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/raw_verification_response'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'policies.match_policy.0.label',  message: 'ensure this value has at most 36 characters'"
                bad_base64_for_one_descriptor:
                  value:
                    error_code: 18001
                    desc: Bad/incomplete input data
                    detail: Failed convert data from base64 to bytes
                wrong_descriptors_length:
                  value:
                    error_code: 12034
                    desc: Bad/incomplete input data
                    detail: Descriptor has incorrect length 200
                bad_xpk_file:
                  value:
                    error_code: 12035
                    desc: Bad/incomplete input data
                    detail: Failed to parse xpk file
                bad_sdk_descripot:
                  value:
                    error_code: 12038
                    desc: Bad/incomplete input data
                    detail: SDK descriptor is not valid
                xpk_does_not_contain_descriptor:
                  value:
                    error_code: 12037
                    desc: Bad/incomplete input data
                    detail: XPK file does not contain descriptor
                unknown_descriptor_version:
                  value:
                    error_code: 12037
                    desc: Bad/incomplete input data
                    detail: Descriptor version 37 are not registered in the system
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
        404:
          $ref: '#/components/responses/verifier_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/verifiers/{verifier_id}/verifications:
    parameters:
    - in: path
      name: verifier_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: verifier id

    post:
      tags:
      - verifiers
      summary: perform verification
      description: Verify given images and/or descriptors against specified objects set.
      operationId: postVerifier
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id_required'
      - $ref: '#/components/parameters/face_ids'
      - $ref: '#/components/parameters/event_ids'
      # LUNA-4522
      #- $ref: '#/components/parameters/attribute_ids'
      - $ref: '#/components/parameters/external_ids'
      - $ref: '#/components/parameters/use_exif_info'
      - 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
          - application/x-sdk-descriptor
          - application/x-sdk-descriptor-base64
          - application/x-vl-xpk
          - application/x-vl-xpk-base64
      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
          application/x-sdk-descriptor:
            schema:
              $ref: '#/components/schemas/sdk_descriptor'
          application/x-vl-xpk:
            schema:
              $ref: '#/components/schemas/xpk_file'
          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: binary
          application/x-sdk-descriptor-base64:
            schema:
              allOf:
              - type: string
                format: byte
              - $ref: '#/components/schemas/sdk_descriptor'
          application/x-vl-xpk-base64:
            schema:
              allOf:
              - type: string
                format: byte
              - $ref: '#/components/schemas/xpk_file'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/multipart_verifier_payload'
            encoding:
              filename:
                contentType: |
                  image/jpeg, image/png, image/bmp, image/x-portable-pixmap, image/tiff,
                  application/x-sdk-descriptor, application/x-vl-xpk,
                  image/x-jpeg-base64, image/x-png-base64, image/x-bmp-base64, image/x-tiff-base64,
                  image/x-portable-pixmap-base64, application/x-sdk-descriptor-base64, application/x-vl-xpk-base64
          application/json:
            schema:
              $ref: '#/components/schemas/verify_json_request_body'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/verifier_id_verification_response'
        400:
          description: Bad request
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
        403:
          description: Access to this resource on the server is 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:
                events_is_disabled:
                  value:
                    error_code: 11040
                    desc: Forbidden
                    detail: Luna Events service is disabled
        404:
          $ref: '#/components/responses/verifier_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/docs/spec:
    get:
      tags:
        - documents
      summary: get openapi documentation
      description: |
        Get service OpenApi documentation. If *Accept* request header is of type `application/x-yaml`,
        returns documentation in `yaml` format or returns `html` documentation, if *Accept-Type* is `text/html`
      operationId: getSpec

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/accept_docs_handler'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/docs_content_type'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/x-yaml:
              schema:
                type: string
                description: yaml format documentation
            text/html:
              schema:
                type: string
                description: html format documentation
        415:
          description: Unsupported Media Type
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                unsupported_media_type:
                  value:
                    error_code: 12024
                    detail: 'Bad/incomplete input data'
                    desc: "Unsupported media type"
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/docs/dev:
    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'
