---
title: "Translate a segment"
method: POST
path: "/v2/translate"
tags: ["Translate"]
---

# Translate a segment

`POST /v2/translate`

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.

## Request body

- object
  - `source` string — A unique Segment identifier.
  - `memory_id` integer, required — A unique Memory identifier.
  - `source_hash` integer — A source hash code.
  - `n` integer — Return top n translations (deprecated).
  - `prefix` string — A target prefix
  - `rich` boolean — Returns rich translation information (e.g., with word alignments).
  - `tm_matches` boolean — Include translation memory fuzzy matches.
  - `project_tags` boolean — Project tags. Projects tags in source to target if set to true.
  - `containsICUData` boolean — Contains ICU data. If true then tags in the source following the ICU standard will be parsed and retained.

## Response `200`

A TranslationList object.

- TranslationList — An ranked list of translations and associated metadata.
  - `untokenizedSource` string — The untokenized source segment. Punctuation has not been separated from words.
  - `tokenizedSource` string — The tokenized source segment. Punctuation has been separated from words.
  - `sourceDelimiters` string[] — A format string that indicates, for each word, if the word should be preceded by a space.
  - `translation` Translation[] — A list of Translation objects.
    - `target` string — The target string.
    - `targetWithTags` string — The target string with source tags projected into the target.
    - `align` string — "MT only: A whitespace delimited list of source-target alignment indices."
    - `provenance` string — 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` number — The score of the translation.
    - `isTMMatch` boolean — TM only: If true, indicates an exact translation memory match.
    - `targetDelimiters` string[] — A format string that indicates, for each word, if the word should be preceded by a space.
    - `targetWords` string[] — 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`.

## Other responses

- `401` — Unauthorized
- `default` — Unexpected error

---

[API](https://skmtc.net/lilt/apis/lilt-api.md) · [All operations](https://skmtc.net/lilt/apis/lilt-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lilt/lilt-api/revisions/444772351ac3/schema)
