> ## Documentation Index
> Fetch the complete documentation index at: https://support.lilt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Translate a segment

> Translate a source string.

Setting the `rich` parameter to `true` will change the response format
to include additional information about each translation including a
model score, word alignments,  and formatting information. The rich
format can be seen in the example response on this page.

By default, this endpoint also returns translation memory (TM) fuzzy matches, along
with associated scores. Fuzzy matches always appear ahead of machine translation
output in the response.

The maximum source length is 5,000 characters.

Usage charges apply to this endpoint for production API keys.





## OpenAPI

````yaml /api-reference/openapi-bundled.yaml post /v2/translate
openapi: 3.0.3
info:
  title: LILT API
  description: >
    LILT API Support: https://lilt.atlassian.net/servicedesk/customer/portals


    The LILT API enables programmatic access to the full-range of LILT backend
    services including:
      * Training of and translating with interactive, adaptive machine translation
      * Large-scale translation memory
      * The Lexicon (a large-scale termbase)
      * Programmatic control of the LILT CAT environment
      * Translation memory synchronization


    Requests and responses are in JSON format. The REST API only responds to
    HTTPS / SSL requests.


    The base url for this REST API is `https://api.lilt.com/`.


    ## Authentication


    Requests are authenticated via API key, which requires the Business plan.


    Requests are authenticated using [HTTP Basic
    Auth](https://en.wikipedia.org/wiki/Basic_access_authentication). Add your
    API key as both the `username` and `password`.


    For development, you may also pass the API key via the `key` query
    parameter. This is less secure than HTTP Basic Auth, and is not recommended
    for production use.


    ## Quotas


    Our services have a general quota of 4000 requests per minute. Should you
    hit the maximum requests per minute, you will need to wait 60 seconds before
    you can send another request.
  version: v3.0.3
  license:
    name: LILT Platform Terms and Conditions
    url: https://lilt.com/lilt-platform-terms-and-conditions
servers:
  - url: https://api.lilt.com
security:
  - BasicAuth: []
  - ApiKeyAuth: []
paths:
  /v2/translate:
    post:
      tags:
        - Translate
      summary: Translate a segment
      description: >+
        Translate a source string.


        Setting the `rich` parameter to `true` will change the response format

        to include additional information about each translation including a

        model score, word alignments,  and formatting information. The rich

        format can be seen in the example response on this page.


        By default, this endpoint also returns translation memory (TM) fuzzy
        matches, along

        with associated scores. Fuzzy matches always appear ahead of machine
        translation

        output in the response.


        The maximum source length is 5,000 characters.


        Usage charges apply to this endpoint for production API keys.

      operationId: translateSegmentPost
      requestBody:
        content:
          application/json:
            schema:
              title: TranslateSegmentBody
              required:
                - memory_id
              type: object
              properties:
                source:
                  type: string
                  description: A unique Segment identifier.
                memory_id:
                  type: integer
                  description: A unique Memory identifier.
                source_hash:
                  type: integer
                  description: A source hash code.
                'n':
                  type: integer
                  description: Return top n translations (deprecated).
                prefix:
                  type: string
                  description: A target prefix
                rich:
                  type: boolean
                  description: >-
                    Returns rich translation information (e.g., with word
                    alignments).
                  default: false
                tm_matches:
                  type: boolean
                  description: Include translation memory fuzzy matches.
                  default: true
                project_tags:
                  type: boolean
                  description: >-
                    Project tags. Projects tags in source to target if set to
                    true.
                  default: false
                containsICUData:
                  type: boolean
                  description: >-
                    Contains ICU data. If true then tags in the source following
                    the ICU standard will be parsed and retained.
                  default: false
        required: false
      responses:
        '200':
          description: A TranslationList object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TranslationList'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    TranslationList:
      type: object
      properties:
        untokenizedSource:
          type: string
          description: >-
            The untokenized source segment. Punctuation has not been separated
            from words.
          example: Authentication not required.
        tokenizedSource:
          type: string
          description: >-
            The tokenized source segment. Punctuation has been separated from
            words.
          example: Authentication not required .
        sourceDelimiters:
          type: array
          description: >-
            A format string that indicates, for each word, if the word should be
            preceded by a space.
          example:
            - ''
            - ' '
            - ' '
            - ''
            - ''
          items:
            type: string
        translation:
          type: array
          description: A list of Translation objects.
          items:
            $ref: '#/components/schemas/Translation'
      description: An ranked list of translations and associated metadata.
    Error:
      type: object
      properties:
        message:
          type: string
          description: A human-readable message describing the error.
      description: |
        Response in the event of an unexpected error.
      example:
        message: Internal server error.
    Translation:
      type: object
      properties:
        target:
          type: string
          description: The target string.
        targetWithTags:
          type: string
          description: The target string with source tags projected into the target.
        align:
          type: string
          description: >
            "MT only: A whitespace delimited list of source-target alignment
            indices."
        provenance:
          type: string
          description: >
            Positive values indicate that the word is from the Memory,

            with contiguous identical entries (e.g., 2 2) indicating

            phrase matches. Negative contiguous values indicate entries from the
            Lexicon.

            0 indicates a word from the background data.
        score:
          type: number
          description: The score of the translation.
        isTMMatch:
          type: boolean
          description: 'TM only: If true, indicates an exact translation memory match.'
        targetDelimiters:
          type: array
          description: >-
            A format string that indicates, for each word, if the word should be
            preceded by a space.
          items:
            type: string
        targetWords:
          type: array
          description: >
            The target string can be constructed by suffixing each
            `targetDelimiters` entry with its corresponding word in
            `targetWords` and concatenating the constructed array.

            Please note that the `targetDelimiters` array has one more entry
            than `targetWords` array which is why the last entry in the array
            will be the last value of `targetDelimiters`.
          items:
            type: string
      description: >-
        A machine translation (MT) or a translation memory (TM) match of a
        source segment.
      example:
        - score: 3.4936864e-8
          align: 0-0 1-1 2-2 3-3
          targetDelimiters:
            - ''
            - ' '
            - ' '
            - ''
            - ''
          targetWords:
            - Authentifizierung
            - nicht
            - erforderlich
            - .
          target: Authentifizierung nicht erforderlich .
          targetWithTags: Authentifizierung nicht erforderlich.
          isTMMatch: false
          provenance: 0 0 0 0
  responses:
    UnauthorizedError:
      description: Unauthorized
      content:
        application/octet-stream:
          schema:
            type: string
        text/plain:
          schema:
            type: string
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
    ApiKeyAuth:
      type: apiKey
      name: key
      in: query

````