---
title: "POST /v1/text:synthesize"
method: POST
path: "/v1/text:synthesize"
tags: ["text"]
---

# POST /v1/text:synthesize

`POST /v1/text:synthesize`

Synthesizes speech synchronously: receive results after all text input has been processed.

## Request body

- SynthesizeSpeechRequest — The top-level message sent by the client for the `SynthesizeSpeech` method.
  - `input` SynthesisInput — Contains text input to be synthesized. Either `text` or `ssml` must be supplied. Supplying both or neither returns google.rpc.Code.INVALID_ARGUMENT. The input size is limited to 5000 bytes.
    - `text` string — The raw text to be synthesized.
    - `markup` string — Markup for Chirp 3: HD voices specifically. This field may not be used with any other voices.
    - `ssml` string — The SSML document to be synthesized. The SSML document must be valid and well-formed. Otherwise the RPC will fail and return google.rpc.Code.INVALID_ARGUMENT. For more information, see [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
    - `multiSpeakerMarkup` MultiSpeakerMarkup — A collection of turns for multi-speaker synthesis.
      - `turns` Turn[] — Required. Speaker turns.
        - `speaker` string — Required. The speaker of the turn, for example, 'O' or 'Q'. Please refer to documentation for available speakers.
        - `text` string — Required. The text to speak.
    - `prompt` string — This system instruction is supported only for controllable/promptable voice models. If this system instruction is used, we pass the unedited text to Gemini-TTS. Otherwise, a default system instruction is used. AI Studio calls this system instruction, Style Instructions.
    - `customPronunciations` CustomPronunciations — A collection of pronunciation customizations.
      - `pronunciations` CustomPronunciationParams[] — The pronunciation customizations are applied.
        - `phrase` string — The phrase to which the customization is applied. The phrase can be multiple words, such as proper nouns, but shouldn't span the length of the sentence.
        - `phoneticEncoding` 'PHONETIC_ENCODING_UNSPECIFIED' | 'PHONETIC_ENCODING_IPA' | 'PHONETIC_ENCODING_X_SAMPA' | 'PHONETIC_ENCODING_JAPANESE_YOMIGANA' | 'PHONETIC_ENCODING_PINYIN' — The phonetic encoding of the phrase.
        - `pronunciation` string — The pronunciation of the phrase. This must be in the phonetic encoding specified above.
  - `voice` VoiceSelectionParams — Description of which voice to use for a synthesis request.
    - `languageCode` string — Required. The language (and potentially also the region) of the voice expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag, e.g. "en-US". This should not include a script tag (e.g. use "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred from the input provided in the SynthesisInput. The TTS service will use this parameter to help choose an appropriate voice. Note that the TTS service may choose a voice with a slightly different language code than the one selected; it may substitute a different region (e.g. using en-US rather than en-CA if there isn't a Canadian voice available), or even a different language, e.g. using "nb" (Norwegian Bokmal) instead of "no" (Norwegian)".
    - `name` string — The name of the voice. If both the name and the gender are not set, the service will choose a voice based on the other parameters such as language_code.
    - `ssmlGender` 'SSML_VOICE_GENDER_UNSPECIFIED' | 'MALE' | 'FEMALE' | 'NEUTRAL' — The preferred gender of the voice. If not set, the service will choose a voice based on the other parameters such as language_code and name. Note that this is only a preference, not requirement; if a voice of the appropriate gender is not available, the synthesizer should substitute a voice with a different gender rather than failing the request.
    - `customVoice` CustomVoiceParams — Description of the custom voice to be synthesized.
      - `model` string — Required. The name of the AutoML model that synthesizes the custom voice.
      - `reportedUsage` 'REPORTED_USAGE_UNSPECIFIED' | 'REALTIME' | 'OFFLINE' — Optional. Deprecated. The usage of the synthesized audio to be reported.
    - `voiceClone` VoiceCloneParams — The configuration of Voice Clone feature.
      - `voiceCloningKey` string — Required. Created by GenerateVoiceCloningKey.
    - `modelName` string — Optional. The name of the model. If set, the service will choose the model matching the specified configuration.
    - `multiSpeakerVoiceConfig` MultiSpeakerVoiceConfig — Configuration for a multi-speaker text-to-speech setup. Enables the use of up to two distinct voices in a single synthesis request.
      - `speakerVoiceConfigs` MultispeakerPrebuiltVoice[] — Required. A list of configurations for the voices of the speakers. Exactly two speaker voice configurations must be provided.
        - `speakerAlias` string — Required. The speaker alias of the voice. This is the user-chosen speaker name that is used in the multispeaker text input, such as "Speaker1".
        - `speakerId` string — Required. The speaker ID of the voice. See https://cloud.google.com/text-to-speech/docs/gemini-tts#voice_options for available values.
  - `audioConfig` AudioConfig — Description of audio data to be synthesized.
    - `audioEncoding` 'AUDIO_ENCODING_UNSPECIFIED' | 'LINEAR16' | 'MP3' | 'OGG_OPUS' | 'MULAW' | 'ALAW' | 'PCM' | 'M4A' — Required. The format of the audio byte stream.
    - `speakingRate` number, double — Optional. Input only. Speaking rate/speed, in the range [0.25, 2.0]. 1.0 is the normal native speed supported by the specific voice. 2.0 is twice as fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any other values < 0.25 or > 2.0 will return an error.
    - `pitch` number, double — Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 semitones from the original pitch. -20 means decrease 20 semitones from the original pitch.
    - `volumeGainDb` number, double — Optional. Input only. Volume gain (in dB) of the normal native volume supported by the specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) will play at approximately half the amplitude of the normal native signal amplitude. A value of +6.0 (dB) will play at approximately twice the amplitude of the normal native signal amplitude. Strongly recommend not to exceed +10 (dB) as there's usually no effective increase in loudness for any value greater than that.
    - `sampleRateHertz` integer — Optional. The synthesis sample rate (in hertz) for this audio. When this is specified in SynthesizeSpeechRequest, if this is different from the voice's natural sample rate, then the synthesizer will honor this request by converting to the desired sample rate (which might result in worse audio quality), unless the specified sample rate is not supported for the encoding chosen, in which case it will fail the request and return google.rpc.Code.INVALID_ARGUMENT.
    - `effectsProfileId` string[] — Optional. Input only. An identifier which selects 'audio effects' profiles that are applied on (post synthesized) text to speech. Effects are applied on top of each other in the order they are given. See [audio profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for current supported profile ids.
  - `advancedVoiceOptions` AdvancedVoiceOptions — Used for advanced voice options.
    - `lowLatencyJourneySynthesis` boolean — Only for Journey voices. If false, the synthesis is context aware and has a higher latency.
    - `relaxSafetyFilters` boolean — Optional. Input only. Deprecated, use safety_settings instead. If true, relaxes safety filters for Gemini TTS.
    - `safetySettings` SafetySettings — Safety settings for the request.
      - `settings` SafetySetting[] — The safety settings for the request.
        - `category` 'HARM_CATEGORY_UNSPECIFIED' | 'HARM_CATEGORY_HATE_SPEECH' | 'HARM_CATEGORY_DANGEROUS_CONTENT' | 'HARM_CATEGORY_HARASSMENT' | 'HARM_CATEGORY_SEXUALLY_EXPLICIT' — The harm category to apply the safety setting to.
        - `threshold` 'HARM_BLOCK_THRESHOLD_UNSPECIFIED' | 'BLOCK_LOW_AND_ABOVE' | 'BLOCK_MEDIUM_AND_ABOVE' | 'BLOCK_ONLY_HIGH' | 'BLOCK_NONE' | 'OFF' — The harm block threshold for the safety setting.
    - `enableTextnorm` boolean — Optional. If true, textnorm will be applied to text input. This feature is enabled by default. Only applies for Gemini TTS.

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/texttospeech.md) · [All operations](https://skmtc.dev/google/apis/texttospeech/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/texttospeech/revisions/5515fbd27b86/schema)
