Skip to main content

Create Speech with Timing

POST 

https://api.knoxstudio.ai/v1/text-to-speech/:voice_id/with-timestamps

Same body as Create speech. Returns JSON with base64 audio and character alignments instead of raw bytes. WAV formats are allowed. Billed per character.

Request​

Path Parameters​

NameTypeRequiredDescription
voice_idStringYesElevenLabs voice ID.

Query Parameters​

NameTypeRequiredDescription
enable_loggingBooleanNoDefault true. false requests zero-retention mode.
optimize_streaming_latencyIntegerNoDeprecated. 0–4 latency/quality tradeoff.
output_formatStringNoDefault mp3_44100_128. Format is codec_sample_rate_bitrate.

Allowed output_format (includes WAV): alaw_8000, mp3_22050_32, mp3_24000_48, mp3_44100_128, mp3_44100_192, mp3_44100_32, mp3_44100_64, mp3_44100_96, opus_48000_128, opus_48000_192, opus_48000_32, opus_48000_64, opus_48000_96, pcm_16000, pcm_22050, pcm_24000, pcm_32000, pcm_44100, pcm_48000, pcm_8000, ulaw_8000, wav_16000, wav_22050, wav_24000, wav_32000, wav_44100, wav_48000, wav_8000.

Request Headers​

NameTypeRequiredDescription
AuthorizationStringYesBearer <token> Knox API key. xi-api-key is also accepted.
Content-TypeStringYesapplication/json.

Request Body​

Same fields as Create speech.

cURL Example​

curl -X POST "https://api.knoxstudio.ai/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM/with-timestamps" \
-H "Authorization: Bearer $KNOXCHAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Sync this line to captions.",
"model_id": "eleven_multilingual_v2"
}'

Response​

Success Response (200)​

| audio_base64 | string | Base64-encoded audio. | | alignment | object | Character timings for the original text: characters, character_start_times_seconds, character_end_times_seconds. | | normalized_alignment | object | Same shape for normalized text. |

Error Responses​

Validation uses HTTP 422:

{
"detail": [
{
"loc": ["body", "field"],
"msg": "…",
"type": "value_error"
}
]
}

Other errors use { "detail": "message" }.

StatusWhen
400WebSocket path called without Upgrade: websocket.
401Missing or invalid API key.
402Insufficient credits.
403Token is not allowed to use this model.
404Resource not found.
422Validation error.
429Rate limit exceeded.
500Internal server error.