Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Translate
  • Getting started
  • Access management

In this article:

  • Getting started
  • Translating text

Getting started with Translate

Written by
Yandex Cloud
Updated at April 21, 2025
  • Getting started
  • Translating text

Yandex Translate provides an API for integrating translation technologies into your applications. If you want to use a UI for translation, use Yandex Translator.

In this section, you will learn how to translate text using the Translate API.

To use the examples, install cURL.

Refer to the step-by-step guides for more examples in different programming languages.

To learn how to create a service account and an API key to integrate Yandex Translate into your application, see Setting up access with API keys.

Getting startedGetting started

  1. On the Billing page, make sure you have a billing account that is either ACTIVE or TRIAL_ACTIVE. If you do not have a billing account yet, create one.

  2. To authenticate under a service account, you can use an API key or an IAM token; to authenticate under a user account, you can only use an IAM token.

    Get your account details for authentication in the Translate API:

    API key
    IAM token
    1. If you do not have a service account, create one.

    2. Assign the ai.translate.user role for the folder to the service account.

    3. Get the ID of the folder your service account was created in. Make sure to include the folder ID in the folderId field in the body of each request.

    4. Create an API key with the yc.ai.translate.execute scope.

      Provide the key in the Authorization header of each request in the following format:

      Authorization: Api-Key <API_key>
      
    1. Get the ID of any folder for which your account has the ai.translate.user role or higher. Make sure to include the folder ID in the folderId field in the body of each request.

    2. Get an IAM token for your Yandex account, federated account or service account.

      Provide the token in the Authorization header of each request in the following format:

      Authorization: Bearer <IAM_token>
      

Translating textTranslating text

cURL

The example below is intended to be run in MacOS and Linux. To run it in Windows, see how to work with Bash in Microsoft Windows.

This example shows how to translate two strings containing Hello and World into Russian. The text source language is recognized automatically.

  1. Create a file with the request body, e.g., body.json:

    {
        "folderId": "<folder_ID>",
        "texts": ["Hello", "World"],
        "targetLanguageCode": "ru"
    }
    

    Where:

    • folderId: Folder ID you got before you started.
    • texts: Text to translate, as a list of strings.
    • targetLanguageCode: Target language. You can get the language code together with a list of supported languages.
  2. Submit the file for translation by running the command:

    export API_KEY=<API_key>
    curl \
      --request POST \
      --header "Content-Type: application/json" \
      --header "Authorization: Api-Key ${API_KEY}" \
      --data '@<path_to_JSON_file>' \
      "https://translate.api.cloud.yandex.net/translate/v2/translate"
    

    Where API_KEY is the API key you got before you started. If you use an IAM token for authentication, change the Authorization header to "Authorization: Bearer <IAM_token>".

    The service will return the translated strings:

    {
        "translations": [
            {
            "text": "Привет",
            "detectedLanguageCode": "en"
            },
            {
            "text": "Мир",
            "detectedLanguageCode": "en"
            }
        ]
    }
    

What's nextWhat's next

  • Learn more about the service
  • See other examples
  • Learn about API authentication methods

Was the article helpful?

Next
All guides
Yandex project
© 2025 Yandex.Cloud LLC