Text To Speech with Timestamps
Generate speech from text and return word/character-level timestamps aligned with the audio. Useful for subtitle sync, per-character highlight animation, and speech-region visualization.
The request body matches the standard /v1/text-to-speech endpoint (voice_id, text, model, language, prompt, output). Instead of raw audio bytes, this endpoint returns a JSON object containing base64-encoded audio plus words and characters arrays.
Use the optional granularity query parameter to return only word-level or only character-level timestamps and reduce payload size.
Language note. For languages that do not use whitespace between words — such as Japanese (jpn) and Chinese (zho) — word-level alignment collapses the entire sentence into a single "word". For those languages, always request granularity=char to receive usable per-character timestamps.
See Listing all voices for available voices.
Request
- Base URL: https://api.typecast.ai
- URL: https://api.typecast.ai/v1/text-to-speech/with-timestamps
- Auth: API key in header X-API-KEY
Query parameters
Filter for which timestamp arrays to return.
- Omitted: returns both words and characters.
- word: returns words only (characters is null).
- char: returns characters only (words is null).
Languages without whitespace (e.g., jpn, zho): word alignment yields a single segment covering the whole sentence, so use char to obtain meaningful timestamps.
Request body
Example request
{
"text": "Everything is so incredibly perfect that I feel like I'm dreaming.",
"output": {
"volume": 100,
"audio_tempo": 1,
"target_lufs": -14,
"audio_format": "wav",
"remove_silence_ms": 100
},
"prompt": {
"next_text": "I am literally bursting with happiness and I never want this feeling to end!",
"emotion_type": "smart",
"previous_text": "I feel like I'm walking on air and I just want to scream with joy!"
},
"language": "eng",
"voice_id": "tc_60e5426de8b95f1d3000d7b5"
}Response
Success - Returns base64 audio and timestamps
Changes
No recorded changes to this operation across all 1 revision of this API.