Method: text.synthesize
Stay organized with collections
Save and categorize content based on your preferences.
Synthesizes speech synchronously: receive results after all text input has been processed.
HTTP request
POST https://texttospeech.googleapis.com/v1/text:synthesize
The URL uses gRPC Transcoding
syntax.
Request body
The request body contains data with the following structure:
Fields |
input
|
object ( SynthesisInput
)
Required. The Synthesizer requires either plain text or SSML as input.
|
voice
|
object ( VoiceSelectionParams
)
Required. The desired voice of the synthesized audio.
|
audioConfig
|
object ( AudioConfig
)
Required. The configuration of the synthesized audio.
|
advancedVoiceOptions
|
object ( AdvancedVoiceOptions
)
Advanced voice options.
|
Response body
The message returned to the client by the text.synthesize
method.
If successful, the response body contains data with the following structure:
Fields |
audioContent
|
string ( bytes
format)
The audio data bytes encoded as specified in the request, including the header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). For LINEAR16 audio, we include the WAV header. Note: as with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64.
A base64-encoded string.
|
Authorization scopes
Requires the following OAuth scope:
-
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview
.
AdvancedVoiceOptions
Used for advanced voice options.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-27 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-27 UTC."],[],[],null,["# Method: text.synthesize\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.SynthesizeSpeechResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [AdvancedVoiceOptions](#AdvancedVoiceOptions)\n - [JSON representation](#AdvancedVoiceOptions.SCHEMA_REPRESENTATION)\n- [Try it!](#try-it)\n\nSynthesizes speech synchronously: receive results after all text input has been processed.\n\n### HTTP request\n\n`POST https://texttospeech.googleapis.com/v1/text:synthesize`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nThe message returned to the client by the `text.synthesize` method.\n\nIf successful, the response body contains data with the following structure:\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp).\n\nAdvancedVoiceOptions\n--------------------\n\nUsed for advanced voice options."]]