openapi: 3.0.0
info:
  version: 'v.4.18.2'
  title: 'Luna-Faces API'
  description: |
     'VisionLabs Luna-Faces'

     Service is intended for creation and management following entities:

        1. Temporary attributes. A temporary attribute is represented by the following fields:
          * basic attributes: age, gender, ethnicity and sample id list. Service supposes that basic attributes are as
             aggregated as a descriptor - from all samples.
           * list of descriptors with difference versions. Service supposes that each descriptor was aggregated from all
             samples
           * account id - the attribute owner
           * ttl - time to store the attribute in the service
        2. Face. A Face is an user logical entity. A Face contains the following fields:
           * user data - some string which user associates with the face
           * create time - time of the face creation
           * event id - event id associated with the face creation.
           * external id - user defined external id (non unique)
           * face attributes - basic attributes, list of descriptors difference version and corresponding samples ids.
           * account id - the face owner
        3. Lists. The Luna-Faces list is user defined list of faces. Each list is determined by the following data:
           * user data - some string which user associates with the list
           * create time - time of the list creation
           * last update time - time of last attachment or detachment of a face from the list
           * faces - list of faces attached to the list

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

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

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

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

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

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

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

    config_accept_content_type:
      schema:
        type: string
        enum:
          - application/json
          - text/plain
      required: false
      description: The content type of the response body.
  parameters:
    sort:
      in: query
      name: sort
      schema:
        type: string
        enum:
          - create_time
          - external_id
          - user_data
          - face_id
          - none
      description: |
        The field to be used for response sorting. The default value is `face_id` if `face_id` filters are specified, else `create_time`.
        `none` option will disable all the sorting, including the basic one.
    order:
      in: query
      name: order
      schema:
        type: string
        enum:
          - asc
          - desc
        default: desc
      description: Sort order. If "desc" is set, the newest records will be shown first. If "asc" is set, the oldest records will be shown first.

    page:
      in: query
      name: page
      schema:
        type: integer
        minimum: 1
        default: 1
      description: a page number.

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

    application_json_or_msgpack_content:
      in: header
      name: Content-Type
      schema:
        type: string
        enum:
          - application/json
          - application/msgpack
      description: The request content type header.

    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

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

    header_account_id:
      in: header
      name: Luna-Account-Id
      schema:
        $ref: '#/components/schemas/account_id'
      description: luna account id
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb'
      required: true

    required_account_id:
      in: query
      name: account_id
      schema:
        $ref: '#/components/schemas/account_id'
      description: luna account id which is owner of the resource
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb'
      required: true

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

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

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

    list_id_uri:
      in: path
      name: list_id
      schema:
        $ref: '#/components/schemas/list_id'
      required: true
      description: list id (list_id received in the "create list" response)

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

    list_id__gte:
      in: query
      name: list_id__gte
      schema:
        type: string
        format: uuid
      description: lower list id including boundary.

    list_id__lt:
      in: query
      name: list_id__lt
      schema:
        type: string
        format: uuid
      description: upper list id excluding boundary.

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

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

    force:
      in: query
      name: force
      schema:
        type: integer
        default: 0
        enum: [0, 1]
      description: |
        replace an attribute if there exist attribute with same *attribute_id*. If parameter is equal to 0 and
        attribute with same *attribute_id* is exists the request will be failed.

    temporary_attributes_targets:
      in: query
      name: targets
      schema:
        type: string
        format: comma-separated items
        default: basic_attributes
      description: |
        list of comma-separated temporary attributes targets. Available targets: `face_descriptor`, `basic_attributes`,
        `basic_attributes_samples`, `face_descriptor_samples`, `account_id`, `create_time`, `attribute_id`

      example: basic_attributes,basic_attributes_samples,account_id

    descriptor_version:
      in: query
      name: descriptor_version
      schema:
        $ref: '#/components/schemas/descriptor_version'
      description: |
        descriptor version of the face descriptor attribute in response. By default used the platform defualt descriptor
        version.

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

    user_data__eq:
      in: query
      name: user_data__eq
      schema:
        type: string
      description: |
        find all objects with same `user_data`.
      example: "user_data_text"

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

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

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

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

    with_faces:
      in: query
      name: with_faces
      schema:
        allOf:
        - $ref: '#/components/schemas/int01'
        - default: 0
      description: whether to delete list with all its' faces

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

    face_id__gte:
      in: query
      name: face_id__gte
      schema:
        type: string
        format: uuid
      description: lower face id including boundary.

    face_id__gte_sorting:
      in: query
      name: face_id__gte
      schema:
        type: string
        format: uuid
      description: lower face id including boundary. Faces in response will be sorted by their ids. If neither *face_id__lt* or *face_id__gte* is specified, the faces will be sorted by creation time.

    face_id__lt:
      in: query
      name: face_id__lt
      schema:
        type: string
        format: uuid
      description: upper face id excluding boundary.

    face_id__lt_sorting:
      in: query
      name: face_id__lt
      schema:
        type: string
        format: uuid
      description: upper face id excluding boundary. Faces in response will be sorted by their ids. If neither *face_id__lt* or *face_id__gte* is specified, the faces will be sorted by creation time.

    external_ids:
      in: query
      name: external_ids
      schema:
        type: string
        format: list of strings
      description: list of comma-separated external ids.

    event_id:
      in: query
      name: event_id
      schema:
        type: string
        format: uuid
      description: the event ID associated with the face creation.

    get_face_target:
      in: query
      name: targets
      schema:
        type: string
        default: "face_id,account_id,event_id,external_id,user_data,create_time,avatar,lists"
      description: |
        Comma-separated list of face target fields. Available targets: `face_id`, `account_id`, `event_id`,
        `external_id`, `user_data`, `create_time`, `avatar`, `lists`
      example: "face_id,user_data"

    ignore:
      in: query
      name: ignore
      schema:
        allOf:
          - $ref: '#/components/schemas/int01'
          - default: 0
      description: whether to ignore some face does not exist

    face_attributes_targets:
      in: query
      name: targets
      schema:
        type: string
        format: comma-separated items
        default: create_time,basic_attributes,basic_attributes_samples,face_descriptor,face_descriptor_samples
      description: |
        list of comma-separated temporary attributes targets. Available targets:
        `create_time`, `basic_attributes`, `basic_attributes_samples`, `face_descriptor`, `face_descriptor_samples`

    face_delete_targets:
      in: query
      name: targets
      schema:
        type: string
        format: comma-separated items
        default: face_id,basic_attributes_samples,face_descriptor_samples
      description: |
        list of comma-separated faces deletion targets. Available targets:
        `face_id`, `basic_attributes_samples`, `face_descriptor_samples`

    limit:
      in: query
      name: limit
      schema:
        $ref: '#/components/schemas/limit'
      description: the maximum count of results in the reply

    link_key__lt:
      in: query
      name: link_key__lt
      schema:
        $ref: '#/components/schemas/link_key'
      description: the upper excluding link_key boundary

    link_key__gte:
      in: query
      name: link_key__gte
      schema:
        $ref: '#/components/schemas/link_key'
      description: the lower including link_key boundary

    unlink_key__lt:
      in: query
      name: unlink_key__lt
      schema:
        $ref: '#/components/schemas/unlink_key'
      description: the upper excluding unlink_key boundary

    unlink_key__gte:
      in: query
      name: unlink_key__gte
      schema:
        $ref: '#/components/schemas/unlink_key'
      description: the lower including unlink_key boundary

    parity:
      in: query
      name: parity
      schema:
        type: integer
        enum: [0, 1]
      description: |
          keys' parity: 0 for even keys in batch and 1 for odd keys, parity filter is not used if not set

    use_parity:
      in: query
      name: use_parity
      schema:
        type: integer
        enum: [0, 1]
      description: link/unlink keys' parity - if 0 get max link/unlink keys, if 1 get max even and odd link/unlink keys separetely

    check_existence:
      in: query
      name: check_existence
      schema:
        type: integer
        enum: [0, 1]
      description: whether to check requested objects' existense

    receive_external_id:
      in: query
      name: receive_external_id
      schema:
        type: integer
        enum: [0, 1]
      description: whether to return external ids in the response

    missing_version:
      in: query
      name: missing_version
      schema:
        type: integer
      required: true
      description: a face descriptor of this version must be missing

    missing_limit:
      in: query
      name: limit
      schema:
        $ref: '#/components/schemas/missing_limit'
      description: the maximum count of faces in the reply

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

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

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

    required_deletion_time__lt:
      in: query
      name: deletion_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper bound for list deletion time.
      example: "2018-08-11T09:11:41.674Z"
      required: true

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

    include_luna_services:
      in: query
      name: include_luna_services
      schema:
        type: integer
        enum: [0, 1]
        default: 0
      description: Whether to perform healthchecks for dependent luna services.

    descriptor_format:
      in: query
      name: descriptor_format
      schema:
        type: integer
        enum: [raw, sdk]
        default: raw
      description: output descriptor format.

  schemas:
    error:
      type: object
      properties:
        error_code:
          type: integer
          description: error code.
        desc:
          type: string
          description: short error description.
        detail:
          type: string
          description: error details.
        link:
          type: string
          description: link to the documentation website with the error description.
      required: [error_code, detail, desc, link]
      example:
        error_code: 1
        detail: internal server error
        desc: internal server error
        link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-1"

    int_version:
      type: integer
      minimum: 0

    int01:
      type: integer
      enum:
      - 0
      - 1

    count:
      type: integer
      minimum: 0
      example: 146

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

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

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

    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"

    age:
      type: integer
      minimum: 0
      maximum: 100
      description: estimated age
      example: 35

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

    ethnicity:
      type: integer
      enum: [1, 2, 3, 4]
      description: |
        estimated ethnicity (predominant)

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

    sample_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - example: 6d037c33-31ec-4d73-b3b3-ec80b09446c2
      description: sample id

    attributes_samples:
      type: array
      items:
        $ref: '#/components/schemas/sample_id'
      minItems: 0
      maxItems: 1000
      uniqueItems: True
      description: |
        list of *uniqie* sample ids which are resources for estimation attributes.

        > **WARNING**: if user does not set any attributes samples faces with such attributes will be skipped in
        a process of updating attributes with using new estimation algorithm.
      default: []
      example: [ee4c42b6-23ae-410e-a2aa-a4220e64ba4b, e909cfbe-29d3-44ed-a949-6cb700b89eba]

    extended_attributes_samples:
      type: array
      items:
        $ref: '#/components/schemas/sample_id'
      description: |
        list of sample ids which are resources for estimation attributes.
      default: [ ]
      example: [ ee4c42b6-23ae-410e-a2aa-a4220e64ba4b, e909cfbe-29d3-44ed-a949-6cb700b89eba ]

    external_id:
      description: user-defined external id for face.
      type: string
      maxLength: 36
      default: ''
      example: "3.1415926"

    user_data:
      description: user data.
      type: string
      maxLength: 128
      example: "100-00-12"
      default: ''

    avatar:
      type: string
      maxLength: 256
      format: uri-reference
      example: "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Yfke-sturm-1326186044.jpg/800px-Yfke-sturm-1326186044.jpg"
      default: ""
      description: avatar for face, references to a sample or a user-defined reference.

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

    face_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - example: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
      description: face id

    attribute_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - example: 7fdf9225-3c06-4c21-b774-8bea99bcce20
      description: temporary attribute id

    event_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - example: f9687459-986b-406d-9c1f-0d6289be5256
      description: the event ID associated with the face creation

    list_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - example: 429b0e78-4616-426a-b57f-02baa72d638d
      description: luna list id.

    account_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - example: 0468ca85-f6ca-4841-b30c-5ccc26b6f397
      description: id of the luna account.

    basic_attributes:
      type: object
      description: |
        basic attributes. Each basic attribute was aggregated from the samples. Samples is needed for re-extract
        attributes of new algorithm version and visualisation.

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

    sdk_descriptor_base64:
      type: string
      format: base64
      description: luna sdk descriptor encoded in base64

    xpk_file:
      type: string
      format: binary
      description:  xpk file with descriptors and basic attributes
      deprecated: true

    descriptor_version:
      type: integer
      description: the descriptor version
      enum: [46, 52, 54, 56, 57, 58, 59, 60, 62, 64, 65, 67]
      example: 56

    raw_descriptor:
      type: string
      format: byte
      description: raw descriptor encoded in base64
      example: 2xQ2gprbMUePw1s9gw9fvA==

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

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

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

    descriptor_base64:
      oneOf:
        - $ref: '#/components/schemas/descriptor_data'
        - $ref: '#/components/schemas/sdk_descriptor_base64'

    output_attribute_base:
      type: object
      properties:
        basic_attributes:
          allOf:
          - $ref: '#/components/schemas/basic_attributes'
          - description: '`null` if descriptor of the corresponding version was not extracted'
          - nullable: true
        face_descriptor_samples:
          $ref: '#/components/schemas/attributes_samples'
        basic_attributes_samples:
          $ref: '#/components/schemas/attributes_samples'
        account_id:
          $ref: '#/components/schemas/account_id'
        attribute_id:
          $ref: '#/components/schemas/attribute_id'
        create_time:
          allOf:
          - $ref: '#/components/schemas/time'
          - description: the attribute create time

    output_attribute:
      allOf:
        - $ref: '#/components/schemas/output_attribute_base'
        - properties:
            face_descriptor:
              allOf:
              - $ref: '#/components/schemas/sdk_descriptor_base64'
              - description: '`null` if descriptor of the corresponding version was not extracted'
              - nullable: true

    output_attribute_binary_descriptor:
      allOf:
        - $ref: '#/components/schemas/output_attribute_base'
        - properties:
            face_descriptor:
              allOf:
              - $ref: '#/components/schemas/sdk_descriptor_binary'
              - description: '`null` if descriptor of the corresponding version was not extracted'
              - nullable: true

    face_descriptors:
      description: |
        list of descriptors with different versions. Each descriptor was aggregated descriptor from the samples
      type: array
      maxItems: 1000
      items:
        $ref: '#/components/schemas/descriptor_base64'
      minItems: 1
      example:
        - descriptor: 2xQ2gprbMUePw1s9gw9fvA==
          version: 46
        - descriptor: 1xWqdsdwew32fsdsdw1s9gw9fvA==
          version: 56

    attribute_with_descriptors_no_account:
      type: object
      properties:
        face_descriptors:
          $ref: '#/components/schemas/face_descriptors'
        face_descriptor_samples:
          $ref: '#/components/schemas/attributes_samples'
      required: [face_descriptors]

    attribute_with_descriptors:
      $ref: '#/components/schemas/attribute_with_descriptors_no_account'

    attribute_with_basic_attributes_no_account:
      type: object
      properties:
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
        basic_attributes_samples:
          $ref: '#/components/schemas/attributes_samples'
      required: [basic_attributes]

    attribute_with_basic_attributes:
      allOf:
        - $ref: '#/components/schemas/attribute_with_basic_attributes_no_account'

    attribute_with_descriptors_and_basic_attributes_no_account:
      allOf:
        - $ref: '#/components/schemas/attribute_with_basic_attributes_no_account'
        - $ref: '#/components/schemas/attribute_with_descriptors_no_account'

    attribute_with_descriptors_and_basic_attributes_no_account_binary:
      allOf:
        - $ref: '#/components/schemas/attribute_with_basic_attributes_no_account'
        - $ref: '#/components/schemas/face_descriptors_binary'

    attribute_with_descriptors_and_basic_attributes:
      allOf:
        - $ref: '#/components/schemas/attribute_with_descriptors'
        - $ref: '#/components/schemas/attribute_with_basic_attributes'

    attribute_no_account:
      oneOf:
        - $ref: '#/components/schemas/attribute_with_descriptors_and_basic_attributes_no_account'
        - $ref: '#/components/schemas/attribute_with_basic_attributes_no_account'
        - $ref: '#/components/schemas/attribute_with_descriptors_no_account'

    attribute_no_account_binary:
      oneOf:
        - $ref: '#/components/schemas/attribute_with_descriptors_and_basic_attributes_no_account_binary'
        - $ref: '#/components/schemas/attribute_with_basic_attributes_no_account'
        - $ref: '#/components/schemas/face_descriptors_binary'

    created_attribute:
      oneOf:
        - $ref: '#/components/schemas/attribute_with_descriptors_and_basic_attributes'
        - $ref: '#/components/schemas/attribute_with_descriptors'
        - $ref: '#/components/schemas/attribute_with_basic_attributes'

    descriptor_binary:
      type: object
      description: descriptor and descriptor version
      properties:
        descriptor:
          type: string
          format: binary
          description: raw descriptor
        descriptor_version:
          $ref: '#/components/schemas/descriptor_version'
      deprecated: true
      required: [descriptor, descriptor_version]

    descriptor_binary_version:
      type: object
      description: descriptor and descriptor version
      properties:
        descriptor:
          type: string
          format: binary
          description: raw descriptor
        version:
          $ref: '#/components/schemas/descriptor_version'
      deprecated: true
      required: [descriptor, version]

    sdk_descriptor_binary:
      type: string
      format: binary
      description: luna sdk descriptor. The descriptor version, a signature and descriptor.

    payload_basic_attributes:
      allOf:
        - $ref: '#/components/schemas/attribute_with_basic_attributes_no_account'
      required: [basic_attributes]

    face_descriptors_binary:
      type: object
      properties:
        face_descriptors:
          description: |
            list of descriptors with different versions. Each descriptor was aggregated descriptor from the samples
          type: array
          maxItems: 1000
          items:
            oneOf:
              - $ref: '#/components/schemas/descriptor_binary_version'
              - $ref: '#/components/schemas/sdk_descriptor_binary'
          minItems: 1
        face_descriptor_samples:
          $ref: '#/components/schemas/attributes_samples'
      required: [face_descriptors]

    payload_binary_descriptors_and_basic_attributes:
      allOf:
        - $ref: '#/components/schemas/payload_basic_attributes'
        - $ref: '#/components/schemas/face_descriptors_binary'

    created_attribute_msgpack:
      oneOf:
        - $ref: '#/components/schemas/payload_binary_descriptors_and_basic_attributes'
        - $ref: '#/components/schemas/face_descriptors_binary'
        - $ref: '#/components/schemas/payload_basic_attributes'
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
      required: [account_id]

    created_attribute_xpk:
      type: object
      properties:
        xpk_file:
          allOf:
          - description: |
              xpk file with descriptors. This part must have valid Content-Type
              header `application/x-vl-xpk`

              > **WARNING**: basic attributes will be inored
          - $ref: '#/components/schemas/xpk_file'

        meta:
          type: object
          properties:
            face_descriptor_samples:
              $ref: '#/components/schemas/attributes_samples'
            basic_attributes_samples:
              $ref: '#/components/schemas/attributes_samples'
          description: This part must have valid Content-Type header `application/json`
      required: [xpk_file, meta]

    attributes_count:
      type: object
      properties:
        attributes_count:
          allOf:
          - $ref: '#/components/schemas/count'
          description: temporary attribute count
      description: temporary attribute count
      required: [attributes_count]

    attribute_samples:
      type: object
      properties:
        samples:
          type: array
          maxItems: 1000
          items:
            $ref: '#/components/schemas/sample_id'
          minItems: 0
          uniqueItems: True
      description: list of all uniqie samples
      required: [samples]
      example:
        samples:
          - 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
          - 2f1cbb34-12e5-486c-8f7f-57273053c32d

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

    list:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
        list_id:
          $ref: '#/components/schemas/list_id'
        user_data:
          allOf:
            - $ref: '#/components/schemas/user_data'
            - description: user-defined list description
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: the list create time
        last_update_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: date and time with timezone of last action with list (attach or detach face from list)
      required: [list_id, user_data, account_id, create_time, last_update_time]

    updated_list:
      type: object
      properties:
        user_data:
          allOf:
          - $ref: '#/components/schemas/user_data'
          - description: new description
      required: [user_data]

    deleted_lists:
      type: object
      properties:
        list_ids:
          type: array
          maxItems: 1000
          items:
            $ref: '#/components/schemas/list_id'
          minItems: 1
          description: ids of list for removal
      required: [list_ids]

    lists_count:
      type: object
      properties:
        lists_count:
          allOf:
          - $ref: '#/components/schemas/count'
          description: list count
      description: list count
      required: [lists_count]

    attribute_set_by_attribute_id:
      type: object
      properties:
        attribute_id:
          $ref: '#/components/schemas/attribute_id'
      required: [attribute_id]

    face_attribute:
      oneOf:
        - $ref: '#/components/schemas/attribute_no_account'
        - $ref: '#/components/schemas/attribute_set_by_attribute_id'
      description: |
         face attribute. The attribute can be specified by temporary attribute ID or explicitly by attribute data.

    face_attribute_binary:
      # face_attribute with binary descriptor
      oneOf:
        - $ref: '#/components/schemas/attribute_no_account_binary'
        - $ref: '#/components/schemas/attribute_set_by_attribute_id'
      description: |
         face attribute. The attribute can be specified by temporary attribute ID or explicitly by attribute data.

    face_to_be_updated:
      type: object
      properties:
        event_id:
          allOf:
            - nullable: True
            - $ref: '#/components/schemas/event_id'
        external_id:
          $ref: '#/components/schemas/external_id'
        user_data:
          $ref: '#/components/schemas/user_data'
        avatar:
          $ref: '#/components/schemas/avatar'

    base_face_to_be_created:
      type: object
      properties:
        event_id:
          $ref: '#/components/schemas/event_id'
        external_id:
          $ref: '#/components/schemas/external_id'
        user_data:
          $ref: '#/components/schemas/user_data'
        avatar:
          $ref: '#/components/schemas/avatar'
        lists:
          type: array
          maxItems: 1000
          items:
            $ref: '#/components/schemas/list_id'
          minItems: 1
          description: luna lists for linking face with them.
      required: [account_id]

    face_to_be_created:
      allOf:
        - $ref: '#/components/schemas/base_face_to_be_created'
        - properties:
            attribute:
              $ref: '#/components/schemas/face_attribute'

    face_to_be_created_binary:
      allOf:
        - $ref: '#/components/schemas/base_face_to_be_created'
        - properties:
            attribute:
              $ref: '#/components/schemas/face_attribute_binary'

    create_face_response:
      type: object
      properties:
        face_id:
          allOf:
            - $ref: '#/components/schemas/face_id'
          description: |
            ID of the created face.
            The ID can be used as the `face_id` parameter in [GET](#operation/getFace) `/faces/{face_id}`.
        url:
          type: string
          format: uri-reference
          description: relative URL of the created face.
      required: [url, face_id]
      example:
        face_id: b5d6fd45-fcca-453d-ac05-3e594054b813
        url: /2/faces/b5d6fd45-fcca-453d-ac05-3e594054b813

    face:
      type: object
      properties:
        face_id:
          $ref: '#/components/schemas/face_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        event_id:
          allOf:
            - $ref: '#/components/schemas/event_id'
          nullable: True
        external_id:
          $ref: '#/components/schemas/external_id'
        user_data:
          $ref: '#/components/schemas/user_data'
        create_time:
          allOf:
            - $ref: "#/components/schemas/time"
            - format: date-time
          description: time of the face creation.
        avatar:
          $ref: '#/components/schemas/avatar'
        lists:
          type: array
          items:
            $ref: '#/components/schemas/list_id'
          description: list of luna lists, which contain the face.

    faces_to_be_deleted:
      type: object
      properties:
        face_ids:
          type: array
          maxItems: 1000
          items:
            $ref: '#/components/schemas/face_id'
          minItems: 1
          description: ids of faces for removal
      required: [face_ids]

    faces_count:
      type: object
      properties:
        faces_count:
          allOf:
          - $ref: '#/components/schemas/count'
          description: face count
      description: face count
      required: [faces_count]

    output_face_attribute:
      type: object
      properties:
        attributes:
          type: object
          properties:
            create_time:
              allOf:
                - $ref: '#/components/schemas/time'
              description: face attribute create time
            basic_attributes:
              allOf:
                - $ref: '#/components/schemas/basic_attributes'
              nullable: true
            face_descriptor:
              oneOf:
                - $ref: '#/components/schemas/descriptor_base64_with_version'
                - $ref: '#/components/schemas/sdk_descriptor_base64'
              nullable: true
            basic_attributes_samples:
              $ref: '#/components/schemas/attributes_samples'
            face_descriptor_samples:
              $ref: '#/components/schemas/attributes_samples'

    output_face_attribute_msgpack:
      # same as output_face_attribute, but descriptor is binary
      type: object
      properties:
        attributes:
          type: object
          properties:
            create_time:
              allOf:
                - $ref: '#/components/schemas/time'
                - nullable: true
              description: face attribute create time
            basic_attributes:
              allOf:
                - $ref: '#/components/schemas/basic_attributes'
              nullable: true
            face_descriptor:
              oneOf:
                - $ref: '#/components/schemas/descriptor_binary'
                - $ref: '#/components/schemas/sdk_descriptor_binary'
              nullable: true
            basic_attributes_samples:
              $ref: '#/components/schemas/attributes_samples'
            face_descriptor_samples:
              $ref: '#/components/schemas/attributes_samples'

    output_face_delete_attribute:
      type: array
      items:
        maxItems: 10000
        $ref: '#/components/schemas/face_delete_attribute'

    face_delete_attribute:
      type: object
      properties:
        face_id:
          $ref: '#/components/schemas/face_id'
        basic_attributes_samples:
          $ref: '#/components/schemas/extended_attributes_samples'
        face_descriptor_samples:
          $ref: '#/components/schemas/extended_attributes_samples'

    limit:
      type: integer
      minimum: 1
      description: the maximum count of results in the reply

    missing_limit:
      type: integer
      minimum: 1
      maximum: 1000
      description: the maximum count of faces in the reply

    link_key:
      type: integer
      minimum: 0
      description: a list-face link unique number

    unlink_key:
      type: integer
      minimum: 0
      description: a list-face link deletion unique number

    list_attributes_reply:
      type: array
      items:
        type: object
        properties:
          attribute_id:
            $ref: '#/components/schemas/attribute_id'
          link_key:
            $ref: '#/components/schemas/link_key'
        required: [attribute_id, link_key]

    list_deletions_reply:
      type: array
      items:
        type: object
        properties:
          attributes_id:
            $ref: '#/components/schemas/attribute_id'
          link_key:
            $ref: '#/components/schemas/link_key'
          unlink_key:
            $ref: '#/components/schemas/unlink_key'
        required: [attributes_id, link_key, unlink_key]

    post_linkkeys:
      type: object
      properties:
        list_ids:
          type: array
          maxItems: 1000
          items:
            $ref: '#/components/schemas/list_id'
          description: target list ids to get max link/unlink keys info
      required: [list_ids]

    post_linkkeys_reply_no_parity:
      description: |
        Parameter 'use_parity' was not used or was set to `0`

        *Resource returns only info about only existent lists in response.*
      type: object
      properties:
        lists:
          type: array
          items:
            type: object
            properties:
              list_id:
                $ref: '#/components/schemas/list_id'
              link_key:
                allOf:
                  - $ref: '#/components/schemas/link_key'
                  - nullable: true
              unlink_key:
                allOf:
                  - $ref: '#/components/schemas/unlink_key'
                  - nullable: true
            required: [list_id, link_key, unlink_key]
      required: [lists]


    post_linkkeys_reply_parity:
      description: |
        Parameter was set to `1`.

        *Resource returns only info about only existent lists in response.*
      type: object
      properties:
        lists:
          type: array
          items:
            type: object
            properties:
              list_id:
                $ref: '#/components/schemas/list_id'
              link_key_odd:
                allOf:
                  - $ref: '#/components/schemas/link_key'
                  - nullable: true
              link_key_even:
                allOf:
                  - $ref: '#/components/schemas/link_key'
                  - nullable: true
              unlink_key_odd:
                allOf:
                  - $ref: '#/components/schemas/unlink_key'
                  - nullable: true
              unlink_key_even:
                allOf:
                  - $ref: '#/components/schemas/unlink_key'
                  - nullable: true
            required: [list_id, link_key_odd, link_key_even, unlink_key_odd, unlink_key_even]
      required: [lists]

    post_linkkeys_reply:
      anyOf:
        - $ref: '#/components/schemas/post_linkkeys_reply_no_parity'
        - $ref: '#/components/schemas/post_linkkeys_reply_parity'

    post_attributes_batches_faces:
      type: object
      description: Face id list to obtain descriptors from. One of "face_ids" or "list" should be specified.
      properties:
        face_ids:
          type: array
          maxItems: 1000
          items:
            $ref: '#/components/schemas/face_id'
          description: face ids of faces whose descriptors should be obtained
      required: [face_ids]

    post_attributes_batches_list:
      type: object
      description: List to obtain descriptors from. One of "face_ids" or "list" should be specified.
      properties:
        list:
          type: object
          properties:
            list_id:
              $ref: '#/components/schemas/list_id'
            link_key__gte:
              $ref: '#/components/schemas/link_key'
            limit:
              allOf:
              - $ref: '#/components/schemas/limit'
              - minimum: 1
                maximum: 10000
          required: [list_id, link_key__gte, limit]
      required: [list]

    post_attributes_batches:
      oneOf:
        - $ref: '#/components/schemas/post_attributes_batches_faces'
        - $ref: '#/components/schemas/post_attributes_batches_list'

    face_attribute_batch:
      type: object
      description: Descriptors for face IDs specified.
      properties:
        descriptor_version:
          $ref: '#/components/schemas/descriptor_version'
        descriptors:
          type: array
          items:
            type: str
            format: binary
        uuids:
          type: array
          items:
            $ref: '#/components/schemas/face_id'
        uuids_not_found:
          type: array
          items:
            $ref: '#/components/schemas/face_id'
        uuids_not_extracted:
          type: array
          items:
            $ref: '#/components/schemas/face_id'
        external_ids:
          type: array
          items:
            $ref: '#/components/schemas/external_id'
      required: [descriptor_version, descriptors, uuids, uuids_not_found, uuids_not_extracted]

    list_attribute_batch:
      type: object
      description: Descriptors for list ID specified.
      properties:
        descriptor_version:
          $ref: '#/components/schemas/descriptor_version'
        descriptors:
          type: array
          items:
            type: str
            format: binary
        uuids:
          type: array
          items:
            $ref: '#/components/schemas/face_id'
        link_keys:
          type: array
          items:
            $ref: '#/components/schemas/link_key'
        external_ids:
          type: array
          items:
            $ref: '#/components/schemas/external_id'
      required: [ descriptor_version, descriptors, uuids, link_keys ]

    attribute_batch:
      oneOf:
        - $ref: '#/components/schemas/face_attribute_batch'
        - $ref: '#/components/schemas/list_attribute_batch'

    linker:
      type: object
      properties:
        action:
          description: "action to perform: attach faces to list or detach"
          type: string
          enum: [attach, detach]
        face_ids:
          description: face ids
          type: array
          maxItems: 1000
          items:
            $ref: '#/components/schemas/uuid'
        list_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            -  description: list id
      required:
        - action
        - face_ids
        - list_id

    missing_faces:
      type: object
      properties:
        faces:
          type: array
          items:
            type: object
            properties:
              face_id:
                $ref: '#/components/schemas/face_id'
              samples:
                $ref: '#/components/schemas/attributes_samples'
            required: [face_id, samples]
      required: [faces]

    removed_face_descriptors:
      type: object
      properties:
        face_ids:
          type: array
          items:
            $ref: '#/components/schemas/face_id'
          description: |
            list face ids whose descriptors was removed
      required: [face_ids]

    face_descriptor_count_info:
      type: object
      properties:
        descriptor_count_info:
          type: array
          items:
            type: object
            properties:
              descriptor_version:
                $ref: '#/components/schemas/descriptor_version'
              descriptor_count:
                allOf:
                  - $ref: '#/components/schemas/count'
                  - description: number of descriptors
            required: [descriptor_version, descriptor_count]
          description: |
            list of descriptor count information
      required: [descriptor_count_info]

    face_basic_attributes_count:
      description: basic attributes count in db
      type: object
      properties:
        basic_attributes_count:
          allOf:
            - $ref: '#/components/schemas/count'
            - description: basic attributes count
      required: [basic_attributes_count]

    1000_face_ids:
      type: object
      properties:
        face_ids:
          type: array
          maxItems: 1000
          items:
            $ref: '#/components/schemas/face_id'
          minItems: 1
          description: ids of faces for search
      required: [face_ids]

    attribute_id_and_url:
      type: object
      properties:
        attribute_id:
          $ref: '#/components/schemas/attribute_id'
        url:
          type: string
          format: uri-reference
      required: [url, attribute_id]
      example:
        attribute_id: b5d6fd45-fcca-453d-ac05-3e594054b813
        url: /3/attributes/b5d6fd45-fcca-453d-ac05-3e594054b813

    lists_post_response:
      type: object
      properties:
        list_id:
          $ref: '#/components/schemas/list_id'
        url:
          type: string
          format: uri-reference
      required: [url, list_id]

    list_deletion:
      type: object
      descriptrion: information about a removed list
      properties:
        deletion_id:
          type: integer
          description: ID of the list deletion
          example: 146
        list_id:
          $ref: '#/components/schemas/list_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: the list create time
        deletion_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: the list removal time
      required: [deletion_id, list_id, account_id, create_time, deletion_time]
      example:
        list_id: '4230d3d3-173a-47b6-a4e3-28e0620bf323'
        deletion_id: 146
        account_id: '95660f66-cf18-4518-be21-09214756a6f9'
        create_time: '2021-02-15T15:01:52.348098+03:00'
        deletion_time: '2021-03-15T15:01:53.169921+03:00'

    removed_lists:
      type: object
      description: deletion list log
      properties:
        removed_lists:
          type: array
          items:
            $ref: '#/components/schemas/list_deletion'
      required: [removed_lists]

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

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

    plugin_status:
      type: object
      properties:
        name:
          type: string
          description: Plugin name
        running:
          allOf:
            - $ref: '#/components/schemas/int01'
            - description: Whether plugin is running or not.
      required: [name, running]

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

    license_problem:
      description: license problem.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            error_code: 11055
            desc: Forbidden
            detail: "License problem: 'License expired'"
            link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055"

    forbidden_resource_error:
      description: Forbidden.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            resource_is_disabled:
              value:
                error_code: 12049
                desc: Forbidden
                detail: Resource is disabled.
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12049"
paths:
  /version:
    get:
      tags:
      - version

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

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/version'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/version'
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces:
    parameters:
      - $ref: '#/components/parameters/Accept'
    post:
      tags:
      - faces
      summary: create face
      description: |
        Create a new face.

        The face can be attached to one or several lists.

      operationId: createFace
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/application_json_or_msgpack_content'
      - $ref: '#/components/parameters/header_account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/face_to_be_created'
            examples:
              create_face_with_attribute_by_attribute_data:
                value:
                  account_id: 0468ca85-f6ca-4841-b30c-5ccc26b6f397
                  event_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                  external_id: 2xQ2gprbMUePw1s9gw9fvA==
                  user_data: some_string
                  avatar: 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Abbey_Lee_2015.jpg/800px-Abbey_Lee_2015.jpg'
                  lists: ['234fc28c-a767-42fc-a0c2-e01ad00b5c59', 'c2a09aff-0116-41cf-a7c7-91631d40d0c2']
                  attribute:
                    basic_attributes:
                      age: 18
                      gender: 0
                      ethnicity: 4
                    basic_attributes_samples:
                      - 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
                      - 2f1cbb34-12e5-486c-8f7f-57273053c32d
                    face_descriptors:
                      - descriptor: 2xQ2gprbMUePw1s9gw9fvA==
                        version: 46
                      - descriptor: 1xWqdsdwew32fsdsdw1s9gw9fvA==
                        version: 56
                    face_descriptor_samples:
                      - ee4c42b6-23ae-410e-a2aa-a4220e64ba4b
                      - e909cfbe-29d3-44ed-a949-6cb700b89eba
                summary: create face with attribute specified by attribute data
              create_face_with_attribute_by_attribute_id:
                value:
                  account_id: 0468ca85-f6ca-4841-b30c-5ccc26b6f397
                  event_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                  external_id: 2xQ2gprbMUePw1s9gw9fvA==
                  user_data: some_string
                  avatar: 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Abbey_Lee_2015.jpg/800px-Abbey_Lee_2015.jpg'
                  lists: ['234fc28c-a767-42fc-a0c2-e01ad00b5c59', 'c2a09aff-0116-41cf-a7c7-91631d40d0c2']
                  attribute:
                    attribute_id: 'b668c4a5-2191-476e-a261-3b4f9ce2e25e'
                summary: create face with attribute specified by attribute id
          application/msgpack:
            schema:
              $ref: '#/components/schemas/face_to_be_created_binary'
        required: true
      responses:
        201:
          description: Create success.
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/create_face_response'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/create_face_response'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message: ''Additional properties are not allowed (''userdata'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                attribute_not_found:
                  value:
                    error_code: 22011
                    desc: Object not found
                    detail: Attribute with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22011"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
            application/msgpack:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input msgpack. Path: '''',  message: ''Additional properties are not allowed (''userdata'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047"
        403:
          $ref: '#/components/responses/license_problem'
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
      - faces
      summary: get faces
      description: Get faces according to filters.
      operationId: getFaces
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/page_size'
      - $ref: '#/components/parameters/create_time__lt'
      - $ref: '#/components/parameters/create_time__gte'
      - $ref: '#/components/parameters/event_id'
      - $ref: '#/components/parameters/face_ids'
      - $ref: '#/components/parameters/face_id__lt_sorting'
      - $ref: '#/components/parameters/face_id__gte_sorting'
      - $ref: '#/components/parameters/external_ids'
      - $ref: '#/components/parameters/user_data'
      - $ref: '#/components/parameters/list_id'
      - $ref: '#/components/parameters/get_face_target'
      - $ref: '#/components/parameters/sort'
      - $ref: '#/components/parameters/order'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  faces:
                    type: array
                    items:
                      $ref: '#/components/schemas/face'
                    minItems: 0
            application/msgpack:
              schema:
                type: object
                properties:
                  faces:
                    type: array
                    items:
                      $ref: '#/components/schemas/face'
                    minItems: 0
        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 'create_time__lt'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                bad_target:
                  value:
                    error_code: 22016
                    desc: Bad/incomplete input data
                    detail: '''not_a_target'' is not valid target to get faces. Valid target should be one of
                            [''face_id'', ''account_id'', ''event_id'', ''user_data'',
                            ''create_time'', ''external_id'', ''avatar'', ''lists''].'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22016"
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
        - faces
      summary: delete faces
      description: Delete several faces.
      operationId: deleteFaces
      parameters:
        - $ref: '#/components/parameters/application_json_or_msgpack_content'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/ignore'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/faces_to_be_deleted'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/faces_to_be_deleted'
      responses:
        204:
          description: Delete success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message: ''Additional properties are not
                                                         allowed (''faces'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
            application/msgpack:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input msgpack. Path: '''',  message: ''Additional properties are not
                                                         allowed (''faces'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047"
        404:
          description: Face 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: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces/extended:
    parameters:
      - $ref: '#/components/parameters/Accept'
    delete:
      tags:
        - faces
      summary: delete faces with filters
      description: Delete faces with filters. If targets is empty return status code 204, else return 200.
      operationId: deleteFacesExtended
      parameters:
        - $ref: '#/components/parameters/application_json_or_msgpack_content'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/face_delete_targets'
        - $ref: '#/components/parameters/create_time__lt'
        - $ref: '#/components/parameters/create_time__gte'
        - $ref: '#/components/parameters/user_data'
        - $ref: '#/components/parameters/list_id'
      responses:
        200:
          description: Delete success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/output_face_delete_attribute'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/output_face_delete_attribute'
        204:
          description: Delete success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message: ''Additional properties are not
                                                         allowed (''faces'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
            application/msgpack:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input msgpack. Path: '''',  message: ''Additional properties are not
                                                         allowed (''faces'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047"
        404:
          description: Face 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: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces/count:
    parameters:
      - $ref: '#/components/parameters/Accept'
    get:
      tags:
        - faces
      summary: get face count
      description: |
        get face count

      operationId: getFaceCount
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/create_time__lt'
        - $ref: '#/components/parameters/create_time__gte'
        - $ref: '#/components/parameters/event_id'
        - $ref: '#/components/parameters/face_ids'
        - $ref: '#/components/parameters/face_id__lt'
        - $ref: '#/components/parameters/face_id__gte'
        - $ref: '#/components/parameters/external_ids'
        - $ref: '#/components/parameters/user_data'
        - $ref: '#/components/parameters/list_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/faces_count'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/faces_count'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces/attributes/count:
    parameters:
      - $ref: '#/components/parameters/Accept'
    get:
      tags:
        - faces
      summary: get count of faces with attributes
      description: |
        count faces with attributes

      operationId: getFaceAttributeCount
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/faces_count'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/faces_count'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces/{face_id}:
    parameters:
    - in: path
      name: face_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: ID of the face (`face_id` received in the "create face" request).
    - $ref: '#/components/parameters/Accept'

    put:
      tags:
        - faces
      summary: put face
      description: |
        Put face.

        The face can be attached to one or several lists.

      operationId: putFace
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/application_json_or_msgpack_content'
        - $ref: '#/components/parameters/header_account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/face_to_be_created'
            examples:
              put_face_with_attribute_by_attribute_data:
                value:
                  account_id: 0468ca85-f6ca-4841-b30c-5ccc26b6f397
                  event_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                  external_id: 2xQ2gprbMUePw1s9gw9fvA==
                  user_data: some_string
                  avatar: 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Abbey_Lee_2015.jpg/800px-Abbey_Lee_2015.jpg'
                  lists: ['234fc28c-a767-42fc-a0c2-e01ad00b5c59', 'c2a09aff-0116-41cf-a7c7-91631d40d0c2']
                  attribute:
                    basic_attributes:
                      age: 18
                      gender: 0
                      ethnicity: 4
                    basic_attributes_samples:
                      - 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
                      - 2f1cbb34-12e5-486c-8f7f-57273053c32d
                    face_descriptors:
                      - descriptor: 2xQ2gprbMUePw1s9gw9fvA==
                        version: 46
                      - descriptor: 1xWqdsdwew32fsdsdw1s9gw9fvA==
                        version: 56
                    face_descriptor_samples:
                      - ee4c42b6-23ae-410e-a2aa-a4220e64ba4b
                      - e909cfbe-29d3-44ed-a949-6cb700b89eba
                summary: put face with attribute specified by attribute data
              put_face_with_attribute_by_attribute_id:
                value:
                  account_id: 0468ca85-f6ca-4841-b30c-5ccc26b6f397
                  event_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                  external_id: 2xQ2gprbMUePw1s9gw9fvA==
                  user_data: some_string
                  avatar: 'https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Abbey_Lee_2015.jpg/800px-Abbey_Lee_2015.jpg'
                  lists: ['234fc28c-a767-42fc-a0c2-e01ad00b5c59', 'c2a09aff-0116-41cf-a7c7-91631d40d0c2']
                  attribute:
                    attribute_id: 'b668c4a5-2191-476e-a261-3b4f9ce2e25e'
                summary: put face with attribute specified by attribute id
          application/msgpack:
            schema:
              $ref: '#/components/schemas/face_to_be_created_binary'
        required: true
      responses:
        200:
          description: Put success.
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/create_face_response'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/create_face_response'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: '',  message: 'data must contain ['account_id'] properties'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                attribute_not_found:
                  value:
                    error_code: 22011
                    desc: Object not found
                    detail: Attribute with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22011"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
            application/msgpack:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input msgpack. Path: '',  message: 'data must contain ['account_id'] properties'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047"
        403:
          $ref: '#/components/responses/license_problem'
        404:
          description: Face 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: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
      - faces
      summary: get face
      description: |
        Get face by ID.

        > **NOTE**: To get the face *attribute* data use method [GET](#operation/getFaceAttributes)
          on `/faces/{face_id}/attributes`.

      operationId: getFace
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/get_face_target'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/face'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/face'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017"
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                bad_target:
                  value:
                    error_code: 22016
                    desc: Bad/incomplete input data
                    detail: '''not_a_target'' is not valid target to get faces. Valid target should be one of
                            [''face_id'', ''account_id'', ''event_id'', ''user_data'',
                            ''create_time'', ''external_id'', ''avatar'', ''lists''].'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22016"
        404:
          description: Face 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: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'

    head:
      tags:
      - faces
      summary: check face existence
      description:  Check existence of the face by ID.
      operationId: checkFace
      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/json_or_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_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: Face 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: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'

    patch:
      tags:
      - faces
      summary: update face
      description: |
        Update face fields: *user_data*, *avatar*, *external_id*, *event_id*.

        > **NOTE**: To update the face *attribute* data use method [PATCH](#operation/patchFaceAttributes)
          on `/faces/{face_id}/attributes`.

      operationId: patchFace
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/application_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/face_to_be_updated'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/face_to_be_updated'
        required: true
      responses:
        204:
          description: Update success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017"
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message:
                            ''Additional properties are not allowed (''userData'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
            application/msgpack:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input msgpack. Path: '''',  message:
                            ''Additional properties are not allowed (''userData'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047"
        404:
          description: Face not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                error_code: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
      - faces
      summary: delete face
      description: Remove face by ID.
      operationId: deleteFace
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        204:
          description: Delete success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: Face 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: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces/{face_id}/attributes:
    parameters:
    - in: path
      name: face_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: ID of the face (`face_id` received in the "create face" request).
    - $ref: '#/components/parameters/Accept'

    put:
      tags:
        - face attributes
      summary: put face attribute
      description: |
        Put face attribute.

        The attribute can be specified by temporary attribute ID or explicitly by attribute data.

      operationId: putFaceAttributes
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/application_json_or_msgpack_content'
        - $ref: '#/components/parameters/account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/face_attribute'
            examples:
              put_face_attribute_by_attribute_data:
                value:
                  basic_attributes:
                    age: 18
                    gender: 0
                    ethnicity: 4
                  basic_attributes_samples:
                    - 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
                    - 2f1cbb34-12e5-486c-8f7f-57273053c32d
                  face_descriptors:
                    - descriptor: 2xQ2gprbMUePw1s9gw9fvA==
                      version: 46
                    - descriptor: 1xWqdsdwew32fsdsdw1s9gw9fvA==
                      version: 56
                  face_descriptor_samples:
                    - ee4c42b6-23ae-410e-a2aa-a4220e64ba4b
                    - e909cfbe-29d3-44ed-a949-6cb700b89eba
                summary: put face attribute specified by attribute data
              put_face_attribute_by_attribute_id:
                value:
                  attribute_id: 'b668c4a5-2191-476e-a261-3b4f9ce2e25e'
                summary: put face attribute specified by attribute id
          application/msgpack:
            schema:
              $ref: '#/components/schemas/face_attribute_binary'
        required: true
      responses:
        204:
          description: Put success.
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message:
                            ''Additional properties are not allowed (''userdata'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                attribute_not_found:
                  value:
                    error_code: 22011
                    desc: Object not found
                    detail: Attribute with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22011"
            application/msgpack:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input msgpack. Path: '''',  message:
                            ''Additional properties are not allowed (''userdata'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047"
        403:
          $ref: '#/components/responses/license_problem'
        404:
          description: Face 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: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
      - face attributes
      summary: get face attribute
      description: Get face attribute by ID.
      operationId: getFaceAttributes
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/descriptor_format'
        - $ref: '#/components/parameters/face_attributes_targets'
        - $ref: '#/components/parameters/descriptor_version'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/output_face_attribute'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/output_face_attribute_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_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017"
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                bad_target:
                  value:
                    error_code: 22016
                    desc: Bad/incomplete input data
                    detail: '''not_a_target'' is not valid target to get faces. Valid target should be one of
                            [''basic_attributes'', ''face_descriptor_samples'', ''face_descriptor'',
                            ''create_time'', ''basic_attributes_samples''].'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22016"
        404:
          description: Face 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: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'

    patch:
      tags:
      - face attributes
      summary: update face attribute
      description: |
        Update face attribute data: *basic_attributes*, *basic_attributes_samples*, *face_descriptor*,
        *face_descriptor_samples*.

      operationId: patchFaceAttributes
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/attribute_no_account'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/attribute_no_account_binary'
        required: true
      responses:
        204:
          description: Update success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017"
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: '',  message: 'basic_attributes must not contain {'unexpected'} properties'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                non_unique_basic_attributes_samples:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''basic_attributes_samples'',  message:
                            ''basic_attributes_samples must contain unique items'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                non_unique_face_descriptor_samples:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''face_descriptor_samples'',  message:
                            ''face_descriptor_samples must contain unique items'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                attribute_for_update_not_found:
                  value:
                    error_code: 22010
                    desc: Object not found
                    detail: Attribute with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' for update not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22010"
                sample_conflict:
                  value:
                    error_code: 22019
                    desc: Conflict input data
                    detail: Existing attribute (with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37') samples do not match specified
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22019"
            application/msgpack:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input msgpack. Path: '',  message: 'basic_attributes must not contain {'unexpected'} properties'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047"
        404:
          description: Face not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                  error_code: 22002
                  desc: Object not found
                  detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                  link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
      - face attributes
      summary: delete face attribute
      description: Remove face attribute by ID.
      operationId: deleteFaceAttributes
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        204:
          description: Delete success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: Face 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: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces/{face_id}/attributes/samples:
    parameters:
    - in: path
      name: face_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: ID of the face (`face_id` received in the "create face" request).
    - $ref: '#/components/parameters/Accept'

    get:
      tags:
      - face attributes
      summary: get face attribute samples
      description: Get face attribute samples by face ID.
      operationId: getFaceAttributeSamples
      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/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/attribute_samples'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/attribute_samples'
        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
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017"
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: Face 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: 22002
                desc: Object not found
                detail: Face with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/attributes:
    parameters:
      - $ref: '#/components/parameters/Accept'
    post:
      tags:
      - temporary attributes
      summary: create a temporary attribute
      description: |
        Creating new temporary attributes. The attribute has a ttl and after an expire the time attribute will be
        removed from the service.

      operationId: createAttribute
      parameters:
      - in: header
        name: Content-Type
        schema:
          type: string
          enum:
            - application/json
            - application/msgpack
            - multipart/form-data
        description: Format of a request body data.

      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/ttl'
      - $ref: '#/components/parameters/header_account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/created_attribute'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/created_attribute_msgpack'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/created_attribute_xpk'
            encoding:
              xpk:
                contentType: application/x-vl-xpk
              meta:
                contentType: application/json
        required: true
      responses:
        201:
          description: attribute is created.
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
                format: url
                example: /3/attributes/b5d6fd45-fcca-453d-ac05-3e594054b813
              description:  Location of new attribute.
              required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/attribute_id_and_url'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/attribute_id_and_url'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''face_descriptors[0]'',  message:
                    ''face_descriptors[0] must be valid exactly by one definition (0 matches found)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                broken_descriptor:
                  value:
                    error_code: 12034
                    desc: Bad/incomplete input data
                    detail: 'Descriptor has incorrect length ''23'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12034"
                broken_xpk:
                  value:
                    error_code: 12035
                    desc: Bad/incomplete input data
                    detail: 'Failed to parse xpk file'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12035"
                unknown_descriptor_version:
                  value:
                    error_code: 12036
                    desc: Bad/incomplete input data
                    detail: 'Descriptor version 37 is not registered in the system'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12036"
                xpk_without_descriptor:
                  value:
                    error_code: 12037
                    desc: Bad/incomplete input data
                    detail: 'XPK file does not contain descriptor'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12037"
                not_valid_sdk_descriptor:
                  value:
                    error_code: 12038
                    desc: Bad/incomplete input data
                    detail: 'SDK descriptor is not valid'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12038"
                unknown_multipart_name:
                  value:
                    error_code: 12039
                    desc: Bad/incomplete input data
                    detail: 'Unknown multipart name ''account'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12039"
                duplicate_multipart_name:
                  value:
                    error_code: 12040
                    desc: Bad/incomplete input data
                    detail: 'Duplicate multipart name ''meta'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12040"
                bad_multipart_content_type:
                  value:
                    error_code: 12041
                    desc: Bad/incomplete input data
                    detail: 'Multipart with name ''meta'' has bad Content-Type'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12041"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
        - temporary attributes
      summary: get temporary attributes
      description: |
        Get temporary attribute by IDs.
      operationId: getAttributes
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/required_attribute_ids'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/temporary_attributes_targets'
      - $ref: '#/components/parameters/descriptor_version'
      - $ref: '#/components/parameters/accept_content_type'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  attributes:
                    type: array
                    items:
                      $ref: '#/components/schemas/output_attribute'
                required: [attributes]
              examples:
                default:
                  value:
                    attributes:
                    - basic_attributes:
                        age: 33
                        gender: 1
                        ethnicity: 3
                full:
                  value:
                    attributes:
                    - account_id: 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
                      basic_attributes:
                        age: 33
                        gender: 1
                        ethnicity: 3
                      face_descriptor: 2xQ2gprbMUePw1s9gw9fvA==
                      face_descriptor_samples:
                      - 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
                      - 2f1cbb34-12e5-486c-8f7f-57273053c32d
                      basic_attributes_samples: [00000000-0000-4000-8000-000000000000]
                      attribute_id: 7fdf9225-3c06-4c21-b774-8bea99bcce20
                    - account_id: 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
                      basic_attributes:
                        age: 33
                        gender: 1
                        ethnicity: 3
                      face_descriptor: null
                      face_descriptor_samples:
                        - 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
                        - 2f1cbb34-12e5-486c-8f7f-57273053c32d
                      basic_attributes_samples: [00000000-0000-4000-8000-000000000000]
                      attribute_id: 7fdf9225-3c06-4c21-b774-8bea99bcce20
            application/msgpack:
              schema:
                type: object
                properties:
                  attributes:
                    type: array
                    items:
                      $ref: '#/components/schemas/output_attribute_binary_descriptor'
                required: [attributes]
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/descriptors/batches:
    post:
      tags:
      - descriptors_caching
      summary:  get face descriptor batches
      description: |
         Get face descriptors using face ids or list id with filters. Returns requested descriptors as SDKData object
      operationId: getFaceDescriptorsBatches
      parameters:
      - $ref: '#/components/parameters/check_existence'
      - $ref: '#/components/parameters/parity'
      - $ref: '#/components/parameters/receive_external_id'
      - $ref: '#/components/parameters/application_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post_attributes_batches'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/post_attributes_batches'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/msgpack'
          content:
            application/msgpack:
              schema:
                $ref: '#/components/schemas/attribute_batch'
        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 'parity'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                list_not_found:
                  value:
                    error_code: 22003
                    desc: Object not found
                    detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/attributes/count:
    parameters:
      - $ref: '#/components/parameters/Accept'
    get:
      tags:
        - temporary attributes
      summary: get temporary attributes count
      description: |
        get temporary attributes count

        > **WARNING**:  there is no ability to get attribute count by accounts

      operationId: getTemporaryAttributesCount
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: Ok
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/attributes_count'
              example:
                attributes_count: 146
            application/msgpack:
              schema:
                $ref: '#/components/schemas/attributes_count'
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/attributes/{attribute_id}:
    parameters:
    - in: path
      name: attribute_id
      schema:
        $ref: '#/components/schemas/attribute_id'
      required: true
      description: ID of the temporary attribute.

    put:
      tags:
      - temporary attributes
      summary: put temporary attribute
      description: |
        Put temporary attribute by ID.
      operationId: putAttribute
      parameters:
        - in: header
          name: Content-Type
          schema:
            type: string
            enum:
              - application/json
              - multipart/form-data
              - application/msgpack
          description: Format of a request body data.

        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/header_account_id'
        - $ref: '#/components/parameters/ttl'
        - $ref: '#/components/parameters/force'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/created_attribute'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/created_attribute_msgpack'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/created_attribute_xpk'
            encoding:
              xpk:
                contentType: application/x-vl-xpk
              meta:
                contentType: application/json
        required: true
      responses:
        204:
          description: Attribute is saved.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
                format: url
                example: /3/attributes/b5d6fd45-fcca-453d-ac05-3e594054b813
              description:  location of the attribute
              required: true
        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 'force'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message:
                    ''face_descriptors[0] must be valid exactly by one definition (0 matches found)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                broken_descriptor:
                  value:
                    error_code: 12034
                    desc: Bad/incomplete input data
                    detail: 'Descriptor has incorrect length ''23'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12034"
                broken_xpk:
                  value:
                    error_code: 12035
                    desc: Bad/incomplete input data
                    detail: 'Failed to parse xpk file'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12035"
                unknown_descriptor_version:
                  value:
                    error_code: 12036
                    desc: Bad/incomplete input data
                    detail: 'Descriptor version 37 is not registered in the system'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12036"
                xpk_without_descriptor:
                  value:
                    error_code: 12037
                    desc: Bad/incomplete input data
                    detail: 'XPK file does not contain descriptor'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12037"
                not_valid_sdk_descriptor:
                  value:
                    error_code: 12038
                    desc: Bad/incomplete input data
                    detail: 'SDK descriptor is not valid'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12038"
                unknown_multipart_name:
                  value:
                    error_code: 12039
                    desc: Bad/incomplete input data
                    detail: 'Unknown multipart name ''account'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12039"
                duplicate_multipart_name:
                  value:
                    error_code: 12040
                    desc: Bad/incomplete input data
                    detail: 'Duplicate multipart name ''meta'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12040"
                bad_multipart_content_type:
                  value:
                    error_code: 12041
                    desc: Bad/incomplete input data
                    detail: 'Multipart with name ''meta'' has bad Content-Type'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12041"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
        404:
          description: Attributes not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                  error_code: 22011
                  desc: Object not found
                  detail: Attributes with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                  link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22011"
        409:
          description: Integrity error.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 22021
                    desc: Integrity error
                    detail: Attribute with id 'a208e3ca-a689-432b-b4f9-96887c044551' already exist
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22021"
        500:
          $ref: '#/components/responses/internal_server_error'
    get:
      tags:
        - temporary attributes
      summary: get temporary attribute
      description: |
        Get temporary attribute by ID.
      operationId: getAttribute
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/descriptor_version'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/temporary_attributes_targets'
      - $ref: '#/components/parameters/accept_content_type'
      - $ref: '#/components/parameters/Accept'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/msgpack:
              schema:
                $ref: '#/components/schemas/output_attribute_binary_descriptor'
            application/json:
              schema:
                $ref: '#/components/schemas/output_attribute'
              examples:
                default:
                  value:
                      basic_attributes:
                        age: 33
                        gender: 1
                        ethnicity: 3
                full:
                  value:
                    account_id: 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
                    basic_attributes:
                      age: 33
                      gender: 1
                      ethnicity: 3
                    face_descriptor: 2xQ2gprbMUePw1s9gw9fvA==
                    face_descriptor_samples:
                    - 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
                    - 2f1cbb34-12e5-486c-8f7f-57273053c32d
                    basic_attributes_samples: [00000000-0000-4000-8000-000000000000]
                    attribute_id: 7fdf9225-3c06-4c21-b774-8bea99bcce20
                full_with_null:
                  value:
                    attribute_id: 7fdf9225-3c06-4c21-b774-8bea99bcce20
                    account_id: 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
                    basic_attributes:
                      age: 33
                      gender: 1
                      ethnicity: 3
                    face_descriptor: null
                    face_descriptor_samples:
                      - 0d1cc36e-d719-4f54-8abe-4e5e0cb1f43c
                      - 2f1cbb34-12e5-486c-8f7f-57273053c32d
                    basic_attributes_samples: [00000000-0000-4000-8000-000000000000]
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: Attributes not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                  error_code: 22011
                  desc: Object not found
                  detail: Attributes with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                  link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22011"
        500:
          $ref: '#/components/responses/internal_server_error'
    head:
      tags:
        - temporary attributes
      summary: check temporary attribute
      description: |
        Check temporary attribute existence.
      operationId: checkAttribute
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'

      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
        404:
          description: attributes not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        500:
          description: Internal server error.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
    delete:
      tags:
      - temporary attributes
      summary: delete attribute
      description: Delete the attribute by its ID.
      operationId: deleteAttribute
      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.
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: Attributes not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                  error_code: 22011
                  desc: Object not found
                  detail: Attributes with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                  link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22011"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/attributes/{attribute_id}/samples:
    parameters:
    - $ref: '#/components/parameters/Accept'
    - in: path
      name: attribute_id
      schema:
        $ref: '#/components/schemas/attribute_id'
      required: true
      description: id of the temporary attribute.

    get:
      tags:
        - temporary attributes
      summary: get temporary attribute samples
      description: |
        get all the temporary attribute samples by the attribute ID.
      operationId: getAttributeSamples
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'

      responses:
        200:
          description: Ok
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/attribute_samples'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/attribute_samples'

        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: attributes not found.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              example:
                  error_code: 22011
                  desc: Object not found
                  detail: Attributes with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                  link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22011"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/lists:
    parameters:
      - $ref: '#/components/parameters/Accept'
    post:
      tags:
      - lists
      summary: create a list
      description: |
        Creating new list.

      operationId: createList
      parameters:
      - $ref: '#/components/parameters/application_json_or_msgpack_content'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/header_account_id'
      - $ref: '#/components/parameters/list_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/created_list'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/created_list'
      responses:
        201:
          description: list is created.
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
                format: url
                example: /2/lists/b5d6fd45-fcca-453d-ac05-3e594054b813
              description:  location of new list
              required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/lists_post_response'
              example:
                list_id: b5d6fd45-fcca-453d-ac05-3e594054b813
                url: /2/lists/b5d6fd45-fcca-453d-ac05-3e594054b813
            application/msgpack:
              schema:
                $ref: '#/components/schemas/lists_post_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
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017"
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message: ''Additional properties are not
                             allowed (''userData'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
            application/msgpack:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input msgpack. Path: '''',  message: ''Additional properties are not
                             allowed (''userData'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047"
        409:
          description: unique constraint error
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 22026
                    desc: Unique constraint error
                    detail: List with id 'a208e3ca-a689-432b-b4f9-96887c044551' already exist
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22026"
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
        - lists
      summary: get lists
      description: get lists by filters.
      operationId: getLists
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/page_size'
      - $ref: '#/components/parameters/user_data'
      - $ref: '#/components/parameters/user_data__eq'
      - $ref: '#/components/parameters/create_time__lt'
      - $ref: '#/components/parameters/create_time__gte'
      - $ref: '#/components/parameters/last_update_time__lt'
      - $ref: '#/components/parameters/last_update_time__gte'
      - $ref: '#/components/parameters/list_ids'
      - $ref: '#/components/parameters/list_id__lt'
      - $ref: '#/components/parameters/list_id__gte'
      responses:
        200:
          description: Ok
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  lists:
                    type: array
                    items:
                      $ref: '#/components/schemas/list'
                required: [lists]
                example:
                  lists:
                  - list_id: 6fe44310-f82e-4487-bd01-4cbda03a5ac1
                    account_id: f7018bef-9c89-4a30-931e-2c00cf58c42a
                    create_time: 2018-08-11T09:11:41.674Z
                    last_update_time: 2018-09-05T09:11:41.674Z
                    user_data: bad guys
            application/msgpack:
              schema:
                type: object
                properties:
                  lists:
                    type: array
                    items:
                      $ref: '#/components/schemas/list'
                required: [lists]
                example:
                  lists:
                  - list_id: 6fe44310-f82e-4487-bd01-4cbda03a5ac1
                    account_id: f7018bef-9c89-4a30-931e-2c00cf58c42a
                    create_time: 2018-08-11T09:11:41.674Z
                    last_update_time: 2018-09-05T09:11:41.674Z
                    user_data: bad guys
        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 'user_data'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
    delete:
      tags:
        - lists
      summary: delete lists
      description: Delete several lists.

      operationId: deleteLists
      parameters:
        - $ref: '#/components/parameters/application_json_or_msgpack_content'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/with_faces'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/deleted_lists'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/deleted_lists'
      responses:
        202:
          description: success delete lists, removing faces in progress
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        204:
          description: success delete lists
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message: ''Additional properties are not
                                                         allowed (''faces'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
            application/msgpack:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input msgpack. Path: '''',  message: ''Additional properties are not
                                                         allowed (''faces'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/lists/deletions:
    get:
      tags:
        - administration
      summary: get lists deletions
      description: |
        Get a log of deleted lists. The method is intended for auditing and tracking  deleted lists.

      operationId: getListsDeletions
      parameters:
      - $ref: '#/components/parameters/deletion_time__lt'
      - $ref: '#/components/parameters/deletion_time__gte'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/page_size'
      responses:
        200:
          description: Ok
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/removed_lists'
        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 'deletion_time__lt'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
    patch:
      tags:
        - administration
      summary: clear lists deletions log
      description: |
        Clear lists deletions log. It is not recommended to remove all the records from the log. Save last-day records for correct 
        operation of third-party caching mechanisms (matcher).

      operationId: clearListsDeletions
      parameters:
      - $ref: '#/components/parameters/required_deletion_time__lt'
      responses:
        204:
          description: Ok
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'deletion_time__lt'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                without_time:
                    error_code: 12014
                    desc: Bad/incomplete input data
                    detail: Required parameters 'deletion_time__lt' not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12014"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/lists/count:
    parameters:
      - $ref: '#/components/parameters/Accept'
    get:
      tags:
        - lists
      summary: get lists count
      description: |
        get lists count

      operationId: getListsCount
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/user_data'
      - $ref: '#/components/parameters/user_data__eq'
      - $ref: '#/components/parameters/create_time__lt'
      - $ref: '#/components/parameters/create_time__gte'
      - $ref: '#/components/parameters/last_update_time__lt'
      - $ref: '#/components/parameters/last_update_time__gte'
      - $ref: '#/components/parameters/list_ids'
      - $ref: '#/components/parameters/list_id__lt'
      - $ref: '#/components/parameters/list_id__gte'
      responses:
        200:
          description: Ok
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/lists_count'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/lists_count'

        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/lists/{list_id}:
    parameters:
    - $ref: '#/components/parameters/Accept'
    - $ref: '#/components/parameters/list_id_uri'
    get:
      tags:
      - lists
      summary: get list
      description: Get list by id
      operationId: getList
      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/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/list'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/list'
        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_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: list 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: 22003
                desc: Object not found
                detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003"
        500:
          $ref: '#/components/responses/internal_server_error'
    head:
      tags:
      - lists
      summary: check list existence
      description:  Check existence of the list with `id=list_id`.
      operationId: checkList
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        200:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          description: OK
        404:
          description: list 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'
    patch:
      tags:
      - lists
      summary: update list
      description:  Update the *user_data* field of the list.
      operationId: patchList
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/application_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/updated_list'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/updated_list'
        required: true
      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          description: Updated
        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
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017"
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: '''',  message: ''Additional properties are not allowed (''userData'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
            application/msgpack:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input msgpack. Path: '''',  message: ''Additional properties are not allowed (''userData'' was unexpected)'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047"
        404:
          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:
                list_not_found:
                  value:
                    error_code: 22003
                    desc: Object not found
                    detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003"
        500:
          $ref: '#/components/responses/internal_server_error'
    delete:
      tags:
      - lists
      summary: remove list
      description: Remove list by id
      operationId: removeList
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/with_faces'
      responses:
        202:
          description: The resource was removed successfully, faces removal in progress.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          description: The resource was deleted successfully.
        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_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: list 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: 22003
                desc: Object not found
                detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/lists/{list_id}/attributes:
    parameters:
    - $ref: '#/components/parameters/Accept'
    - $ref: '#/components/parameters/list_id_uri'
    get:
      tags:
      - descriptors_caching
      summary: get list attributes
      description: Get list attributes' link keys
      operationId: getListAttributes
      parameters:
      - $ref: '#/components/parameters/link_key__lt'
      - $ref: '#/components/parameters/link_key__gte'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/parity'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/list_attributes_reply'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/list_attributes_reply'
        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 'parity'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: list 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: 22003
                desc: Object not found
                detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/lists/{list_id}/deletions:
    parameters:
    - $ref: '#/components/parameters/Accept'
    - $ref: '#/components/parameters/list_id_uri'
    get:
      tags:
      - descriptors_caching
      summary: get unlinked attributes
      description: Get ids and link and unlink keys for each unlinked attribute.
      operationId: getListDeletions
      parameters:
        - $ref: '#/components/parameters/unlink_key__lt'
        - $ref: '#/components/parameters/unlink_key__gte'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/parity'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/list_deletions_reply'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/list_deletions_reply'
        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 'parity'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: list 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: 22003
                desc: Object not found
                detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/lists/linkkeys:
    parameters:
      - $ref: '#/components/parameters/Accept'
    post:
      tags:
      - descriptors_caching
      summary: get lists' link and unlink keys
      description: Get lists with link and unlink keys grouped by list ids
      operationId: getListsLinkkeys
      parameters:
        - $ref: '#/components/parameters/use_parity'
        - $ref: '#/components/parameters/application_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/post_linkkeys'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/post_linkkeys'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/post_linkkeys_reply'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/post_linkkeys_reply'
        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 'use_parity'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          description: list 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: 22003
                desc: Object not found
                detail: List with id '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/linker:
    parameters:
      - $ref: '#/components/parameters/Accept'
    patch:
      tags:
        - linker
      summary: link (or unlink) faces to a list
      description: link (or unlink) faces to a list
      operationId: linker
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/application_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/linker'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/linker'
      responses:
        204:
          description: Operation succeeded
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/linker/unlink_history:
    parameters:
      - $ref: '#/components/parameters/Accept'
    patch:
      tags:
        - unlink_history
      summary: Clean unlink log
      description: |
        Clean history of unlink attributes from lists. This history is required for correct update cash in matchers.
      operationId: unlinkHistory
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - in: query
          name: time__lt
          schema:
            $ref: '#/components/schemas/time'
          description: |
            Upper bound of log time with timezone excluding boundary.
            This time should be less than now minus last matcher cache update period;
            otherwise one should drop matchers' caches after performing this request:
            otherwise some removed faces can be found in match candidates.
      responses:
        204:
          description: Operation succeeded
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'time__lt'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces/attributes/descriptors:
    parameters:
      - $ref: '#/components/parameters/Accept'
    post:
      tags:
      - administration
      summary:  get faces without descriptor
      description: |
         Get faces:
           1. without descriptors of the `missing_version`
           2. with descriptor of a default version
           3. with samples
      operationId: getMissingFaceDescriptors
      parameters:
      - $ref: '#/components/parameters/missing_version'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/face_id__lt'
      - $ref: '#/components/parameters/face_id__gte'
      - $ref: '#/components/parameters/missing_limit'
      - $ref: '#/components/parameters/application_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/1000_face_ids'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/1000_face_ids'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/missing_faces'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/missing_faces'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces/attributes/descriptors/count:
    parameters:
      - $ref: '#/components/parameters/Accept'
    post:
      tags:
      - administration
      summary:  get face count without descriptor
      description: |
         Get face without descriptrs input version count and with descriptor of a default version
      operationId: getMissingFaceDescriptorsCount
      parameters:
      - $ref: '#/components/parameters/missing_version'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/face_id__lt'
      - $ref: '#/components/parameters/face_id__gte'
      - $ref: '#/components/parameters/application_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/1000_face_ids'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/1000_face_ids'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/faces_count'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/faces_count'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
      - administration
      summary:  get descriptor count info
      description: |
         Get information of the count of descriptors of available versions
      operationId: getFaceDescriptorCountInfo
      parameters:
      - $ref: '#/components/parameters/account_id'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/face_descriptor_count_info'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/face_descriptor_count_info'
              example:
                descriptor_count_info:
                - descriptor_version: 52
                  descriptor_count: 3812
                - descriptor_version: 46
                  descriptor_count: 212
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces/attributes/basic_attributes:
    parameters:
      - $ref: '#/components/parameters/Accept'
    post:
      tags:
      - administration
      summary:  get faces without basic attributes
      description: |
         Get faces that do not have basic attributes. 
         
         The response will include face IDs and their samples. If a face has no samples, the array of samples will be empty.

      operationId: getMissingFaceBasicAttributes
      parameters:
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/face_id__lt'
      - $ref: '#/components/parameters/face_id__gte'
      - $ref: '#/components/parameters/missing_limit'
      - $ref: '#/components/parameters/application_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/1000_face_ids'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/1000_face_ids'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/missing_faces'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/missing_faces'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces/attributes/basic_attributes/count:
    parameters:
      - $ref: '#/components/parameters/Accept'
    post:
      tags:
      - administration
      summary:  get face count without basic attributes
      description: |
         Count faces without basic attributes.
      operationId: getMissingFaceBasicAttributesCount
      parameters:
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/face_id__lt'
      - $ref: '#/components/parameters/face_id__gte'
      - $ref: '#/components/parameters/application_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/1000_face_ids'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/1000_face_ids'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/faces_count'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/faces_count'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
      - administration
      summary:  get basic attributes count info
      description: |
         Count basic attributes saved to the Faces database.
      operationId: getFaceBasicAttributesCountInfo
      parameters:
      - $ref: '#/components/parameters/account_id'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/face_basic_attributes_count'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/face_basic_attributes_count'

        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/faces/attributes/descriptors/{version}:
    parameters:
    - $ref: '#/components/parameters/Accept'
    - in: path
      name: version
      schema:
        type: integer
      required: true
      description: descriptor version for deletion

    delete:
      tags:
      - administration
      summary:  delete face descriptors by version
      description: |
         Delete face descriptors by version
      operationId: deleteFaceDescriptors
      parameters:
      - $ref: '#/components/parameters/face_id__lt'
      - $ref: '#/components/parameters/face_id__gte'
      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/removed_face_descriptors'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/removed_face_descriptors'
        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 'face_id__gte'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /3/docs/spec:
    get:
      tags:
        - documents
      summary: get openapi documentation
      description: |
        Get service OpenApi documentation. If *Accept* request header is of type `application/x-yaml`,
        returns documentation in `yaml` format or returns `html` documentation, if *Accept-Type* is `text/html`
      operationId: getSpec

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

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

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

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