Specify a regional endpoint

Text-to-Speech offers US and EU regional API endpoints. If you use a regional endpoint, your data at-rest and in-use will stay within the continental boundaries of Europe or the USA. Specifying an endpoint is important if your data's location must be controlled in order to comply with local regulatory requirements. There is no functional change to the behavior of the API.

When you use a regional endpoint, make sure to include the matching us or eu location in the parent string. See the Synthesize documentation for more information about configuring the synthesize request body.


To perform text to speech synthesis using a regional endpoint, run the applicable command in the table below to configure the correct endpoint:

Multi-region Endpoint override
EU $ export CLOUD_TTS_ENDPOINT=https://eu-texttospeech.googleapis.com
US $ export CLOUD_TTS_ENDPOINT=https://us-texttospeech.googleapis.com

Only Neural2 voices are available from these endpoints:

Single-region Endpoint override
US Central1 $ export CLOUD_TTS_ENDPOINT=https://us-central1-texttospeech.googleapis.com

The following code sample demonstrates how to send a synthesis request that keeps all data confined to a specified region. You can substitute either the EU or US regional endpoint for the CLOUD_TTS_ENDPOINT variable. Replace PROJECT_ID with your project ID.

$ curl   -H "Authorization: Bearer $(gcloud auth print-access-token)" \
         -H "x-goog-user-project: PROJECT_ID" \
         -H "Content-Type: application/json; charset=utf-8" \
         --data "{
            'text':'Android is a mobile operating system developed by Google,
             based on the Linux kernel and designed primarily for
             touchscreen mobile devices such as smartphones and tablets.'
      }" $CLOUD_TTS_ENDPOINT/v1/text:synthesize > synthesize-text.txt

This example uses the Google Cloud CLI to create an access token for your Google Account. For instructions on installing the gcloud CLI, see Authenticate to Text-to-Speech.