Skip to main content
POST
/
text-to-audio
Convert Text to Audio
curl --request POST \
  --url https://{api_base_url}/text-to-audio \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "Hello, welcome to our service.",
  "user": "abc-123",
  "voice": "alloy",
  "streaming": false
}
'
"<string>"

Authorizations

Authorization
string
header
required

API Key authentication. For all API requests, include your API Key in the Authorization HTTP Header, prefixed with Bearer. Example: Authorization: Bearer {API_KEY}. Strongly recommend storing your API Key on the server-side, not shared or stored on the client-side, to avoid possible API-Key leakage that can lead to serious consequences.

Body

application/json

Request body for text-to-audio conversion. Provide either message_id or text.

message_id
string<uuid>

Message ID. Takes priority over text when both are provided.

text
string

Speech content to convert.

user
string

User identifier.

voice
string

Voice to use for text-to-speech. Available voices depend on the TTS provider configured for this app. Use the voice value from Get App Parameterstext_to_speech.voice for the default.

streaming
boolean

Whether to enable streaming response.

Response

Returns the generated audio file. The Content-Type header is set to the audio MIME type (e.g., audio/wav, audio/mp3). If streaming is true, the audio is streamed as chunked transfer encoding.

The response is of type file.