Detect the language

Detects the language of the specified text.

In this section:

The response is returned as the language code. To define the language name by its code, use the Get the list of supported languages operation and set the ui parameter when calling.

JSON and JSONP interfaces

The response is returned in JSON format. If the callback parameter is set, the JSON object is wrapped in a function with the name specified in this parameter (JSONP).

Request syntax

https://translate.yandex.net/api/v1.5/tr.json/detect
 ? key=<API key>
 & text=<text>
 & [hint=<list of probable text languages>]
 & [callback=<name of the callback function>]
Query parameters
key *

API key. It is issued free of charge.

text *

The text to detect the language for.

Attention. The source text must be URL-encoded.
hint

A list of the most likely languages (they will be given preference when detecting the text language). Use the comma as a separator.

callbackThe name of the callback function. Use for getting a JSONP response.

*  Required

Note. All special characters must be escaped.

XML interface

The response is returned in XML format.

Request syntax

https://translate.yandex.net/api/v1.5/tr/detect
 ? key=<API key>
 & text=<text>
 & hint=<list of probable text languages>
Query parameters
key *

API key. It is issued free of charge.

text *

The text to detect the language for.

Attention. The source text must be URL-encoded.
hint *

A list of the most likely languages (they will be given preference when detecting the text language). Use the comma as a separator.

*  Required

Note. All special characters must be escaped.

Response codes

Explanations of possible response codes.

Value Description
200

Operation completed successfully

401

Invalid API key

402

Blocked API key

404

Exceeded the daily limit on the amount of translated text