Synthesize speech (JSON body)
POST
/v1/adapters/tts/{engine}
const url = 'https://example.com/v1/adapters/tts/polly';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"model":"example","voice":"example","language":"example","speed":"example","format":"mp3","text":"example","sample_rate":1,"advanced_settings":{},"fallback":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/adapters/tts/polly \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "example", "voice": "example", "language": "example", "speed": "example", "format": "mp3", "text": "example", "sample_rate": 1, "advanced_settings": {}, "fallback": true }'Synthesizes speech from a JSON body and streams the audio.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”engine
required
string
TTS engine selector.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
JSON synthesis request body (POST/DELETE).
object
model
string
voice
string
language
string
speed
string
format
string
text
string
sample_rate
integer
advanced_settings
object
key
additional properties
any
fallback
Defaults to true when omitted.
boolean
Responses
Section titled “Responses”Synthesized audio stream.
string format: binary
string format: binary
Headers
Section titled “Headers”X-Cache
string
1 on cache hit, 0 otherwise.
Content-Disposition
string
Error response.
Media typeapplication/json
object
code
required
string
reason
required
string
message
required
string
Examplegenerated
{ "code": "example", "reason": "example", "message": "example"}Error response.
Media typeapplication/json
object
code
required
string
reason
required
string
message
required
string
Examplegenerated
{ "code": "example", "reason": "example", "message": "example"}Forbidden
Error response.
Media typeapplication/json
object
code
required
string
reason
required
string
message
required
string
Examplegenerated
{ "code": "example", "reason": "example", "message": "example"}Error response.
Media typeapplication/json
object
code
required
string
reason
required
string
message
required
string
Examplegenerated
{ "code": "example", "reason": "example", "message": "example"}