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 SpeechKit
  • SpeechKit technology overview
    • Speech recognition using Playground
    • Speech synthesis using Playground
      • Speech synthesis in the API v3
      • Speech synthesis in REST API v3
      • Pattern-based speech synthesis
      • Brand Voice Call Center pattern-based speech synthesis
      • Speech synthesis in WAV format, API v1
      • Speech synthesis in OggOpus format, API v1
      • Speech synthesis from SSML text, API v1
  • Supported audio formats
  • IVR integration
  • Quotas and limits
  • Access management
  • Pricing policy
  1. Step-by-step guides
  2. Speech synthesis
  3. Speech synthesis in REST API v3

Speech synthesis in the REST API v3

Written by
Yandex Cloud
Updated at April 21, 2025

You can use the REST API v3 in SpeechKit to synthesize speech if you do not need the benefits of the gRPC API.

The example uses the following synthesis parameters:

  • Voice: marina
  • Role: friendly
  • Audio format: WAV (default)

Authentication takes place under a Yandex account or a federated account using an IAM token. Authentication requires the ID of the folder in which the user has the ai.speechkit-tts.user role to work with SpeechKit. If using a service account, you do not need to include the folder ID in the request. To learn more about SpeechKit API authentication, see Authentication with the SpeechKit API.

cURL

To reproduce this example, you will need the jq utility to work with JSON files.

  1. Create the request.json file with the following request parameters:

    {"text": "Hi! I'm Yandex Speech+Kit. I can turn any text into speech. Now y+ou can, too!", "hints": [{"voice": "marina"}, {"role": "friendly"}]}
    

    Where:

    • text: Text to synthesize
    • hints: List of synthesis parameters:
      • voice: Voice for synthesis
      • role: Role
  2. Run the request in the terminal by specifying the IAM token and the ID of the folder you will use to work with SpeechKit:

    export FOLDER_ID=<folder_ID>
    export IAM_TOKEN=<IAM_token>
    
    curl \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "x-folder-id: $FOLDER_ID" \
      --data @request.json https://tts.api.cloud.yandex.net:443/tts/v3/utteranceSynthesis | \
      jq -r  '.result.audioChunk.data' | \
      while read chunk; do base64 -d <<< "$chunk" >> audio.wav; done
    

    Where:

    • FOLDER_ID is the ID of the folder for which your account has the ai.speechkit-tts.user role or higher. If using a service account, you do not need to include the folder ID in the request.
    • IAM_TOKEN: IAM token of your Yandex account or federated account.

    The synthesized speech will be Base64 encoded and saved to a file named audio.wav.

Was the article helpful?

Previous
Speech synthesis in the API v3
Next
Pattern-based speech synthesis
Yandex project
© 2025 Yandex.Cloud LLC