OpenApi

View spec in html.

openapi: 3.0.0
info:
  version: 'v.4.7.7'
  title: 'Luna-Admin API'
  description: |
          
          VisionLabs Luna Admin API.

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

          The specification can be used:

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

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

          OpenAPI specification can be received using the "/docs/spec" resource. The "Accept" header should be set to "application/x-yaml".

servers:
- description: SwaggerHub API Auto Mocking
  url: https://virtserver.swaggerhub.com/visionlabs/luna-admin/v.4.7.7

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

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

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

    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

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

    content_disposition:
      schema:
        type: string
        format: 'attachment; filename=\d{4}-\d{2}-\d{2} \d{2}:\d{2}_luna_sys_info.json'
      required: true
      description: recommended filename to save the response body

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

    config_accept_content_type:
      schema:
        type: string
        enum:
          - application/json
          - text/plain
      required: false
      description: The content type of the response body.
  parameters:
    authorization:
      in: header
      schema:
        type: string
        example: Basic dGVzdHVzZXI6dGVzdHB3ZA==
      description: base64 user:password string
      name: Authorization

    luna_request_id:
      in: header
      schema:
        type: string
        format: timestamp,uuid
        pattern: ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
        example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a
      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

    applicationJsonContent:
      in: header
      name: Content-Type
      schema:
        type: string
        enum:
        - application/json

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

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

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

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

    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:10:41.674Z"

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

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

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

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

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

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

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

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

    search_parameter:
      in: query
      name: q
      schema:
        oneOf:
          - $ref: '#/components/schemas/id'
          - $ref: '#/components/schemas/email'
      description: specify the id of an element or the e-mail of an account.
      example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

    accept_docs_handler:
      in: header
      name: Accept
      schema:
        $ref: '#/components/schemas/accept_docs_handler'
      required: true
      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.

    accept_config_handler:
      in: header
      name: Accept
      schema:
        type: string
        enum:
          - application/json
          - text/plain
        description: One of application/json, text/plain
      required: false
      description: acceptable type of receiving data
  schemas:
    AnyStandaloneType:
      description: any standalone type
      anyOf:
        - type: object
          additionalProperties: true
        - type: number
        - type: string
        - type: boolean

    Error:
      type: object
      properties:
        error_code:
          $ref: '#/components/schemas/error_code'
        desc:
          $ref: '#/components/schemas/error_description'
        detail:
          $ref: '#/components/schemas/error_detail'
        link:
          $ref: '#/components/schemas/error_link'
      required: [error_code, detail, desc, link]
      example:
        error_code: 11009
        detail: Internal server error
        desc: Internal server error
        link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11009

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

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

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

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

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

    account_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: account id.

    id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: account id, list id, face id or attribute id.

    account_type:
      type: string
      enum: [ admin, advanced_user, user ]
      default: advanced_user
      description: Account type.

    account_description:
      type: string
      maxLength: 128
      description: Account description.
      default: ''
      example: Horns and Hooves

    login:
      type: string
      minLength: 3
      maxLength: 128
      pattern: ^[a-z0-9_'\+\-\.]+@[a-z0-9]+\.[a-z]{2,}$
      description: Account username.
      example: horns@hooves.com

    password:
      type: string
      minLength: 3
      maxLength: 128
      description: Account password.
      example: secret

    email:
      type: string
      format: email
      pattern: ^[a-z0-9_'\+\-\.]+@[a-z0-9]+\.[a-z]{2,}$
      maxLength: 64
      example: horns@hooves.com
      description: email address.
      deprecated: true

    organization_name:
      type: string
      maxLength: 128
      example: Horns and Hooves
      description: organization name.
      deprecated: true

    new_password:
      type: object
      properties:
        password:
          type: string
          maxLength: 128
          example: password
          description: a new password.

    user_data:
      description: user data.
      type: string
      maxLength: 128
      example: "good persons"

    list_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: list id.

    list_user_data:
      allOf:
        - $ref: '#/components/schemas/user_data'
        - description: user data associated with list.

    face_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: face id.

    attribute_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: attribute id, null if descriptor score is lower than score treshold.

    sample_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: sample id.

    event_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: event id.

    handler_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: handler id.

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

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

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

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

    subtask_content:
      type: object
      description: subtask content.
      additionalProperties:
        x-additionalPropertiesName: subtask content fields
        description: See for details the Luna Tasks documentation.

    subtask_status:
      type: integer
      enum: [0, 1, 2, 3, 4]
      example: 2
      description: |
        subtask status.

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

    task_id:
      type: integer
      minimum: 1
      example: 123

    task_type:
      type: integer
      enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
      example: 3
      description: |
        task type

        | task type        | value |
        |----------------------|---|
        | unknown              | 0 |
        | linker               | 1 |
        | clusterization       | 2 |
        | report               | 3 |
        | garbage collect      | 4 |
        | additional extract   | 5 |
        | cross match          | 6 |
        | roc-curve calculation| 7 |
        | export objects       | 8 |
        | estimate data        | 9 |

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

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

    count_task_parts_done:
      type: integer
      minimum: 0
      description: completed task part count.
      example: 10

    count_task_parts_all:
      type: integer
      minimum: 1
      description: task part count.
      example: 100

    error_id:
      type: integer
      description: error id.

    error_ids:
      type: string
      format: comma-separate error ids
      minItems: 1
      example: 4,5,6

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

    time:
      type: string
      format: date-time
      example: "2018-07-11T09:11:41.674Z"

    time_end:
      type: string
      format: date-time
      example: "2018-07-11T10:11:41.674Z"

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

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

    int0100:
      type: integer
      minimum: 0
      maximum: 100
      example: 29

    count:
      type: integer
      minimum: 0
      example: 1

    int_version:
      type: integer
      minimum: 0

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


    version_handler_response:
      type: object
      properties:
        Version:
          $ref: "#/components/schemas/version"
      required: [Version]

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

    luna_sdk_version:
      type: object
      properties:
        major:
          allOf:
            - $ref: '#/components/schemas/int_version'
            - description: a major version of core service.
            - example: 2
        minor:
          allOf:
            - $ref: '#/components/schemas/int_version'
            - description: a minor version of core service.
            - example: 3
        patch:
          allOf:
            - $ref: '#/components/schemas/int_version'
            - description: a patch version of core service.
            - example: 4
      required: [major, minor, patch]

    core_version:
      allOf:
        - type: object
          description: luna sdk version
          properties:
            luna-sdk-version:
              $ref: '#/components/schemas/luna_sdk_version'
          required: [major, minor, patch, luna-sdk-version]
        - $ref: '#/components/schemas/version'

    account:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
        account_type:
          $ref: '#/components/schemas/account_type'
        description:
          $ref: '#/components/schemas/account_description'
        login:
          $ref: '#/components/schemas/login'
        email:
          $ref: '#/components/schemas/email'
        organization_name:
          $ref: '#/components/schemas/organization_name'
      required: [ account_id, account_type, description, login, email, organization_name ]

    registered_account_outdated:
      type: object
      properties:
        email:
          $ref: '#/components/schemas/email'
        organization_name:
          $ref: '#/components/schemas/organization_name'
      required: [ email, organization_name ]

    registered_account_recent:
      type: object
      properties:
        account_type:
          $ref: '#/components/schemas/account_type'
        login:
          $ref: '#/components/schemas/login'
        password:
          $ref: '#/components/schemas/password'
        description:
          $ref: '#/components/schemas/account_description'
      required: [ login, password ]

    registered_account:
      oneOf:
        - $ref: '#/components/schemas/registered_account_recent'
        - $ref: '#/components/schemas/registered_account_outdated'

    account_response:
      type: object
      properties:
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/account'
          description: list of accounts.
        account_count:
          allOf:
          - $ref: '#/components/schemas/count'
          - description: registered account count.
      required: [accounts, account_count]

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

    account_stats:
      type: object
      description: basic account stats.
      properties:
        list_count:
          allOf:
          - $ref: '#/components/schemas/count'
          - description: account list count.
        face_count:
          allOf:
          - $ref: '#/components/schemas/count'
          - description: account face count.
        face_attribute_count:
          allOf:
            - $ref: '#/components/schemas/count'
            - description: account face attribute count.
      required: [face_attribute_count, list_count, face_count]

    account_info:
      type: object
      properties:
        info:
          $ref: '#/components/schemas/account'
        stats:
          $ref: '#/components/schemas/account_stats'
      required: [info, stats]

    list:
      type: object
      properties:
        list_id:
          $ref: '#/components/schemas/list_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        last_update_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: list update time (face was attached or detached, user_data was changed).
        face_count:
          allOf:
            - $ref: '#/components/schemas/count'
            - description: face count.
        user_data:
          $ref: '#/components/schemas/list_user_data'
      required: [list_id, account_id, last_update_time, face_count, user_data]

    list_info:
      allOf:
        - $ref: '#/components/schemas/list'
        - description: list info.

    face:
      type: object
      properties:
        face_id:
          $ref: '#/components/schemas/face_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: face create time.
      required: [face_id, account_id, create_time]

    face_info:
      allOf:
        - $ref: '#/components/schemas/face'
        - description: face info.

    attribute:
      type: object
      properties:
        attribute_id:
          $ref: '#/components/schemas/attribute_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        basic_attributes:
          type: object
          properties:
            gender:
              allOf:
                - $ref: '#/components/schemas/gender'
                - nullable: true
            age:
              allOf:
                - $ref: '#/components/schemas/int0100'
                - description: age.
                - nullable: true
            ethnicity:
              allOf:
                - $ref: '#/components/schemas/ethnicities_enum'
                - nullable: true
          required: [gender, age, ethnicity]
          description: basic attributes
        basic_attributes_samples:
          type: array
          items:
            $ref: '#/components/schemas/sample_id'
          description: basic attribute samples
        face_descriptor:
          type: string
          nullable: true
        face_descriptor_samples:
          type: array
          items:
            $ref: '#/components/schemas/sample_id'
          description: face descriptor samples
        create_time:
          $ref: '#/components/schemas/time'
      required: [account_id, attribute_id, basic_attributes, basic_attributes_samples,
                 face_descriptor, face_descriptor_samples, create_time]

    attribute_info:
      allOf:
        - $ref: '#/components/schemas/attribute'
        - description: temporary attribute info.

    search_response:
      type: object
      description: basic element info.
      properties:
        data:
          oneOf:
            - $ref: '#/components/schemas/account_info'
            - $ref: '#/components/schemas/list_info'
            - $ref: '#/components/schemas/face_info'
            - $ref: '#/components/schemas/attribute_info'
          nullable: true
        type:
          type: string
          enum: [account, list, face, attribute]
          nullable: true

    list_response:
      type: object
      description: list info.
      properties:
        lists:
          type: array
          items:
            $ref: '#/components/schemas/list'
        list_count:
          allOf:
            - $ref: '#/components/schemas/count'
            - description: list count.

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

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

    SubTasks:
      type: object
      properties:
        subtasks:
          type: array
          items:
            $ref: '#/components/schemas/SubTask'
          minItems: 1
      required: [subtasks]

    TaskError:
      type: object
      properties:
        error_id:
          $ref: '#/components/schemas/error_id'
        task_id:
          $ref: '#/components/schemas/task_id'
        subtask_id:
          allOf:
            - $ref: '#/components/schemas/task_id'
            - nullable: true
            - description: subtask id.
            - example: 5
        error_code:
          $ref: '#/components/schemas/error_code'
        description:
          allOf:
            - $ref: '#/components/schemas/error_description'
            - example: Faces not found
        detail:
          allOf:
            - $ref: '#/components/schemas/error_detail'
            - example: One or more faces not found, including face with id '8f4f0070-c464-460b-bf78-fac225df72e9'
        link:
          $ref: '#/components/schemas/error_link'
        error_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: error time.
        additional_info:
          allOf:
            - $ref: '#/components/schemas/errors_additional_info'
            - nullable: true
            - description: error additional info.
      required: [error_id, task_id, subtask_id, error_code, description, detail, link, error_time, additional_info]

    TaskErrors:
      description: task errors.
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/TaskError'
          minItems: 0
          maxItems: 100000
          description: list of errors occured while task processing.
      required: [errors]

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

    linker_task_content:
      type: object
      description: linker task content
      additionalProperties:
        x-additionalPropertiesName: linker task content fields
        description: See for details the Luna Tasks documentation.

    estimator_task_content:
      type: object
      description: estimator task content
      additionalProperties:
        x-additionalPropertiesName: estimator task content fields
        description: See for details the Luna Tasks documentation.

    GcEventsTaskContent:
      description: garbage collecting task content to remove events
      type: object
      properties:
        target:
          type: string
          enum: ['events']
        filters:
          type: object
          properties:
            account_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
                - description: account id to execute task within the specified account
            create_time__lt:
              allOf:
                - $ref: '#/components/schemas/time'
                - description: create time upper excluding boundary
            insert_time__lt:
              allOf:
                - $ref: '#/components/schemas/time'
                - description: insert time upper excluding boundary
            handler_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
                - description: handler id to execute task within the specified handler
        store_results:
          type: boolean
          description: Whether to store task results. The task errors are stored in any case.
          default: true
        remove_samples:
          type: boolean
          description: |
            Whether to remove face and body samples along with the event.

            > **WARNING**: After removing samples, it will become impossible to re-extract the attribute or descriptor for the created face.
          default: false
        remove_image_origins:
          type: boolean
          description: |
            Whether to remove image origins along with the event.
          default: false
      required: [target, filters]

    GcFaceDescriptorsTaskContent:
      description: Garbage collecting task content to delete face descriptors by version.
      type: object
      properties:
        target:
          type: string
          enum: ['face_descriptors']
        filters:
          type: object
          properties:
            descriptor_version:
              type: integer
              description: version of face descriptors to delete
          required: [descriptor_version]
      required: [target, filters]

    GCFaceFilters:
      type: object
      description: face descriptor filters
      properties:
        descriptor_version:
          type: integer
          description: version of face descriptors to delete
        descriptor_type:
          description: Descriptors type.
          type: string
          enum: ['face']
      required: [descriptor_version, descriptor_type]

    GCBodyFilters:
      type: object
      description: body descriptor filters
      properties:
        descriptor_version:
          type: integer
          description: version of body descriptors to delete
        descriptor_type:
          description: Descriptors type.
          type: string
          enum: ['body']
      required: [descriptor_version, descriptor_type]

    GcEventDescriptorsTaskContent:
      description: Garbage collecting task content to delete event descriptors by version and type.
      type: object
      properties:
        target:
          type: string
          enum: ['event_descriptors']
        filters:
          oneOf:
            - $ref: '#/components/schemas/GCFaceFilters'
            - $ref: '#/components/schemas/GCBodyFilters'
          discriminator:
            propertyName: descriptor_type
            mapping:
              face: '#/components/schemas/GCFaceFilters'
              body: '#/components/schemas/GCBodyFilters'
      required: [target, filters]

    GcTaskContent:
      oneOf:
        - $ref: '#/components/schemas/GcFaceDescriptorsTaskContent'
        - $ref: '#/components/schemas/GcEventDescriptorsTaskContent'
        - $ref: '#/components/schemas/GcEventsTaskContent'
      discriminator:
        propertyName: "target"
        mapping:
          face_descriptors: '#/components/schemas/GcFaceDescriptorsTaskContent'
          event_descriptors: '#/components/schemas/GcEventDescriptorsTaskContent'
          events: '#/components/schemas/GcEventsTaskContent'

    GcTask:
      type: object
      properties:
        description:
          type: string
          description: provided user data for current task
          example: gc task one
        content:
          $ref: '#/components/schemas/GcTaskContent'
      required: [content]

    cross_match_task_content:
      type: object
      description: cross match task content.
      additionalProperties:
        x-additionalPropertiesName: cross match task content fields
        description: See for details the Luna Tasks documentation.

    roc_curve_task_content:
      type: object
      description: ROC-curve calculating task content.
      additionalProperties:
        x-additionalPropertiesName: ROC-curve task content fields
        description: See for details the Luna Tasks documentation.

    clustering_task_content:
      type: object
      description: clustering task content.
      additionalProperties:
        x-additionalPropertiesName: clustering task content fields
        description: See for details the Luna Tasks documentation.

    exporter_task_content:
      type: object
      description: exporter task content.
      additionalProperties:
        x-additionalPropertiesName: exporter task content fields
        description: See for details the Luna Tasks documentation.

    reporter_task_content:
      type: object
      description: reporter task content.
      additionalProperties:
        x-additionalPropertiesName: reporter task content fields
        description: See for details the Luna Tasks documentation.

    AEFaceFilters:
      description: face filters.
      type: object
      properties:
        objects_type:
          description: object type.
          type: string
          enum: [ "face" ]
        account_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: account id.
        face_id__lt:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: upper face id excluding boundary.
        face_id__gte:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: lower face id including boundary.
      required: [ objects_type ]

    AEEventFilters:
      description: event filters.
      type: object
      properties:
        objects_type:
          description: object type.
          type: string
          enum: [ "event" ]
        account_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: account id.
        handler_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: handler id.
        event_id__gte:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: lower event id including boundary.
        event_id__lt:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: upper event id excluding boundary.
        insert_time__gte:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: event insert time lower including boundary.
          example: "2018-08-11T09:11:41.674Z"
        insert_time__lt:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: event insert time upper excluding boundary.
          example: "2018-08-11T09:11:41.674Z"
      required: [ objects_type ]

    AdditionalExtractTaskContentBodyDescriptor:
      description: additional extract human descriptors task
      type: object
      properties:
        extraction_target:
          description: extraction target
          type: string
          enum: [ "body_descriptor" ]
        options:
          description: extract task options
          type: object
          properties:
            descriptor_version:
              description: version of descriptors to extract
              type: integer
            missing:
              type: boolean
              description: whether to extract only missing descriptors (`false` is not implemented)
              default: true
          required: [ descriptor_version ]
        filters:
          allOf:
            - description: |
                object filters.
                Body descriptor re-extraction can be performed on events only (see `objects_type` in filters).
            - $ref: '#/components/schemas/AEEventFilters'
      required: [ extraction_target, options, filters ]

    AdditionalExtractTaskContentFaceDescriptor:
      description: additional extract face descriptors task
      type: object
      properties:
        extraction_target:
          description: extraction target
          type: string
          enum: [ "face_descriptor" ]
        options:
          description: extract task options
          type: object
          properties:
            descriptor_version:
              description: version of descriptors to extract
              type: integer
            missing:
              type: boolean
              description: whether to extract only missing descriptors (`false` is not implemented)
              default: true
          required: [ descriptor_version ]
        filters:
          description: |
            object filters.
            Face descriptor re-extraction can be performed on either faces or events (see `objects_type` in filters).
          oneOf:
            - $ref: '#/components/schemas/AEFaceFilters'
            - $ref: '#/components/schemas/AEEventFilters'
          discriminator:
            propertyName: objects_type
            mapping:
              face: '#/components/schemas/AEFaceFilters'
              event: '#/components/schemas/AEEventFilters'
      required: [ extraction_target, options, filters ]

    AdditionalExtractTaskContentBasicAttributes:
      description: additional extract basic attributes task
      type: object
      properties:
        extraction_target:
          description: extraction target
          type: string
          enum: [ "basic_attributes" ]
        options:
          type: object
          description: extract task options
          properties:
            missing:
              type: boolean
              description: whether to extract only missing basic attributes (`false` is not implemented)
              default: true
        filters:
          description: |
            object filters.
            Basic attributes re-extraction can be performed on either faces or events (see `objects_type` in filters).
          oneOf:
            - $ref: '#/components/schemas/AEFaceFilters'
            - $ref: '#/components/schemas/AEEventFilters'
          discriminator:
            propertyName: objects_type
            mapping:
              face: '#/components/schemas/AEFaceFilters'
              event: '#/components/schemas/AEEventFilters'
      required: [ extraction_target, filters ]

    AdditionalExtractTaskContent:
      description: additional extract task.
      oneOf:
          - $ref: '#/components/schemas/AdditionalExtractTaskContentBasicAttributes'
          - $ref: '#/components/schemas/AdditionalExtractTaskContentFaceDescriptor'
          - $ref: '#/components/schemas/AdditionalExtractTaskContentBodyDescriptor'
      discriminator:
        propertyName: extraction_target
        mapping:
          basic_attributes: '#/components/schemas/AdditionalExtractTaskContentBasicAttributes'
          face_descriptor: '#/components/schemas/AdditionalExtractTaskContentFaceDescriptor'
          body_descriptor: '#/components/schemas/AdditionalExtractTaskContentBodyDescriptor'

    AdditionalExtractTask:
      type: object
      properties:
        description:
          type: string
          description: provided user data for current task.
          example: clustering usefull faces
        content:
          $ref: '#/components/schemas/AdditionalExtractTaskContent'
      required: [content]

    task_content:
      description: task content.
      anyOf:
        - $ref: '#/components/schemas/GcTaskContent'
        - $ref: '#/components/schemas/AdditionalExtractTaskContent'
        - $ref: '#/components/schemas/clustering_task_content'
        - $ref: '#/components/schemas/exporter_task_content'
        - $ref: '#/components/schemas/reporter_task_content'
        - $ref: '#/components/schemas/cross_match_task_content'
        - $ref: '#/components/schemas/roc_curve_task_content'
        - $ref: '#/components/schemas/linker_task_content'
        - $ref: '#/components/schemas/estimator_task_content'

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

    task_response:
      type: object
      description: task info.
      properties:
        tasks:
          type: array
          items:
            $ref: '#/components/schemas/task_info'

    task_count:
      type: object
      description: task count.
      properties:
        count:
          allOf:
            - $ref: '#/components/schemas/count'
            - example: 40

    task_result:
      type: object
      description: task result.
      additionalProperties:
        x-additionalPropertiesName: task result fields
        description: See for details the Luna Tasks documentation.

    error_count:
      type: object
      description: error count.
      properties:
        count:
          allOf:
            - $ref: '#/components/schemas/count'
            - example: 5

    services_versions:
      type: object
      description: versions of luna services.
      properties:
        luna-admin:
          $ref: '#/components/schemas/version'
        luna-accounts:
          $ref: '#/components/schemas/version'
        luna-sender:
          $ref: '#/components/schemas/version'
        luna-image-store-task-results:
          $ref: '#/components/schemas/version'
        luna-events:
          $ref: '#/components/schemas/version'
        luna-tasks:
          $ref: '#/components/schemas/version'
        luna-faces:
          $ref: '#/components/schemas/version'
        luna-image-store-faces-samples:
          $ref: '#/components/schemas/version'
        luna-image-store-bodies-samples:
          $ref: '#/components/schemas/version'
        luna-image-store-images:
          $ref: '#/components/schemas/version'
        luna-api:
          $ref: '#/components/schemas/version'
        luna-configurator:
          $ref: '#/components/schemas/version'
        luna-handlers:
          $ref: '#/components/schemas/version'
        luna-python-matcher:
          $ref: '#/components/schemas/version'
        luna-matcher-proxy:
          $ref: '#/components/schemas/version'
        luna-indexed-matcher:
          $ref: '#/components/schemas/core_version'
        luna-index-manager:
          $ref: '#/components/schemas/version'
        luna-indexer:
          $ref: '#/components/schemas/core_version'
        luna-licenses:
          $ref: '#/components/schemas/version'
        liveness:
          type: string
          description: the version of the service
          example: 1.11.0
        LUNA PLATFORM:
          type: object
          description: versions of luna services.
          properties:
            major:
              allOf:
                - $ref: '#/components/schemas/int_version'
                - description: a major version of service.
                - example: 2
            minor:
              allOf:
                - $ref: '#/components/schemas/int_version'
                - description: a minor version of service.
                - example: 3
            patch:
              allOf:
                - $ref: '#/components/schemas/int_version'
                - description: a patch version of service.
                - example: 4
          required: [major, minor, patch]

    face_descriptor_version:
      type: integer
      description: the face descriptor version
      enum: [46, 52, 54, 56, 57, 58, 59, 60]
      example: 56

    descriptor_info:
      type: array
      items:
        type: object
        properties:
          descriptor_version:
            $ref: '#/components/schemas/face_descriptor_version'
          descriptor_count:
            $ref: '#/components/schemas/count'
        required: [descriptor_version, descriptor_count]

    setting:
      type: object
      description: single setting.
      properties:
        id:
          type: integer
          example: 34
        tags:
          type: array
          items:
            type: string
          example: ['tag1', 'tag2']
        name:
          type: string
          example: SAVE_EVENTS_TIMEOUT
        value:
          anyOf:
            - $ref: "#/components/schemas/AnyStandaloneType"
            - type: array
              items:
                - $ref: "#/components/schemas/AnyStandaloneType"
          example: 2
        description:
          type: string
          example: save events timeout. 0 or negative means no timeout
        create_time:
          $ref: '#/components/schemas/time'
        last_update_time:
          $ref: '#/components/schemas/time'
        is_default:
          type: boolean
      required: [id, tags, name, value, description, create_time, last_update_time, is_default]

    configs:
      description: all platform settings.
      type: array
      items:
        $ref: '#/components/schemas/setting'

    license_period:
      type: object
      properties:
        is_available:
          type: boolean
          description: whether the license is valid
          example: True
        value:
          type: string
          format: date-time
          description: license expiration time
          example: "2021-08-11T09:11:41.674Z"

    license_feature:
      type: object
      properties:
        is_available:
          type: boolean
          description: whether the license feature is available
          example: True
        value:
          type: integer
          nullable: True
          description: license feature current value

    license_info:
      type: object
      description: current license data
      properties:
        expiration_time:
          allOf:
            - $ref: '#/components/schemas/license_period'
            - description: expiration time of your license
        faces_limit:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: |
                information about allowed faces database size:

                - feature availability. When the limit is exceeded, the 'False' value is returned.

                - maximum number of faces with attached attributes
          example:
            is_available: True
            value: 1000
        liveness:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: information about liveness feature availability
          example:
            is_available: True
            value: 1
        liveness_balance:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: remaining liveness executions
          example:
            is_available: True
            value: 100000
        streams_limit:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: maximum number of streams
          example:
            is_available: True
            value: 1000
        iso:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: information about ISO feature availability.
          example:
            is_available: True
            value: 1
        body_attributes:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: information about body attributes estimation feature availability.
          example:
            is_available: True
            value: 1
        index:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: information about matching index feature availability.
          example:
            is_available: True
            value: 1
      required: [expiration_time, faces_limit, liveness]

    system_info:
      type: object
      description: all system info.
      properties:
        services_versions:
          $ref: '#/components/schemas/services_versions'
        descriptor_info:
          $ref: '#/components/schemas/descriptor_info'
        configs:
          $ref: '#/components/schemas/configs'
        current_faces_attributes_count:
          type: integer
          minimum: 0
          description: current faces attributes count
          example: 10
        license_info:
          $ref: '#/components/schemas/license_info'
        signature:
          type: string
        stats:
          type: object
          nullable: true
          properties:
            estimators_stats:
              type: array
              items:
                type: object
                properties:
                  count:
                    type: integer
                    description: amount of the estimations.
                    minimum: 1
                  month:
                    type: string
                    description: month of the interest (events occurred during this month).
                    example: '2021-09'
                  name:
                    type: string
                    description: name of the estimator.
                    example: body_descriptor_extractor_usages
                required: [count, month, name]
            routes_stats:
              type: array
              items:
                type: object
                properties:
                  service:
                    type: string
                    description: name of the service.
                    example: luna-api
                  route:
                    type: string
                    description: code in format 'HTTP_METHOD:URI'
                    example: 'GET:/version'
                  month:
                    type: string
                    description: month of the interest (events occurred during this month).
                    example: '2021-09'
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        count:
                          type: integer
                          minimum: 1
                        error_code:
                          type: string
                          example: '12012'
                      required: [count, error_code]
                  request_stats:
                    type: array
                    items:
                      type: object
                      properties:
                        count:
                          type: integer
                          minimum: 1
                        status_code:
                          type: string
                          example: '200'
                      required: [count, status_code]
                required: [service, route, month, errors, request_stats]

      required: [services_versions, descriptor_info, configs, license_info, current_faces_attributes_count,
                 signature]

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

    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: accounts
            error:
              error_code: 38001
              desc: Health check error
              detail: GET:http:\/\/accounts:5170\/version:Cannot connect to host accounts:5170 ssl:default [Name or service not known]
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-38001

            status: 0
  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'

    authorization_error:
      description: Unautorized
      headers:
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        WWW-Authenticate:
          $ref: '#/components/headers/authenticate'
        Content-Type:
          $ref: '#/components/headers/application_json'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            bad_auth_data:
              value:
                error_code: 12010
                desc: Bad/incomplete input data
                detail: This resource needs 'Authorization' authorization headers
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12010
            wrong_login_password:
              value:
                error_code: 15014
                desc: Bad/incomplete input data
                detail: Login or password is incorrect
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-15014

    login_error:
      description: Unautorized
      headers:
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        WWW-Authenticate:
          $ref: '#/components/headers/authenticate'
        Content-Type:
          $ref: '#/components/headers/application_json'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 15014
            desc: Bad/incomplete input data
            detail: Login or password is incorrect
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-15014

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

    task_not_found_error:
      description: 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: 28001
            desc: Object not found
            detail: Task with id '55023' not found
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28001

    server_timeout_error:
      description: server timeout error.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
            example:
              error_code: 9
              detail: Request timeout
              desc: Request timeout on http://127.0.0.1:5010/{...}, method {...}
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-9
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
paths:
  /:
    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: get account info tables
      description: account info form. if authorization is not passed redirection to */login* page occurs
      operationId: homeForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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:
                title: Visionlabs
                type: string
                description: all accounts info page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /version/view:
    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: view version
      description: version form.
      operationId: versionForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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:
                title: Visionlabs
                type: string
                description: version info page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /version:
    get:
      tags:
        - version

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

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

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/version_handler_response'
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/luna_sys_info:
    get:
      security:
        - BasicAuth: []
      tags:
        - help

      summary: get system info
      description: get luna system info
      operationId: getSystemInfo

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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-Disposition:
              $ref: '#/components/headers/content_disposition'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_info'
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /login:
    get:
      tags:
        - views

      summary: log in
      description: authorization form. if authorization is passed redirection to home page occurs
      operationId: loginForm

      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:
                title: Visionlabs
                type: string
                description: login page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/login_error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/login:
    get:
      security:
        - BasicAuth: []
      tags:
        - login

      summary: check authorization
      description: check authorization cookie
      operationId: checkLogin

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

      responses:
        201:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_plain'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/plain:
              schema:
                type: string
              example: Ok
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    post:
      security:
        - BasicAuth: []
      tags:
        - login

      summary: set authorization
      description: set authorization cookie
      operationId: setLogin

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

      responses:
        201:
          description: Created
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    patch:
      security:
        - BasicAuth: []
      tags:
        - login

      summary: change authorization
      description: change authorization cookie
      operationId: changePassword

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

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

      responses:
        204:
          description: No Content
          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'
              example:
                error_code: 12002
                desc: Bad/incomplete input data
                detail: Request does not contain json
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12002
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'

    delete:
      security:
        - BasicAuth: []
      tags:
        - login

      summary: clear authorization
      description: clear authorization cookie
      operationId: clearLogin

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

      responses:
        204:
          description: No Content
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/search:
    get:
      security:
        - BasicAuth: []
      tags:
        - search

      summary: search element by id or email
      description: search element by id or email
      operationId: search

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/search_parameter'

      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/search_response'
              examples:
                account_search:
                  value:
                    data:
                      info:
                        account_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                        email: horns@hooves.com
                        organization_name: Horns and Hooves
                      stats:
                        list_count: 1
                        face_count: 1
                        face_attribute_count: 1
                    type: account
                  summary: found account info.
                list_search:
                  value:
                    data:
                      list_id: a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
                      account_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                      last_update_time: "2018-07-11T09:11:41.674Z"
                      face_count: 1
                      user_data: good persons
                    type: list
                  summary: found list info.
                face_search:
                  value:
                    data:
                      face_id: a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
                      account_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                      create_time: "2018-07-11T09:11:41.674Z"
                    type: face
                  summary: found face info.
                attribute_search:
                  value:
                    data:
                      attribute_id: a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
                      account_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                      gender: 1
                      age: 23
                      ethnicity: 1
                      descriptor:
                      create_time: "2018-07-11T09:11:41.674Z"
                    type: atttribute
                  summary: found attribute info.
                not_found:
                  value:
                    data: null
                    type: null
                  summary: element not found.
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /accounts:
    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: get account info tables
      description: account info form
      operationId: accountsForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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:
                title: Visionlabs
                type: string
                description: all accounts info page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /accounts/{account_id}:
    parameters:
    - in: path
      name: account_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: account id

    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: get account info by id
      description: specified account info form
      operationId: accountForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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:
                title: Visionlabs
                type: string
                description: account page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /accounts/{account_id}/lists:
    parameters:
    - in: path
      name: account_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: account id

    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: get account lists
      description: specified account lists form
      operationId: accountListsForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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:
                title: Visionlabs
                type: string
                description: account list page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/accounts:
    get:
      security:
        - BasicAuth: []
      tags:
        - accounts

      summary: get accounts
      description: get accounts with filters
      operationId: getAccounts

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/account_response'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'page'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    post:
      security:
        - BasicAuth: []
      tags:
        - accounts

      summary: register account
      description: |
        register a new account in the system.
        
        > **WARNING**: Account registering with `email` is deprecated. Create accounts with `login` & `password` instead.
        When creating an account using legacy scheme, the `email` field will be used as `login` & `password`, and the `organization_name` field will be used as account `description`.
        Mind the validation errors.

      operationId: registerAccount

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

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/registered_account'
        required: true
      responses:
        201:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
                example: /3/accounts/00000000-0000-4000-a000-000000027552
              required: true
              description: location of a new account
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/new_account_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'
              example:
                error_code: 12022
                desc: Bad/incomplete input data
                detail: |
                      Failed to validate input json. Path: 'email', message: 'email must match pattern ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        401:
          $ref: '#/components/responses/authorization_error'
        409:
          description: Conflict
          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: 41002
                desc: Unique constraint error
                detail: Account with account_id '00000000-0000-4000-a000-000000027552' already exists
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-41002
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/accounts/{account_id}:
    parameters:
    - in: path
      name: account_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: account id

    get:
      security:
        - BasicAuth: []
      tags:
        - accounts

      summary: get account by id
      description: get account info by account id
      operationId: getAccount

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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/account_info'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: 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: 15012
                desc: Object not found
                detail: An account with id '00000000-0000-4000-a000-000000025516' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-15012
        500:
          $ref: '#/components/responses/internal_server_error'

    put:
      security:
        - BasicAuth: []
      tags:
        - accounts

      summary: put account by id
      description: |
        register a new account with specified id in the system.
        
        > **WARNING**: Account registering with `email` is deprecated. Create accounts with `login` & `password` instead.
        When creating an account using legacy scheme, the `email` field will be used as `login` & `password`, and the `organization_name` field will be used as account `description`.
        Mind the validation errors.

      operationId: putAccount

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

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/registered_account'
        required: true
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
                example: /3/accounts/00000000-0000-4000-a000-000000027552
              required: true
              description: location of a new account

          content:
            application/json:
              schema:
                $ref: '#/components/schemas/new_account_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'
              example:
                error_code: 12022
                desc: Bad/incomplete input data
                detail: |
                  Failed to validate input json. Path: 'email', message: 'email must match pattern ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        401:
          $ref: '#/components/responses/authorization_error'
        409:
          description: Conflict
          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: 41002
                desc: Unique constraint error
                detail: Account with account_id '00000000-0000-4000-a000-000000027552' already exists
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-41002
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      security:
        - BasicAuth: []
      tags:
        - accounts

      summary: remove account by id
      description: remove the account with specified id from the system
      operationId: removeAccount

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

      responses:
        204:
          description: No Content
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/lists:
    get:
      security:
        - BasicAuth: []
      tags:
        - lists

      summary: get lists
      description: get lists with filters
      operationId: getLists

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'
        - $ref: '#/components/parameters/account_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/list_response'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/lists/{list_id}:
    parameters:
    - in: path
      name: list_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: list id

    get:
      security:
        - BasicAuth: []
      tags:
        - lists

      summary: get list
      description: get list info by id
      operationId: getListById

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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/list_info'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: 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 '00000000-0000-4000-a000-000000025516' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /tasks:
    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: get task info tables
      description: task info form
      operationId: tasksForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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:
                title: Visionlabs
                type: string
                description: all tasks info page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks:
    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get tasks
      description: get tasks with filters
      operationId: getTasks

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

      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/task_response'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'task_ids'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/count:
    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get task count
      description: get task count
      operationId: getTaskCount

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

      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/task_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'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'task_ids'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/{task_id}:
    parameters:
    - in: path
      name: task_id
      schema:
        $ref: '#/components/schemas/task_id'
      required: true
      description: task id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get task by id
      description: get task by id with filters
      operationId: getTask

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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/task_info'
        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'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          $ref: '#/components/responses/task_not_found_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'

    patch:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: cancel task by id
      description: cancel task by id with filters
      operationId: cancelTask

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

      responses:
        204:
          description: No Content
          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'
              example:
                error_code: 28019
                desc: Bad/incomplete input data
                detail: Task '55023' with status 5 cannot be canceled
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28019
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          $ref: '#/components/responses/task_not_found_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'

    delete:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: delete task by id
      description: delete task by id
      operationId: deleteTask

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

      responses:
        204:
          description: No Content
          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'
              example:
                error_code: 28019
                desc: Bad/incomplete input data
                detail: Task '55023' with status 5 cannot be canceled
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28019
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          $ref: '#/components/responses/task_not_found_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'

  /4/tasks/{task_id}/result:
    parameters:
    - in: path
      name: task_id
      schema:
        $ref: '#/components/schemas/task_id'
      required: true
      description: task id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get task result by id
      description: get task result by id
      operationId: getTaskResult

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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/task_result'
        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'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          description: 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: 28020
                desc: Object not found
                detail: Impossible get a result of task 33804 with status 2
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28020
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/{task_id}/errors:
    parameters:
    - in: path
      name: task_id
      schema:
        $ref: '#/components/schemas/task_id'
      required: true
      description: task id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get task errors by task id
      description: get task errors by task id
      operationId: getTaskErrors

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskErrors'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          description: 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: 28003
                desc: Object not found
                detail: Task error with id '33804' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28003
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/{task_id}/errors/count:
    parameters:
    - in: path
      name: task_id
      schema:
        $ref: '#/components/schemas/task_id'
      required: true
      description: task id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get task error count by task id
      description: get task error count by task id
      operationId: getTaskErrorsCount

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/error_time__lt'
        - $ref: '#/components/parameters/error_time__gte'
        - $ref: '#/components/parameters/error_code'

      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/error_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'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          description: 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: 28003
                desc: Object not found
                detail: Task error with id '33804' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28003
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/{task_id}/subtasks:
    parameters:
    - in: path
      name: task_id
      schema:
        $ref: '#/components/schemas/task_id'
      required: true
      description: task id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get subtasks by task id
      description: get subtasks by task id
      operationId: getTaskSubTasks

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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/SubTasks'
        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'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          $ref: '#/components/responses/task_not_found_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/errors:
    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get errors
      description: get errors
      operationId: getErrors

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

      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/TaskErrors'
        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'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'task_ids'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/errors/count:
    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get error count
      description: get error count
      operationId: getErrorCount

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/task_ids'
        - $ref: '#/components/parameters/error_ids'
        - $ref: '#/components/parameters/error_time__lt'
        - $ref: '#/components/parameters/error_time__gte'
        - $ref: '#/components/parameters/task_type'
        - $ref: '#/components/parameters/error_code'

      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/error_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'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'task_ids'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/errors/{error_id}:
    parameters:
    - in: path
      name: error_id
      schema:
        $ref: '#/components/schemas/error_id'
      required: true
      description: error id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get error by id
      description: get error by id
      operationId: getError

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $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/TaskError'
        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'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          description: 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: 28003
                desc: Object not found
                detail: Task error with id '1042177' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28003
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/gc:
    post:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: create gc task
      description: create and start gc task
      operationId: createTaskGC

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

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

      responses:
        202:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                description: task id.
                properties:
                  task_id:
                    $ref: '#/components/schemas/task_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'
              example:
                error_code: 12022
                desc: Bad/incomplete input data
                detail: "Failed to validate input json. Path: '',  message: 'Additional properties are not allowed ('userdata' was unexpected)'"
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/additional_extract:
    post:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: create additional extract task
      description: create and start additional extract task
      operationId: createTaskAdditionalExtract

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

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

      responses:
        202:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                description: task id.
                properties:
                  task_id:
                    $ref: '#/components/schemas/task_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'
              example:
                error_code: 12022
                desc: Bad/incomplete input data
                detail: "Failed to validate input json. Path: '',  message: 'Additional properties are not allowed ('userdata' was unexpected)'"
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/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'
  /4/docs/dev:
    get:
      tags:
        - documents
      summary: get development manual
      description: |
        Get sphinx documentation - *Development Manual*. After the request you will be redirected to the page `/docs/dev/index.html`
      operationId: getDevManual

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/html:
              schema:
                type: string
                description: html format documentation
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/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'
  /4/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'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /healthcheck:
    get:
      tags:
        - health
      summary: get health (redirect)
      description: get health of service (redirect)
      operationId: healthcheck(redirect)
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/include_luna_services'
      responses:
        200:
          description: OK (redirected)
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/health_ok'
        308:
          description: Moved permanently
          headers:
            Location:
              schema:
                type: string
                enum:
                  - "/6/healthcheck"
              required: true
              description: redurect to the versioned resource
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        500:
          $ref: '#/components/responses/internal_server_error'

        502:
          description: Unhealthy (redirected)
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/health_errors'
        504:
          $ref: '#/components/responses/server_timeout_error'
security:
  - BasicAuth: []