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


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

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
  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: 100
        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
  schemas:
    Error:
      type: object
      properties:
        error_code:
          $ref: '#/components/schemas/error_code'
        desc:
          $ref: '#/components/schemas/error_description'
        detail:
          $ref: '#/components/schemas/error_detail'
      required: [error_code, detail, desc]
      example:
        error_code: 11009
        detail: Internal server error
        desc: Internal server error

    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'

    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.

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

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

    new_password:
      type: object
      properties:
        password:
          type: string
          maxLength: 4096
          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 |

    emotion_enum:
      type: integer
      enum: [1, 2, 3, 4, 5, 6, 7]
      description: |
        predominant emotion.

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

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

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

    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]
      example: 3
      description: |
        task type.

        | task type     | value |
        |-------------------|---|
        | unknown           | 0 |
        | linker            | 1 |
        | clusterization    | 2 |
        | report            | 3 |
        | garbage collect   | 4 |
        | additional extract| 5 |

    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]

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

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

    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_descriptior_samples:
          type: array
          items:
            $ref: '#/components/schemas/sample_id'
          description: face descriptior samples
        create_time:
          $ref: '#/components/schemas/time'
      required: [account_id, attribute_id, basic_attributes, basic_attributes_samples,
                 face_descriptor, face_descriptior_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:
      description: subtask list.
      type: array
      items:
        $ref: '#/components/schemas/SubTask'
      minItems: 1

    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'
        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, 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]

    FacesFilters:
      description: faces filters mapping.
      type: object
      properties:
        create_time__gte:
          $ref: '#/components/schemas/time'
        create_time__lt:
          $ref: '#/components/schemas/time_end'
        list_id:
          $ref: '#/components/schemas/list_id'

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

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

    LinkerTaskContent:
      type: object
      description: linker task content
      properties:
        objects_type:
          $ref: '#/components/schemas/objects_type'
        filters:
          oneOf:
            - $ref: '#/components/schemas/FacesFilters'
            - $ref: '#/components/schemas/EventsFilters'
        create_list:
          description: create list to link faces to or not | require list_id or create_list set to 1.
          type: integer
          enum: [0, 1]
          example: 1
        list_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: id of list to link faces to | require list_id or create_list set to 1.
        user_data:
          description: user data to create the list with | works if create_list set to 1.
          type: string
          maxLength: 128
      required: [objects_type]

    LinkerTask:
      type: object
      properties:
        account_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: account id of the task.
        description:
          type: string
          description: provided user data for current task.
          example: linker task one
        content:
          $ref: '#/components/schemas/LinkerTaskContent'
      required: [content]

    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
      required: [target]

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

    GcTaskContent:
      oneOf:
        - $ref: '#/components/schemas/GcEventsTaskContent'
        - $ref: '#/components/schemas/GcDescriptorsTaskContent'

    GcTask:
      type: object
      properties:
        description:
          type: string
          description: provided user data for current task
          example: gc task one
        content:
          allOf:
            - $ref: '#/components/schemas/GcTaskContent'
            - description: garbage collecting task content, target "events" is to remove events, target "descriptors" is to delete descriptors by version.
      required: [content]

    ClusteringTaskContent:
      type: object
      description: clustering task content.
      properties:
        objects_type:
          $ref: '#/components/schemas/objects_type'
        filters:
          oneOf:
            - $ref: '#/components/schemas/FacesFilters'
            - $ref: '#/components/schemas/EventsFilters'
        threshold:
          allOf:
            - $ref: '#/components/schemas/double01'
            - description: threshold value.
          example: 0.5
          default: 0.81
      required: [objects_type, filters]

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

    ReporterTaskContent:
      type: object
      description: reporter task content.
      properties:
        filters:
          type: object
          description: reporter task filters.
          properties:
            account_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
                - description: account id.
            task_id:
              description: id of task.
              type: integer
              example: 146
        columns:
          description: colum names in csv report. Order of fields determinates the order columns in report.
          oneOf:
            - type: array
              items:
                description: event columns.
                type: string
                enum: ["create_time", "external_id", "handler_id", "attribute_id", "source",
                       "top_similar_face_id", "top_similar_face_list", "top_similar_face_similarity",
                       "match_result", "extract_result", "face_id", "attach_result", "gender", "age", "emotion",
                       "ethnic_group", "tags", "user_data"]
              default: ["create_time", "external_id", "handler_id", "attribute_id", "source",
                        "top_similar_face_id", "top_similar_face_list", "top_similar_face_similarity",
                        "face_id", "gender", "age", "emotion", "ethnic_group", "user_data"]
            - type: array
              items:
                description: face columns.
                type: string
                enum: ["user_data", "create_time", "lists", "external_id", "attribute_id",
                       "avatar", "event_id"]
                default: ["user_data", "create_time", "external_id", "attribute_id",
                          "avatar", "event_id"]
          example: ["face_id", "user_data", "create_time"]
        csv_delimiter:
          default: ','
          type: string
          description: csv delimiter.
          maxLength: 1
          minLength: 1
          example: '$'
        save_images:
          type: integer
          default: 0
          enum: [0, 1]
          description: whether to save images in the result.
      required: [task_id]

    ReporterTask:
      type: object
      properties:
        account_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: account id of the task.
        description:
          type: string
          description: provided user data for current task
          example: report clasterization events from cam1
        content:
          $ref: '#/components/schemas/ReporterTaskContent'
      required: [account_id, content]

    AttributesFilters:
      description: attributes filters
      type: object
      properties:
        account_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: account id to execute task within the specified account.

    DescriptorOptions:
      type: object
      properties:
        descriptor_version:
          allOf:
            - description: version of descriptors to extract.
            - $ref: '#/components/schemas/descriptor_version'
        missing:
          type: boolean
          description: whether to extract only missing descriptors (false is not implemented).
          default: true
      required: [descriptor_version]

    BasicAttributesOptions:
      type: object
      properties:
        missing:
          type: boolean
          description: whether to extract only missing basic attributes.

    AdditionalExtractTaskContent:
      description: additional extract task.
      type: object
      properties:
        extraction_target:
          description: extraction target is "descriptor" (target "basic_attributes" will be supported in future versions).
          type: string
          enum: ["descriptor", "basic_attributes"]
        options:
          description: extract task options
          oneOf:
            - $ref: '#/components/schemas/DescriptorOptions'
            - $ref: '#/components/schemas/BasicAttributesOptions'
        filters:
          $ref: '#/components/schemas/AttributesFilters'
      required: [extraction_target, options]

    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]

    GCEventsTaskResult:
      description: removed events
      type: array
      items:
        description: removed event
        type: object
        properties:
          event_id:
            description: removed event id.
            allOf:
              - $ref: '#/components/schemas/event_id'
          samples:
            description: sample ids of the removed face attribute.
            type: array
            items:
              $ref: '#/components/schemas/sample_id'
        required: [event_id, face_id, samples]

    GCDescriptorsTaskResult:
      description: faces whoes descriptors was removed
      type: array
      items:
        allOf:
          - $ref: '#/components/schemas/uuid'
          - description: face id whoes descriptor was removed

    GCTaskResult:
      description: Garbage Collecting task result
      type: object
      properties:
        result:
          oneOf:
            - $ref: '#/components/schemas/GCEventsTaskResult'
            - $ref: '#/components/schemas/GCDescriptorsTaskResult'
        errors:
          $ref: '#/components/schemas/TaskErrors'
      required: [errors]

    LinkerTaskResult:
      description: Linking task result.
      type: object
      properties:
        result:
          description: list of linked faces' ids.
          type: array
          items:
            $ref: '#/components/schemas/face_id'
        errors:
          $ref: '#/components/schemas/TaskErrors'
      required: [errors]

    ClusteringTaskResult:
      description: Clustering task result.
      type: object
      properties:
        result:
          description: clustering result.
          type: object
          properties:
            clusters:
              description: generated clusters - lists of objects ids.
              type: array
              items:
                description: single cluster - list of objects' ids.
                type: array
                items:
                  allOf:
                    - $ref: '#/components/schemas/uuid'
                    - description: object id.
            total_objects:
              type: integer
              description: total objects count.
            total_clusters:
              type: integer
              description: total clusters count.
        errors:
          $ref: '#/components/schemas/TaskErrors'
      required: [errors]

    AdditionalExtractTaskResult:
      description: Additional extract task result.
      type: object
      properties:
        result:
          description: additional extract result.
          type: array
          items:
            type: object
            properties:
              face_id:
                $ref: '#/components/schemas/face_id'
              generation:
                description: attribute generation.
                type: integer
                minimum: 0
              samples:
                description: samples, used for extraction.
                type: array
                items:
                  $ref: '#/components/schemas/sample_id'
            required: [face_id, generation, samples]
        errors:
          $ref: '#/components/schemas/TaskErrors'
      required: [errors, result]

    task_content:
      type: object
      description: task content.
      oneOf:
        - $ref: '#/components/schemas/LinkerTaskContent'
        - $ref: '#/components/schemas/GcTaskContent'
        - $ref: '#/components/schemas/ClusteringTaskContent'
        - $ref: '#/components/schemas/ReporterTaskContent'
        - $ref: '#/components/schemas/AdditionalExtractTaskContent'

    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.
      oneOf:
        - $ref: '#/components/schemas/GCTaskResult'
        - $ref: '#/components/schemas/ClusteringTaskResult'
        - $ref: '#/components/schemas/LinkerTaskResult'
        - $ref: '#/components/schemas/AdditionalExtractTaskResult'

    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-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-licenses:
          $ref: '#/components/schemas/version'
        liveness:
          type: string
          description: the version of the service
          example: 1.11.0
        luna-PLATFORM:
          $ref: '#/components/schemas/version'

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

    descriptor_info:
      type: array
      items:
        type: object
        properties:
          descriptor_version:
            $ref: '#/components/schemas/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:
          type: integer
          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'
      required: [id, tags, name, value, description, create_time, last_update_time]

    configs:
      type: object
      description: setting set.
      properties:
        settings:
          type: array
          items:
            $ref: '#/components/schemas/setting'
        count:
          $ref: '#/components/schemas/count'


    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
        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
      required: [expiration_time, 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'
      required: [services_versions, descriptor_info, configs, license_info, current_faces_attributes_count]

    accept_docs_handler:
      type: string
      enum: [application/x-yaml, text/html]
  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
            wrong_login_password:
              value:
                error_code: 15014
                desc: Bad/incomplete input data
                detail: Login or password is incorrect

    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

    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

    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

    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 {...}
  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:
    get:
      tags:
        - help

      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'
              example:
                api: 3
                major: 2
                minor: 0
                patch: 1
        500:
          $ref: '#/components/responses/internal_server_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'
  /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:
        200:
          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'

      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
        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'
        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
      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})$'
        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: 15013
                desc: Unique constraint error
                detail: |
                  An account with specified email or id already exists
        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
        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
      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:
        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})$'
        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: 15013
                desc: Unique constraint error
                detail: |
                  An account with specified email or id already exists
        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'
        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
        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'
        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'
        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'
        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
        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
        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'
        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
        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'
        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
        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'
        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
        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'
        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:
    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'
        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'
        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'
        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
        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'

      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)'"
        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'

      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)'"
        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"
        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'
security:
  - BasicAuth: []
