Skip to main content
POST

Authorizations

Authorization
string
header
required

Your AssemblyAI API key, or a temporary token, in the Authorization header. The raw key works directly; a Bearer prefix is also accepted, which is what OpenAI SDKs send. Send exactly one Authorization header. The HTTP routes read the credential from this header only.

Headers

X-Client-Request-Id
string

Your own id for the request, 1 to 512 printable ASCII characters. It is echoed in the response and kept with the request's records. It need not be unique; X-Request-Id is the unique key. An invalid value is ignored and not echoed.

Required string length: 1 - 512

Body

application/json

The body of a speech request: one UTF-8 JSON object of at most 131,072 bytes, sent with a Content-Length header. Content-Type is not checked. null counts as leaving a field out. Types are strict: "sample_rate": 24000.0 and "sample_rate": "24000" are refused. Strings other than text are trimmed. A field given twice is refused. Unknown fields are ignored and listed in X-TTS-Unknown-Params. Body fields are never read from the query string: a field sent there is refused with 422, naming it.

text
string
required

The text to speak, 1 to 5,000 Unicode code points. It may not be blank or hold U+0000 or an unpaired surrogate. It is not trimmed, and it is read as written, as on the WebSocket API (numbers, currency, markup and emoji reach the model as sent); see How text is read.

Required string length: 1 - 5000
voice_id
string

The voice. The library slug of an AssemblyAI voice, such as aai-jane; a voice's ID, a UUID in any letter case; or the slug of one of your account's voices, such as a cloned voice. A slug is lowercase. Left out, the default voice of the model and language, aai-jane. An AssemblyAI voice the model does not speak in the request's language is refused with 422 invalid_request. Any other voice speaks its own language, and a voice the request cannot use is refused before any audio, with 422 and the code voice_not_found, voice_expired, voice_blocked, voice_not_paired, model_retired or model_not_found, or invalid_parameter on language for a language the voice does not speak; 400 feature_not_enabled where cloned voices are not available on the host; 503 voice_service_unavailable when the voice could not be looked up.

Required string length: 1 - 64
model_id
string

The name of the model to speak with, such as assemblyai-tts-1, in lowercase. Left out, the default model of the language. With voice_id, the voice must be paired with it (422 voice_not_paired otherwise). A model the region does not know is refused with 422 model_not_found.

Required string length: 1 - 48

true renews the biometric consent of the cloned voice in voice_id, and attests renewed consent on behalf of the account that owns the voice; see Renew consent. Only the voice's owner may set it: on another account's voice it is refused with 422 not_owner, and without voice_id with 422 invalid_parameter (extend_biometric_consent: extend_biometric_consent requires voice_id). When the request passes its voice checks and renewals are available to your account, the server renews the consent in the background: the voice's expiry moves to 60 days after the request started, if that moves it later by at least one day. The renewal is not guaranteed: one that cannot be made leaves the expiry as it was.

language
enum<string>

The language to speak, as its full name, case-insensitive. Left out, English, or with voice_id the voice's own language. A supported language no model of the region speaks is refused with 422 invalid_request, and a value outside the supported set with 422 invalid_parameter; see Languages. With voice_id, a language the voice does not speak on the model is refused with 422 invalid_parameter.

Available options:
english,
spanish,
german,
italian,
portuguese,
french
sample_rate
enum<integer>
default:24000

The sample rate of the audio in Hz.

Available options:
8000,
16000,
22050,
24000,
44100,
48000
encoding
enum<string>
default:pcm_s16le

The audio encoding, case-insensitive. mulaw and alaw are aliases, reported in canonical form. opus, aac and flac are refused.

Available options:
pcm_s16le,
pcm_mulaw,
pcm_alaw,
mulaw,
alaw,
mp3
container
enum<string>
default:raw

raw sends the encoded samples alone; wav puts them in a WAV file. wav needs a pcm_* encoding, and MP3 has no container. Case-insensitive.

Available options:
raw,
wav
bit_rate
enum<integer>
default:64000

The MP3 bit rate in bits per second. MP3 only, and at most 64000 at 8 kHz.

Available options:
32000,
48000,
64000,
96000,
128000
stream
boolean
default:true

false returns the whole clip at once, with Content-Length, instead of streaming it.

word_boundaries
boolean
default:false

true is refused on this route: word timings come from Stream speech with word timings.

speed
number

Accepted when it equals 1; any other value is refused.

Response

The audio. Streamed unless the request set "stream": false.

Raw audio in the requested format. Streamed responses are chunked and end cleanly only when the audio is complete.