Skip to main content

Translate text

deprecated

This endpoint has been deprecated and may be removed in future versions of the API.

Use this call to translate a list of segments with text from a given source language to the defined target language. You should add your text directly to the POST /v1/translate call to get it translated back.

Tip: Before sending the text
  • Run the GET /v1/languages endpoint to check the selected source/target language is supported by MT API.
  • Pay special attention to the direction (source-target) of the language pair codes.
  • Check the Text management guide for restrictions and recommendations.


Example of a translate text request:
For a call requesting a translation of the text "Hello from LanguageWire!" using the model English (en) to German (de):

{ "source": "en", "target": "de", "segments": ["Hello from LanguageWire!"] }

This request would return a response similar to:

[{ "translation": "Hallo von LanguageWire!" }]

The response is returned in a synchronous manner. This means that if the source text is longer or more segments are submitted, it will take longer to receive a response.


Request Body REQUIRED
source REQUIRED

Source language code. If the field is not provided or is set to null, the result of language detection will be used as the source language.

target BCP-47 REQUIRED

Possible values: 2 ≤ length ≤ 25

Target language code

segments string[] REQUIRED

Possible values: length ≤ 10000

A list of segments containing text in the source language to translate into the target language.
A segment ideally contains a single sentence, but you can send multiple sentences as a single segment too.
Each segment can contain at most 10,000 characters.
A maximum of 100 segments is allowed to be translated at once.

Note

The cumulative length of the text in all segments must not exceed 10,000 characters. See more details about allowed size and text recommendations in the text management guide.

Responses
200

Successful response

Schema OPTIONAL
object[]
translation Translation

The translation of the source text to the target language.

detected_source_language BCP-47

Possible values: 2 ≤ length ≤ 25

The language code of the detected language of the source text.

400

Unsupported language pair

Schema OPTIONAL
detail Detail

Unsupported language pair

detected_source_language BCP-47

Possible values: 2 ≤ length ≤ 25

To identify languages, we use the RFC 4646 conventions. Example of language codes: da (Danish), pt-PT (Portuguese Portugal).

  • Currently, we don't support extensions or private tags.
  • Refer to the Standards guide for more details on language tags.
401

The access token provided is missing, expired, revoked, malformed, or invalid for other reasons. The client MAY request a new access token and retry the protected resource request.

Schema OPTIONAL
detail Detail

A generic JSON value, typically a string describing the error.

403

The request requires higher privileges than provided by the access token. The request should not be retried.

Schema OPTIONAL
detail Detail

A generic JSON value, typically a string describing the error.

422

Validation error

Schema OPTIONAL
detail object[] OPTIONAL
loc undefined[]
msg Message
type Error Type
429

Too many requests in the time interval

Schema OPTIONAL
detail Detail

A generic JSON value, typically a string describing the error.