Specify a regional endpoint

Stay organized with collections Save and categorize content based on your preferences.

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.

$ curl   -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
         -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 an access token for a service account set up for the project using the Google Cloud CLI. For instructions on installing the gcloud CLI, setting up a project with a service account, and obtaining an access token, see the quickstart.