Translate text
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 /v2/translate call to get it translated back.
- Run the
GET /v2/languages/text-translationendpoint to check the selected source/target language is supported. - 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-United Kingdom (en-GB) to German-Germany (de-DE):
{ "source": "en-GB", "target": "de-DE", "segments": [{ "text": "Hello from LanguageWire!" }] }
This request would return a response similar to:
{ "translations": [{ "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 BCP-47 — REQUIREDPossible values: 2 ≤ length ≤ 25 Source language code | |
target BCP-47 — REQUIREDPossible values: 2 ≤ length ≤ 25 Target language code | |
segments object[] — REQUIREDA list of segments containing text in the source language to translate into the target language. 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 | |||
|---|---|---|---|
200Successful response
| |||
401The 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.
| |||
403The request requires higher privileges than provided by the access token. The request should not be retried.
| |||
422Unsupported language pair
| |||
429Too many requests in the time interval
| |||
500Internal server error
|