Translate text
Translates text to the specified language.
- In this section:
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/translate
? key=<API key>
& text=<text to translate>
& lang=<translation direction>
& [format=<text format>]
& [options=<translation options>]
& [callback=<name of the callback function>]
Query parameters | |
key * | API key. It is issued free of charge. |
text * | The text to translate. You can use multiple Attention. The source text must be URL-encoded. Restrictions:
|
lang * | The translation direction. You can set it in either of the following ways:
|
format | Text format. Possible values:
|
options | The only option available at this time is whether the response should include the automatically detected language of the text being translated. This corresponds to the value If the language of the text being translated is defined explicitly, meaning the |
callback | The name of the callback function. Use for getting a JSONP response. |
Query parameters | |
key * | API key. It is issued free of charge. |
text * | The text to translate. You can use multiple Attention. The source text must be URL-encoded. Restrictions:
|
lang * | The translation direction. You can set it in either of the following ways:
|
format | Text format. Possible values:
|
options | The only option available at this time is whether the response should include the automatically detected language of the text being translated. This corresponds to the value If the language of the text being translated is defined explicitly, meaning the |
callback | The name of the callback function. Use for getting a JSONP response. |
* Required
POST /api/v1.5/tr.json/translate?lang=en-ru&key=API-KEY HTTP/1.1
Host: translate.yandex.net
Accept: */*
Content-Length: 17
Content-Type: application/x-www-form-urlencoded
text=Hello World!
XML interface
The response is returned in XML format.
Request syntax
https://translate.yandex.net/api/v1.5/tr/translate
? key=<API key>
& text=<text to translate>
& lang=<translation direction>
& [format=<text format>]
& [options=<translation options>]
Query parameters | |
key * | API key. It is issued free of charge. |
text * | The text to translate. You can use multiple Attention. The source text must be URL-encoded. Restrictions:
|
lang * | The translation direction. You can set it in either of the following ways:
|
format | Text format. Possible values:
|
options | The only option available at this time is whether the response should include the automatically detected language of the text being translated. This corresponds to the value If the language of the text being translated is defined explicitly, meaning the |
Query parameters | |
key * | API key. It is issued free of charge. |
text * | The text to translate. You can use multiple Attention. The source text must be URL-encoded. Restrictions:
|
lang * | The translation direction. You can set it in either of the following ways:
|
format | Text format. Possible values:
|
options | The only option available at this time is whether the response should include the automatically detected language of the text being translated. This corresponds to the value If the language of the text being translated is defined explicitly, meaning the |
* Required
POST /api/v1.5/tr/translate?lang=en-ru&key=API-KEY HTTP/1.1
Host: translate.yandex.net
Accept: */*
Content-Length: 17
Content-Type: application/x-www-form-urlencoded
text=Hello World!
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 |
413 | Exceeded the maximum text size |
422 | The text cannot be translated |
501 | The specified translation direction is not supported |
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 |
413 | Exceeded the maximum text size |
422 | The text cannot be translated |
501 | The specified translation direction is not supported |