Method translate

Translates the text to the specified language.

HTTP request

POST https://translate.api.cloud.yandex.net/translate/v2/translate

Body parameters

{
  "sourceLanguageCode": "string",
  "targetLanguageCode": "string",
  "format": "string",
  "texts": [
    "string"
  ],
  "folderId": "string",
  "model": "string"
}
Field Description
sourceLanguageCode string

The text language to translate from. Specified in ISO 639-1 format (for example, ru).

The maximum string length in characters is 3.

targetLanguageCode string

Required. The target language to translate the text. Specified in ISO 639-1 format (for example, en).

The maximum string length in characters is 3.

format string

Format of the text.

  • PLAIN_TEXT: Text without markup. Default value.
  • HTML: Text in the HTML format.
texts[] string

Required. Array of the strings to translate. The maximum total length of all strings is 10000 characters.

Must contain at least one element.

folderId string

ID of the folder to which you have access. Required for authorization with a user account (see UserAccount resource). Don't specify this field if you make the request on behalf of a service account.

The maximum string length in characters is 50.

model string

Do not specify this field, custom models are not supported yet.

The maximum string length in characters is 50.

Response

HTTP Code: 200 - OK

{
  "translations": [
    {
      "text": "string",
      "detectedLanguageCode": "string"
    }
  ]
}
Field Description
translations[] object

Array of the translations.

translations[].
text
string

Translated text.

translations[].
detectedLanguageCode
string

The language code of the source text. Specified in ISO 639-1 format (for example, en).