openapi: 3.0.0
info:
  title: Alconost MQM Tool API
  description: |
    Automate your localization quality workflow with the Alconost MQM Tool API.
    Supports importing (TSV, JSONL, JSON) and exporting annotation data.
  version: "1.0.0"
servers:
  - url: https://alconost.mt/mqm-tool/api
    description: Production Server

components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Custom-Token

security:
  - BearerAuth: []

paths:
  /import:
    post:
      summary: Import Project Data
      description: Create a new project and import segments from a file or JSON body.
      operationId: importProject
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: TSV, CSV, or JSONL file
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  example: "My Project"
                segments:
                  type: array
                  items:
                    type: object
                    description: Segment object (source, target, etc.)
      responses:
        '200':
          description: Project created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  id:
                    type: string
                  name:
                    type: string
                  count:
                    type: integer
        '401':
          description: Unauthorized (Invalid Token)

  /projects/{id}/export:
    get:
      summary: Export Project Data
      description: Retrieve annotated data in JSONL, TSV, or CSV format.
      security: [] # Public endpoint
      operationId: exportProject
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: format
          in: query
          description: Export format (jsonl, tsv, csv)
          schema:
            type: string
            enum: [jsonl, tsv, csv]
            default: jsonl
      responses:
        '200':
          description: Data export file
          content:
            application/x-jsonlines:
              schema:
                type: string
            text/tab-separated-values:
              schema:
                type: string
            text/csv:
              schema:
                type: string

  /config:
    get:
      summary: Get MQM Taxonomy
      description: Returns the configured error categories and severities.
      security: [] # Public endpoint
      operationId: getConfig
      responses:
        '200':
          description: Taxonomy configuration
          content:
            application/json:
              schema:
                type: object
                properties:
                  categories:
                    type: array
                    items:
                      type: string
                  severities:
                    type: array
                    items:
                      type: string
