--- title: "Synthesize Text" slug: "tts-synthesize-text" description: "This reference explains how to convert text into natural-sounding speech using the TTS Synthesis API. Includes request structure, parameters, and examples for fast implementation." updated: 2024-05-28T20:35:50Z published: 2024-05-28T20:35:50Z canonical: "docs.sestek.com/tts-synthesize-text" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.sestek.com/llms.txt > Use this file to discover all available pages before exploring further. # Synthesize Text Allows you to synthesize text into spoken audio and retrieve the synthesized audio stream as an array of bytes. ## Endpoint Details - **URL:** `{{Address}}/v1/speech/synthesis/tts` - **HTTP Method:** `POST` - **HTTP Request:** `POST v1/speech/synthesis/tts` - **Summary:** Synthesizes text to spoken audio. - **Request:** JSON Format. ## Query Parameters (Optional) You have the option to query available voices based on culture and gender using query parameters. For example: - `{{Address}}/v1/speech/synthesis/voices/?language=tr-TR&gender=female` ## Request Fields Descriptions **Request:** - `Text`: The text to be synthesized (plain text). - `Name`: Speaker name. - `Volume`: The base volume (loudness) level of the voice. Range is 0.0-2.0. - `Rate`: The speaking rate of the voice. Range is 0.33-3.0. - `Format`: Audio output format. - `Sample Rate`: Audio output sample rate. - `Authorization`: Bearer token for licensing. ## Request Examples **Request Example for WAV File:** ``` { "Text": "Hello World", "Voice": { "Name": "Emily", "Volume": 1.0, "Rate": 1.0 }, "Audio": { "Format": "wav", "FormatDetails": { "Encoding": "pcm", "SampleRate": "8000" } } } ``` **Request Example for Opus File:** ``` { "Text": "Hello World", "Voice": { "Name": "Emily", "Volume": 1.0, "Rate": 1.0 }, "Audio": { "Format": "opus", "FormatDetails": { "BitRateKbps": "8", "SampleRate": "8000" }, } ``` ## Response The response returns the audio stream for the specified text as an array of bytes in the specified MIME type: WAV, Opus, MP3, FLV. ## Response Codes | Status | Description | | --- | --- | | 200 OK | The request succeeded. | | 500 Internal Server Error | The service experienced an internal error. | | 400 Bad Request | Required request parameter value is not valid or not supported. | | 404 Not Found | Requested voice is not found. | | 412 Precondition Failed | Cloud License parameters are invalid or requested voice is not licensed or license credits are consumed completely. | | 422 Unprocessable Entity | Bit rate or sample rate is invalid, or an 8k voice is requested instead of a 16k voice. | **Failure Response Example:** ``` { "errorCode": "http-404", "errorMessage": "Unknown voice name", "moreInfo": "", "success": false } ```