Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Open api
filternone
supportedSubmitMethodsnone
showUrlfalse
openapi: 3.0.2
servers: []
info:
  title: Globalese
  version: 3
  description: Globalese API v3
tags:
  - name: Corpora
  - name: Engines
  - name: Engine instances
  - name: Groups
  - name: Languages
  - name: Segment translation dispatchers
paths:
  /corpora:
    get:
      tags:
        - Corpora
      security:
        - bearer: [ ]
      summary: List corpora
      description: Returns a collection of corpora.
      parameters:
        - $ref: '#/components/parameters/stringIds'
        - $ref: '#/components/parameters/limitMax100'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/sourceLanguage'
        - $ref: '#/components/parameters/targetLanguage'
        - $ref: '#/components/parameters/groupIds'
        - $ref: '#/components/parameters/engineId'
        - $ref: '#/components/parameters/metadataDomain'
        - $ref: '#/components/parameters/metadataSubject'
        - $ref: '#/components/parameters/metadataClient'
        - $ref: '#/components/parameters/metadataProject'
        - $ref: '#/components/parameters/metadataDescription'
        - $ref: '#/components/parameters/corpusCatServerId'
        - name: name
          in: query
          description: Full or partial corpus name for filtering.
          schema:
            type: string
        - name: sort
          in: query
          schema:
            type: string
            enum:
              - name:asc
              - name:desc
              - counts.segment_count:asc
              - counts.segment_count:desc
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CorpusCollection'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        500:
          $ref: '#/components/responses/500InternalServerError'
    post:
      tags:
        - Corpora
      security:
        - bearer: [ ]
      summary: Upload a new corpus
      description: |
        The `source_language` and `target_language` are required for these formats:
        * `csv-comma`
        * `csv-memoq`
        * `csv-semicolon`
        * `tsv`

        Only a single file may be uploaded in one request. Maximum file size: 600 MB.

        A file can be uploaded as a zip archive.
        The zip archive may only contain one file, and the file format must be provided in the `format` field.

        The `Content-Disposition` header must contain the `filename` directive.
        This is taken care of by most libraries in general.

        E.g. `Content-Disposition: form-data; name="Example TM"; filename="example.xliff"`

        Required permissions: `MANAGE_CORPORA` in all the groups the corpus is uploaded to, or `SYSTEM_ADMINISTRATOR`
      requestBody:
        $ref: '#/components/requestBodies/CreateCorpus'
      responses:
        201:
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Corpus'
        400:
          $ref: '#/components/responses/400BadRequest'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        500:
          $ref: '#/components/responses/500InternalServerError'
  /corpora/{corpusId}:
    parameters:
      - $ref: '#/components/parameters/corpusIdInPath'
    get:
      tags:
        - Corpora
      security:
        - bearer: [ ]
      summary: Show the details of a corpus
      description: |
        Returns a single corpus.

        Required permissions: `MANAGE_CORPORA` in the group the corpus belongs to, or `SYSTEM_ADMINISTRATOR`
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Corpus'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
    patch:
      tags:
        - Corpora
      security:
        - bearer: [ ]
      summary: Update a corpus
      description: |
        Required permissions: `MANAGE_CORPORA` in all the groups the corpus belongs to, or `SYSTEM_ADMINISTRATOR`
      requestBody:
        $ref: '#/components/requestBodies/UpdateCorpus'
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Corpus'
        400:
          $ref: '#/components/responses/400BadRequest'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        500:
          $ref: '#/components/responses/500InternalServerError'
    delete:
      tags:
        - Corpora
      security:
        - bearer: [ ]
      summary: Delete a corpus
      description: |
        Delete a corpus.

        Required permissions: `MANAGE_CORPORA` in all groups the corpus belongs to, or `SYSTEM_ADMINISTRATOR`
      responses:
        204:
          $ref: '#/components/responses/204NoContent'
        400:
          $ref: '#/components/responses/400BadRequest'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
  /corpora/{corpusId}/content:
    parameters:
      - $ref: '#/components/parameters/corpusIdInPath'
    get:
      tags:
        - Corpora
      security:
        - bearer: [ ]
      summary: Corpus content
      description: |
        Returns segments of a corpus.

        Required permissions: `MANAGE_CORPORA` in the group the corpus belongs to, or `SYSTEM_ADMINISTRATOR`
      parameters:
        - $ref: '#/components/parameters/limitMax100'
        - $ref: '#/components/parameters/offset'
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CorpusContent'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
  /corpora/{corpusId}/events:
    parameters:
      - $ref: '#/components/parameters/corpusIdInPath'
    get:
      tags:
        - Corpora
      security:
        - bearer: [ ]
      summary: Show the event log of a corpus
      description: |
        Returns a list of events from the corpus log.

        Required permissions: `MANAGE_CORPORA` in the group the corpus belongs to, or `SYSTEM_ADMINISTRATOR`
      parameters:
        - name: sort
          in: query
          schema:
            type: string
            enum:
              - timestamp:asc
              - timestamp:desc
        - $ref: '#/components/parameters/limitMax100'
        - $ref: '#/components/parameters/offset'
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CorpusEventCollection'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
  /corpora/{corpusId}/versions:
    parameters:
      - $ref: '#/components/parameters/corpusIdInPath'
    get:
      tags:
        - Corpora
      security:
        - bearer: [ ]
      summary: List all versions of a corpus
      description: |
        Returns details about each version of a corpus:
        * corpus counts
        * engine IDs that used the current corpus for training
        * engine IDs that used the current corpus for tuning

        Required permissions: `MANAGE_CORPORA` in the group the corpus belongs to, or `SYSTEM_ADMINISTRATOR`
      parameters:
        - name: sort
          in: query
          schema:
            type: string
            enum:
              - counts.segment_count:asc
              - counts.segment_count:desc
              - version:asc
              - version:desc
        - $ref: '#/components/parameters/limitMax100'
        - $ref: '#/components/parameters/offset'
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CorpusVersionCollection'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
    post:
      tags:
        - Corpora
      security:
        - bearer: [ ]
      summary: Update corpus content
      description: |
        Update the contents of a corpus, creating a new version thereof.

        The format of the uploaded content must be the same as the format of the original content.

        The language codes of the uploaded content must be the same as the original ones.

        Required permissions: `MANAGE_CORPORA` in the group the corpus belongs to, or `SYSTEM_ADMINISTRATOR`
      requestBody:
        $ref: '#/components/requestBodies/UpdateCorpusContent'
      responses:
        201:
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CorpusVersion'
        400:
          $ref: '#/components/responses/400BadRequest'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
  /engines:
    get:
      tags:
        - Engines
      security:
        - bearer: [ ]
      summary: List engines
      description: |
        Returns a collection of engines.

        A translation API key can also be used for authentication.
      parameters:
        - $ref: '#/components/parameters/numericalIds'
        - $ref: '#/components/parameters/limitMax100'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/sourceLanguage'
        - $ref: '#/components/parameters/targetLanguage'
        - $ref: '#/components/parameters/engineStatuses'
        - $ref: '#/components/parameters/groupIds'
        - name: name
          in: query
          description: Full or partial engine name for filtering.
          schema:
            type: string
        - name: sort
          in: query
          schema:
            type: string
            enum:
              - name:asc
              - name:desc
              - status:asc
              - status:desc
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EngineCollection'
        401:
          $ref: '#/components/responses/401Unauthorized'
        500:
          $ref: '#/components/responses/500InternalServerError'
    post:
      tags:
        - Engines
      security:
        - bearer: [ ]
      summary: Create a new engine
      description: |
        Restrictions:

        * Using stock corpora and stock engines are mutually exclusive options.
        * Stock+ engines (i.e. engines based on a stock engine) can only have core corpora.

        Required permissions: `MANAGE_ENGINES` in the group the engine belongs to, or `SYSTEM_ADMINISTRATOR`
      requestBody:
        $ref: '#/components/requestBodies/CreateEngine'
      responses:
        201:
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Engine'
        400:
          $ref: '#/components/responses/400BadRequest'
        401:
          $ref: '#/components/responses/401Unauthorized'
        402:
          description: |
            Maximum number of allowed engines reached.
            Only applies to legacy subscriptions.
        403:
          $ref: '#/components/responses/403Forbidden'
        500:
          $ref: '#/components/responses/500InternalServerError'
        502:
          $ref: '#/components/responses/502BadGateway'
  /engines/{engineId}:
    parameters:
      - $ref: '#/components/parameters/engineIdInPath'
    get:
      tags:
        - Engines
      security:
        - bearer: [ ]
      summary: Show the details of an engine
      description: |
        Returns a single engine.

        Required permissions: `MANAGE_ENGINES`, `MANAGE_PROJECTS` or `TRANSLATE` in the group the engine belongs to, or `SYSTEM_ADMINISTRATOR`

        A translation API key can also be used for authentication.
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Engine'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
    patch:
      tags:
        - Engines
      security:
        - bearer: [ ]
      summary: Update an engine
      description: |
        Required permissions: `MANAGE_ENGINES` in the group the engine belongs to, or `SYSTEM_ADMINISTRATOR`

        The `published` property can only be changed if the engine has been trained or tuned before.
      requestBody:
        $ref: '#/components/requestBodies/UpdateEngine'
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Engine'
        400:
          $ref: '#/components/responses/400BadRequest'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
    delete:
      tags:
        - Engines
      security:
        - bearer: [ ]
      summary: Delete an engine
      description: |
        Delete an engine.

        Required permissions: `MANAGE_ENGINES|SYSTEM_ADMINISTRATOR`
      responses:
        204:
          $ref: '#/components/responses/204NoContent'
        400:
          $ref: '#/components/responses/400BadRequest'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
  /engines/{engineId}/events:
    parameters:
      - $ref: '#/components/parameters/engineIdInPath'
    get:
      tags:
        - Engines
      security:
        - bearer: [ ]
      summary: Show the event log of an engine
      description: |
        Returns a list of events from the engine log.

        Required permissions: `MANAGE_ENGINES` in the group the engine belongs to, or `SYSTEM_ADMINISTRATOR`
      parameters:
        - name: sort
          in: query
          schema:
            type: string
            enum:
              - timestamp:asc
              - timestamp:desc
        - $ref: '#/components/parameters/limitMax100'
        - $ref: '#/components/parameters/offset'
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EngineEventCollection'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
  /engines/{engineId}/resources:
    parameters:
      - $ref: '#/components/parameters/engineIdInPath'
    get:
      tags:
        - Engines
      security:
        - bearer: [ ]
      summary: Show the resources of an engine
      description: |
        Returns a single engine's resources.

        Required permissions: `MANAGE_ENGINES` or `MANAGE_PROJECTS` in the group the engine belongs to, or `SYSTEM_ADMINISTRATOR`
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EngineResources'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
  /engine-instances:
    get:
      tags:
        - Engine instances
      security:
        - bearer: [ ]
      summary: List engine instances
      description: |
        Returns a collection of engine instances (being) deployed.

        Required permissions: `MANAGE_ENGINES|TRANSLATE|SYSTEM_ADMINISTRATOR`

        A translation API key can also be used for authentication.
      parameters:
        - $ref: '#/components/parameters/numericalIds'
        - $ref: '#/components/parameters/engineIds'
        - $ref: '#/components/parameters/groupIds'
        - $ref: '#/components/parameters/limitMax100'
        - $ref: '#/components/parameters/offset'
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EngineInstanceCollection'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        500:
          $ref: '#/components/responses/500InternalServerError'
    post:
      tags:
        - Engine instances
      security:
        - bearer: [ ]
      summary: Create a new engine instance
      description: |
        Starts deploying an engine in the background.

        Required permissions: `MANAGE_ENGINES|SYSTEM_ADMINISTRATOR`
      requestBody:
        $ref: '#/components/requestBodies/CreateEngineInstance'
      responses:
        202:
          description: The newly created engine instance entity in the database.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EngineInstance'
        400:
          $ref: '#/components/responses/400BadRequest'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        500:
          $ref: '#/components/responses/500InternalServerError'
  /engine-instances/{id}:
    parameters:
      - name: id
        description: Engine instance ID
        in: path
        required: true
        schema:
          type: integer
    get:
      tags:
        - Engine instances
      security:
        - bearer: [ ]
      summary: Show the details of an engine instance
      description: |
        Returns a single engine instance.

        Required permissions: `MANAGE_ENGINES|TRANSLATE|SYSTEM_ADMINISTRATOR`

        A translation API key can also be used for authentication.
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EngineInstance'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
        502:
          $ref: '#/components/responses/502BadGateway'
    delete:
      tags:
        - Engine instances
      security:
        - bearer: [ ]
      summary: Delete an engine instance
      description: |
        Removes a deployed engine instance.

        Required permissions: `MANAGE_ENGINES|SYSTEM_ADMINISTRATOR`
      responses:
        204:
          $ref: '#/components/responses/204NoContent'
        400:
          $ref: '#/components/responses/400BadRequest'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        404:
          $ref: '#/components/responses/404NotFound'
        500:
          $ref: '#/components/responses/500InternalServerError'
        502:
          $ref: '#/components/responses/502BadGateway'
  /groups:
    get:
      tags:
        - Groups
      security:
        - bearer: [ ]
      summary: List groups
      description: Returns a collection of groups the authenticated user is a member of.
      parameters:
        - $ref: '#/components/parameters/limitMax100'
        - $ref: '#/components/parameters/offset'
        - name: sort
          in: query
          schema:
            type: string
            enum:
              - name:asc
              - name:desc
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupCollection'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        500:
          $ref: '#/components/responses/500InternalServerError'
  /languages:
    get:
      tags:
        - Languages
      security:
        - bearer: [ ]
      summary: List languages
      description: |
        Returns a collection of languages used in Globalese.

        A translation API key can also be used for authentication.
      parameters:
        - $ref: '#/components/parameters/languageUsage'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/offset'
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LanguageCollection'
        401:
          $ref: '#/components/responses/401Unauthorized'
        500:
          $ref: '#/components/responses/500InternalServerError'
  /segment-translation-dispatchers:
    get:
      tags:
        - Segment translation dispatchers
      security:
        - bearer: [ ]
      summary: List segment translation dispatchers
      description: |
        Required permissions: `MANAGE_ENGINES|SYSTEM_ADMINISTRATOR`
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RemoteDispatcherCollection'
        401:
          $ref: '#/components/responses/401Unauthorized'
        403:
          $ref: '#/components/responses/403Forbidden'
        500:
          $ref: '#/components/responses/500InternalServerError'
        502:
          $ref: '#/components/responses/502BadGateway'
components:
  parameters:
    corpusCatServerId:
      name: cat.server.id
      in: query
      description: |
        The ID of the CAT server the corpus is associated with.
      schema:
        type: number
        example: 10
    corpusIdInPath:
      name: corpusId
      description: Corpus ID
      in: path
      required: true
      schema:
        type: string
        example: 5b04a7263fa509.a4444794
    engineId:
      name: engine_id
      in: query
      description: |
        Engine ID for filtering.

        Examples: `1`, `2`
      schema:
        $ref: '#/components/schemas/engineId'
    engineIdInPath:
      name: engineId
      in: query
      required: true
      schema:
        type: integer
        example:
          5
    engineIds:
      name: engine_ids
      in: query
      description: |
        One or more engine ID(s) for filtering, comma-separated.

        Examples: `1`, `1,3,5`
      schema:
        oneOf:
          - type: integer
          - type: string
    engineStatuses:
      name: statuses
      in: query
      description: |
        One or more engine statuses for filtering, comma-separated.

        Examples: `trained`, `queued,training`
      schema:
        type: string
        enum:
          - changed
          - error
          - queued
          - trained
          - training
          - tuned
          - tuning
          - untrained
    groupIds:
      name: group_ids
      in: query
      description: |
        One or more group ID(s) for filtering, comma-separated.

        Examples: `1`, `1,3,5`
      schema:
        oneOf:
          - type: integer
          - type: string
      style: form
      explode: false
    languageUsage:
      name: usage
      in: query
      description: |
        Filter for languages used in Globalese.

        Optionally, the `:source` or `:target` modifier may be appended to the parameter value to filter for languages used on the source or target language side only.

        `usage=engines:source` will return a list of languages used as engine source languages.

        `usage=engines` will return a list of languages used as engine languages, either source or target.
      schema:
        type: string
        enum:
          - engines
    limit:
      name: limit
      in: query
      description: |
        Limit for results. *May* be used together with `offset`.

        Examples: `25`, `50`
      schema:
        type: integer
    limitMax100:
      name: limit
      in: query
      description: |
        Limit for results. It cannot be greater than 100. *May* be used together with `offset`.

        Examples: `25`, `50`

        If not provided, it will automatically be set to 100.
      schema:
        type: integer
    metadataClient:
      name: metadata.client
      in: query
      description: |
        Client metadata descriptor.

        Examples: `Very Important Client`
      schema:
        type: string
    metadataDescription:
      name: metadata.description
      in: query
      description: |
        Description metadata descriptor.

        Examples: `used for 2018 campaign`
      schema:
        type: string
    metadataDomain:
      name: metadata.domain
      in: query
      description: |
        Domain metadata descriptor.

        Examples: `legal`
      schema:
        type: string
    metadataProject:
      name: metadata.project
      in: query
      description: |
        Project metadata descriptor.

        Examples: `0192 EC Project`
      schema:
        type: string
    metadataSubject:
      name: metadata.subject
      in: query
      description: |
        Subject metadata descriptor.

        Examples: `EU treaties`
      schema:
        type: string
    numericalIds:
      name: ids
      in: query
      description: |
        One or more ID(s) for filtering, comma-separated.

        Examples: `3`, `3,4`
      schema:
        type: string
      style: form
      explode: false
    offset:
      name: offset
      in: query
      description: |
        Offset to start query from. **Must** be used together with `limit`.

        Examples: `50`, `100`
      schema:
        type: integer
    sourceLanguage:
      name: source_language
      in: query
      description: |
        Source language.

        Examples: `en`, `fr`
      schema:
        type: string
    stringIds:
      name: ids
      in: query
      description: |
        One or more ID(s) for filtering, comma-separated.

        Examples: `5b04a7263fa509.a4444794`, `5b04a7263fa509.a4444794,5b0412363fa5c1.a4354792`
      schema:
        type: string
      style: form
      explode: false
    targetLanguage:
      name: target_language
      in: query
      description: |
        Target language.

        Examples: `en`, `fr`
      schema:
        type: string
  requestBodies:
    CreateCorpus:
      content:
        multipart/form-data:
          schema:
            $ref: '#/components/schemas/CreateCorpus'
    CreateEngine:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateEngine'
      required: true
    CreateEngineInstance:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - engine_id
              - dispatcher_id
            properties:
              engine_id:
                $ref: '#/components/schemas/engineId'
              dispatcher_id:
                $ref: '#/components/schemas/dispatcherId'
    UpdateCorpus:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UpdateCorpus'
    UpdateCorpusContent:
      content:
        multipart/form-data:
          schema:
            $ref: '#/components/schemas/UpdateCorpusContent'
    UpdateEngine:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UpdateEngine'
  responses:
    204NoContent:
      description: No Content
    400BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    401Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    403Forbidden:
      description: Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    404NotFound:
      description: Resource not found
    422UnprocessableEntity:
      description: Unprocessable entity
    500InternalServerError:
      description: Internal server error while processing the request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    502BadGateway:
      description: Bad Gateway
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: API key
  schemas:
    catToolServerId:
      description: CAT tool server ID in Globalese
      type: integer
      example: 10
    catToolServerType:
      type: string
      enum:
        - memoq
        - memsource
        - smartcat
        - xtm
    CollectionMetadata:
      type: object
      required:
        - counts
      properties:
        counts:
          type: object
          required:
            - total
            - filtered
          properties:
            total:
              description: The total number of resources in the system, irrespective of any filters.
              type: integer
              example: 100
            filtered:
              description: The number of resources in the system matching the filters.
              type: integer
              example: 40
    Corpus:
      type: object
      required:
        - id
        - actions
        - cat
        - counts
        - engines
        - format
        - groups
        - metadata
        - name
        - source_language
        - target_language
        - version
      properties:
        id:
          $ref: '#/components/schemas/corpusId'
        actions:
          $ref: '#/components/schemas/CorpusActions'
        cat:
          $ref: '#/components/schemas/CorpusCat'
        counts:
          $ref: '#/components/schemas/CorpusCounts'
        engine_ids:
          type: array
          items:
            type: integer
          example: [ 2, 8, 14 ]
        format:
          $ref: '#/components/schemas/corpusFormat'
        group_ids:
          $ref: '#/components/schemas/corpusGroupIds'
        metadata:
          $ref: '#/components/schemas/CorpusMetadata'
        name:
          $ref: '#/components/schemas/corpusName'
        source_language:
          $ref: '#/components/schemas/sourceLanguage'
        target_language:
          $ref: '#/components/schemas/targetLanguage'
        version:
          $ref: '#/components/schemas/corpusVersion'
    CorpusActions:
      type: object
      description: An object describing the actions possible against a corpus.
      required:
        - delete
        - update
      properties:
        delete:
          type: boolean
        update:
          type: boolean
    CorpusCat:
      type: object
      nullable: true
      description: |
        If the corpus was created by retrieving a CAT tool server corpus, this object contains relevant information.
      required:
        - corpus
        - server
      properties:
        corpus:
          $ref: '#/components/schemas/CorpusCatCorpus'
        server:
          $ref: '#/components/schemas/CorpusCatServer'
    CorpusCatCorpus:
      type: object
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/remoteCorpusId'
    CorpusCatServer:
      type: object
      required:
        - id
        - type
      properties:
        id:
          $ref: '#/components/schemas/catToolServerId'
        type:
          $ref: '#/components/schemas/catToolServerType'
    CorpusCollection:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Corpus'
        meta:
          $ref: '#/components/schemas/CollectionMetadata'
    CorpusContent:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items:
            type: object
            required:
              - id
              - content
            properties:
              id:
                type: string
                example: "1"
                nullable: true
              content:
                type: object
                required:
                  - source
                  - target
                properties:
                  source:
                    type: string
                  target:
                    type: string
        meta:
          $ref: '#/components/schemas/CollectionMetadata'
    CorpusCounts:
      type: object
      required:
        - segment_count
        - source_word_count
        - target_word_count
        - source_character_count
        - target_character_count
      properties:
        segment_count:
          type: integer
          example: 145952
        source_word_count:
          type: integer
          example: 2819806
        target_word_count:
          type: integer
          example: 3120176
        source_character_count:
          type: integer
          example: 24235334
        target_character_count:
          type: integer
          example: 29194748
    CorpusEvent:
      allOf:
        - $ref: '#/components/schemas/Event'
        - type: object
          properties:
            resource_id:
              $ref: '#/components/schemas/corpusId'
            type:
              type: string
              enum:
                - uploaded
                - updated
                - new_version_uploaded
    CorpusEventCollection:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/CorpusEvent'
        meta:
          $ref: '#/components/schemas/CollectionMetadata'
    corpusFormat:
      type: string
      enum:
        - csv-comma
        - csv-memoq
        - csv-semicolon
        - tmx
        - tbx
        - tsv
        - xliff
        - xliff-memoq
        - xliff-memsource
        - xliff-sdl
        - xliff-smartcat
        - xliff-translate5
        - xliff-wordbee
        - xliff-xtm
    corpusGroupIds:
      type: array
      description: |
        Cannot be empty.
        A corpus must always be assigned to at least one group.
      items:
        type: integer
      example: [ 1, 3 ]
    corpusId:
      description: Corpus ID
      type: string
      example: 5a0ba1267f0571.04642701
    CorpusMetadata:
      type: object
      properties:
        domain:
          type: string
          nullable: true
          example: legal
        subject:
          type: string
          nullable: true
          example: EU treaties
        client:
          type: string
          nullable: true
          example: Very Important Client
        project:
          type: string
          nullable: true
          example: 0192 EC Project
        description:
          type: string
          nullable: true
          example: created by DGT
    corpusName:
      type: string
      example: English to German DGT.tmx
    CorpusVersion:
      type: object
      required:
        - version
        - counts
        - engine_ids
        - timestamps
      properties:
        version:
          $ref: '#/components/schemas/corpusVersion'
        counts:
          $ref: '#/components/schemas/CorpusCounts'
        engine_ids:
          $ref: '#/components/schemas/CorpusVersionEngineIds'
        timestamps:
          $ref: '#/components/schemas/CorpusVersionTimestamps'
    corpusVersion:
      description: The version of the corpus
      type: integer
      example: 1
    CorpusVersionCollection:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/CorpusVersion'
        meta:
          $ref: '#/components/schemas/CollectionMetadata'
    CorpusVersionEngineIds:
      type: object
      required:
        - trained
        - tuned
      properties:
        trained:
          type: array
          items:
            type: integer
          example: [ 2, 8, 14 ]
        tuned:
          type: array
          items:
            type: integer
          example: [ 2, 8, 14 ]
    CorpusVersionTimestamps:
      type: object
      required:
        - created_at
      properties:
        created_at:
          $ref: '#/components/schemas/createdAt'
    CreateCorpus:
      type: object
      required:
        - file
        - format
        - group_ids[]
      properties:
        file:
          type: object
        format:
          $ref: '#/components/schemas/corpusFormat'
        group_ids[]:
          $ref: '#/components/schemas/groupId'
        source_language:
          $ref: '#/components/schemas/sourceLanguage'
        target_language:
          $ref: '#/components/schemas/targetLanguage'
        metadata[domain]:
          type: string
          example: legal
        metadata[subject]:
          type: string
          example: EU treaties
        metadata[client]:
          type: string
          example: Very Important Client
        metadata[project]:
          type: string
          example: 0192 EC Project
        metadata[description]:
          type: string
          example: created by DGT
    CreateEngine:
      type: object
      required:
        - name
        - source_language
        - target_language
        - group_id
        - resources
      properties:
        name:
          type: string
          example: Engine 1
        source_language:
          $ref: '#/components/schemas/sourceLanguage'
        target_language:
          $ref: '#/components/schemas/targetLanguage'
        group_id:
          $ref: '#/components/schemas/groupId'
        resources:
          $ref: '#/components/schemas/CreateEngineResources'
    CreateEngineResources:
      type: object
      required:
        - corpus_ids
      properties:
        corpus_ids:
          $ref: '#/components/schemas/CreateEngineResourcesCorpusIds'
        stock_corpora:
          type: boolean
          description: Whether or not to use available stock corpora for training the engine.
        stock_engine_id:
          $ref: '#/components/schemas/nullableStockEngineId'
    CreateEngineResourcesCorpusIds:
      type: object
      required:
        - core
      properties:
        core:
          type: array
          items:
            type: string
          example: [ '51fc7ea3fa889.b0027797', '54018363fa5c1.044227af' ]
        auxiliary:
          type: array
          items:
            type: string
          example: [ '5b04a7263fa509.77444794', '5b0412363fa5c1.c4354792' ]
    createdAt:
      description: Created timestamp in ISO 8601 format
      type: string
      example: "2017-08-30T04:34:26+00:00"
    dispatcherId:
      description: Segment-based translation dispatcher ID
      type: integer
      example: 1
    dispatcherRegion:
      type: string
      example: "europe-west1"
    dispatcherUrl:
      type: string
      example: "https://dispatcher-europe-west1-ja6vheawuq-ew.a.run.app"
    Engine:
      type: object
      required:
        - id
        - actions
        - counts
        - group_id
        - health
        - instance_ids
        - name
        - published
        - source_language
        - status
        - stock_corpora
        - stock_engine_id
        - target_language
        - uuid
        - version
      properties:
        id:
          $ref: '#/components/schemas/engineId'
        actions:
          $ref: '#/components/schemas/EngineActions'
        counts:
          $ref: '#/components/schemas/EngineCounts'
        group_id:
          $ref: '#/components/schemas/groupId'
        health:
          type: string
          nullable: true
          enum:
            - current
            - deprecated
            - supported
        instance_ids:
          type: array
          items:
            $ref: '#/components/schemas/numericalId'
        name:
          type: string
          example: Engine 1
        published:
          type: boolean
          example: true
        source_language:
          $ref: '#/components/schemas/sourceLanguage'
        status:
          $ref: '#/components/schemas/engineStatus'
        stock_corpora:
          type: boolean
          example: true
        stock_engine_id:
          $ref: '#/components/schemas/nullableStockEngineId'
        target_language:
          $ref: '#/components/schemas/targetLanguage'
        uuid:
          $ref: '#/components/schemas/uuid'
        version:
          type: string
          nullable: true
          example: 3.5.5
    EngineActions:
      type: object
      description: An object describing the actions possible against an engine.
      required:
        - delete
        - deploy
        - train
        - translate
        - tune
        - update
      properties:
        delete:
          type: boolean
        deploy:
          type: boolean
        train:
          type: boolean
        translate:
          type: boolean
        tune:
          type: boolean
        update:
          type: boolean
    EngineCollection:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Engine'
        meta:
          $ref: '#/components/schemas/CollectionMetadata'
    EngineCorpora:
      type: object
      description: An engine cannot contain more than 500 corpora in total.
      required:
        - core
        - auxiliary
        - stock
      properties:
        auxiliary:
          type: array
          items:
            $ref: '#/components/schemas/EngineCorpusIdWithVersion'
        core:
          type: array
          items:
            $ref: '#/components/schemas/EngineCorpusIdWithVersion'
        stock:
          type: boolean
    EngineCorpusIdWithVersion:
      type: object
      required:
        - id
        - version
      properties:
        id:
          $ref: '#/components/schemas/corpusId'
        version:
          $ref: '#/components/schemas/corpusVersion'
    EngineCounts:
      type: object
      required:
        - corpora
      properties:
        corpora:
          type: object
          required:
            - core
            - auxiliary
          properties:
            core:
              type: object
              properties:
                segment_count:
                  type: number
            auxiliary:
              type: object
              properties:
                segment_count:
                  type: number
    EngineEvent:
      allOf:
        - $ref: '#/components/schemas/Event'
        - type: object
          properties:
            error_code:
              $ref: '#/components/schemas/errorCode'
            resource_id:
              $ref: '#/components/schemas/engineId'
            type:
              type: string
              enum:
                - created
                - deleted
                - instance_deployment_failed
                - instance_deployment_finished
                - instance_deployment_started
                - instance_removal_failed
                - instance_removal_finished
                - instance_removal_started
                - instance_removal_started_by_billing
                - published
                - stock_engine_removed
                - training_cancelled
                - training_failed
                - training_finished
                - training_started
                - tuning_failed
                - tuning_finished
                - tuning_started
                - unpublished
                - updated
    EngineEventCollection:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/EngineEvent'
        meta:
          $ref: '#/components/schemas/CollectionMetadata'
    engineId:
      description: Engine ID
      type: integer
      example: 10
    EngineInstance:
      type: object
      required:
        - id
        - engine_id
        - dispatcher_url
        - status
      properties:
        id:
          $ref: '#/components/schemas/numericalId'
        engine_id:
          $ref: '#/components/schemas/engineId'
        dispatcher_url:
          $ref: '#/components/schemas/dispatcherUrl'
        status:
          $ref: '#/components/schemas/engineInstanceStatus'
    EngineInstanceCollection:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/EngineInstance'
        meta:
          $ref: '#/components/schemas/CollectionMetadata'
    engineInstanceStatus:
      type: string
      enum:
        - deploying
        - error_removal_engine_manager_internal_error
        - error_removal_engine_manager_rejected_request
        - error_removal
        - on
        - queued
        - removing
    EngineResources:
      type: object
      required:
        - corpora
        - stock_engine
      properties:
        corpora:
          $ref: '#/components/schemas/EngineResourcesCorpora'
        stock_engine:
          $ref: '#/components/schemas/StockEngine'
    EngineResourcesCorpora:
      type: object
      required:
        - current
        - trained
        - tuned
      properties:
        current:
          $ref: '#/components/schemas/EngineCorpora'
        trained:
          $ref: '#/components/schemas/EngineCorpora'
        tuned:
          type: array
          items:
            $ref: '#/components/schemas/EngineCorpusIdWithVersion'
    engineStatus:
      type: string
      enum:
        - changed
        - error
        - queued
        - trained
        - training
        - tuned
        - tuning
        - untrained
    Error:
      type: object
      properties:
        error:
          type: string
          example: "Error message."
      required:
        - error
    errorCode:
      type: integer
      nullable: true
      example: 104
    Event:
      type: object
      required:
        - id
        - resource_id
        - timestamp
        - type
        - user
      properties:
        id:
          $ref: '#/components/schemas/numericalId'
        timestamp:
          $ref: '#/components/schemas/timestamp'
        user:
          $ref: '#/components/schemas/EventUser'
    EventUser:
      type: object
      nullable: true
      required:
        - id
        - name
      properties:
        id:
          $ref: '#/components/schemas/userId'
        name:
          $ref: '#/components/schemas/userName'
    Group:
      type: object
      required:
        - id
        - name
      properties:
        id:
          $ref: '#/components/schemas/groupId'
        name:
          type: string
          example: Default
    GroupCollection:
      type: object
      required:
        - data
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Group'
    groupId:
      description: Group ID
      type: integer
      example: 2
    Language:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          example: en-us
    LanguageCollection:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Language'
        meta:
          $ref: '#/components/schemas/CollectionMetadata'
    nullableStockEngineId:
      description: Stock engine ID
      nullable: true
      type: integer
      example: 23
    numericalId:
      description: ID
      type: integer
      example: 10
    remoteCorpusId:
      description: The ID of the corpus on the CAT tool server.
      oneOf:
        - type: number
        - type: string
      example: "a6fd0c40-7b5c-48bf-89c2-629417b398cd"
    RemoteDispatcherCollection:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/RemoteDispatcher'
        meta:
          $ref: '#/components/schemas/CollectionMetadata'
    RemoteDispatcher:
      type: object
      required:
        - id
        - region
        - url
        - timestamps
      properties:
        id:
          $ref: '#/components/schemas/dispatcherId'
        region:
          $ref: '#/components/schemas/dispatcherRegion'
        url:
          $ref: '#/components/schemas/dispatcherUrl'
        timestamps:
          $ref: '#/components/schemas/RemoteDispatcherTimestamps'
    RemoteDispatcherTimestamps:
      type: object
      required:
        - created_at
        - updated_at
      properties:
        created_at:
          $ref: '#/components/schemas/createdAt'
        updated_at:
          $ref: '#/components/schemas/updatedAt'
    sourceLanguage:
      description: Source language code
      type: string
      example: en-us
    StockEngine:
      type: object
      required:
        - id
        - source_language
        - target_language
        - version
        - timestamps
      properties:
        id:
          $ref: '#/components/schemas/stockEngineId'
        source_language:
          $ref: '#/components/schemas/sourceLanguage'
        target_language:
          $ref: '#/components/schemas/targetLanguage'
        version:
          type: string
          example: 4.1.0
        timestamps:
          $ref: '#/components/schemas/StockEngineTimestamps'
    stockEngineId:
      description: Stock engine ID
      type: integer
      example: 5
    StockEngineTimestamps:
      type: object
      required:
        - created_at
      properties:
        created_at:
          $ref: '#/components/schemas/createdAt'
        updated_at:
          $ref: '#/components/schemas/updatedAt'
    targetLanguage:
      description: Target language code
      type: string
      example: it
    timestamp:
      description: Timestamp in ISO 8601 format
      type: string
      example: "2020-06-06T10:45:00+00:00"
    UpdateCorpus:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/corpusName'
        group_ids:
          $ref: '#/components/schemas/corpusGroupIds'
        metadata:
          $ref: '#/components/schemas/CorpusMetadata'
    UpdateCorpusContent:
      type: object
      required:
        - file
      properties:
        file:
          type: object
    updatedAt:
      description: Updated timestamp in ISO 8601 format
      type: string
      nullable: true
      example: "2017-08-30T04:34:26+00:00"
    UpdateEngine:
      type: object
      properties:
        name:
          type: string
          example: Engine 1
        published:
          type: boolean
          example: true
        resources:
          $ref: '#/components/schemas/UpdateEngineResources'
    UpdateEngineResources:
      type: object
      properties:
        corpus_ids:
          $ref: '#/components/schemas/UpdateEngineResourcesCorpusIds'
        stock_corpora:
          type: boolean
          description: Whether or not to use available stock corpora for training the engine.
    UpdateEngineResourcesCorpusIds:
      type: object
      properties:
        core:
          type: array
          items:
            type: string
          example: [ '51fc7ea3fa889.b0027797', '54018363fa5c1.044227af' ]
        auxiliary:
          type: array
          items:
            type: string
          example: [ '5b04a7263fa509.77444794', '5b0412363fa5c1.c4354792' ]
    userId:
      type: integer
      example: 5
    userName:
      type: string
      example: John Doe
    uuid:
      type: string
      example: "21cfda50-1944-46fc-901c-04a168ea6fee"