Method detectLanguage

Detects the language of the text.

HTTP request

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

Body parameters

{
  "text": "string",
  "languageCodeHints": [
    "string"
  ],
  "folderId": "string"
}
Field Description
text string

Required. The text to detect the language for.

The maximum string length in characters is 1000.

languageCodeHints[] string

List of the most likely languages. These languages will be given preference when detecting the text language. Specified in ISO 639-1 format (for example, ru).

To get the list of supported languages, use a listLanguages request.

The maximum number of elements is 10. The maximum string length in characters for each value is 3.

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.

Response

HTTP Code: 200 - OK

{
  "languageCode": "string"
}
Field Description
languageCode string

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

To get the language name, use a listLanguages request.