I'm still getting 404 after 24+ hours of double-checking that the request is in accordance with the API documentation. I'm using Postman.
This is the endpoint I'm trying to access:
https://cloud.google.com/text-to-speech/docs/reference/rest/v1/text/synthesize
This is my request (cURL generated by Postman):
curl --location 'https://texttospeech.googleapis.com/v1/text:synthesize?key=API_KEY' \
--header 'X-Goog-Api-Key: API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"input": {
"text": "hi! how are you?"
},
"voice": {
"languageCode": "en-US",
"name": "en-US-Neural2-F",
"ssmlGender": "FEMALE"
},
"audioConfig": {
"audioEncoding": "MP3",
"speakingRate": 1.0,
"pitch": 0.0,
"volumeGainDb": 0.0
}
}'
P.S. Cloud Text-to-Speech API product is enabled in my project.
P.P.S. 'API_KEY' above is a placeholder for my real API key.
P.P.P.S. The API key used is has these settings:
- Set an application restriction: None
- API restrictions: Don't restrict key
I tried the same request body within Google Cloud's APIs Explorer: API key enabled, Google OAuth 2.0 disabled. Somehow, within APIs Explorer I got the correct response, not 404. My request in postman still gets 404.