Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Translate
  • Getting started
  • Step-by-step instructions
    • All instructions
    • How to translate text
    • How to improve the accuracy of translations
    • Detecting language
    • Getting a list of supported languages
  • Concepts
    • Overview
    • Retraining models
    • Glossaries
    • Glossary support
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • TranslationService
    • REST
      • v2
        • Handling errors
        • Troubleshooting
        • Overview
        • Translation
          • Overview
          • detectLanguage
          • listLanguages
          • translate
      • v1 (DEPRECATED)
        • Overview
        • How to translate text
        • Detecting language
        • List of supported languages
        • Response format
  • Quotas and limits
  • Access management
  • Pricing policy
    • Current pricing policy
    • Archive
      • Policy before January 1, 2019
  • Questions and answers
  1. API reference
  2. REST
  3. v1 (DEPRECATED)
  4. Detecting language

Detecting language

  • Request
    • Parameters in the request body
  • Response
  • Examples
    • Sample request
    • Response example

Warning

Support for v1 is discontinued as of February 2019. The methods listed below will be deprecated. Please use v2.

Detects the language of the source text. The response is returned as the language code.

Request

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

Parameters in the request body

All parameters must be URL-encoded. The maximum size of the POST request body is 30 KB.

Parameter Description
text Required parameter.
UTF-8 encoded text to detect the language of.
hint List of most probable languages (they will be given priority when detecting the language). The list items are comma-separated.
folderId Required parameter.
ID of your folder.
Learn more about how to find out the folder ID.

Response

The response is returned in JSON format.

{
    "language": <code of the language the text is in>
}

Examples

Sample request

export FOLDER_ID=<folder id>
export TOKEN=<IAM-token>
curl -X POST \
     -H "Authorization: Bearer ${TOKEN}" \
     -d "folderId=${FOLDER_ID}" \
     --data-urlencode "text=Hello world" \
     "https://translate.api.cloud.yandex.net/translate/v1/detect"

Response example

The response is returned in JSON format.

{
    "language": "en"
}
In this article:
  • Request
  • Parameters in the request body
  • Response
  • Examples
  • Sample request
  • Response example
Language
Careers
Privacy policy
Terms of use
© 2021 Yandex.Cloud LLC