Frequently Asked Question
TTS - Convert Text to Speech
Last Updated 6 months ago
Overview
The Text-to-Speech (TTS) API converts text into natural-sounding speech in various voices and languages. This service is ideal for creating voice prompts, automated announcements, or accessibility features. The service is fast enough to provide real-time TTS.
Endpoint
v2/tts
Authentication
All requests require an API key passed as a query parameter:
This API requires authentication using an API key. The key should be passed in the X_API_Key header.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | The text to convert to speech |
| voice | string | No | Voice ID to use (default: bf_emma) |
| speed | float | No | Speech rate multiplier (default: 1.0) |
| language | string | No | Language code (default: b for British English) |
Available Voices
British Voices
bf_alice- British Female (Alice)bf_emma- British Female (Emma)bf_lily- British Female (Lily)bf_v0emma- British Female (Emma V0)bf_v0isabella- British Female (Isabella V0)bm_daniel- British Male (Daniel)bm_fable- British Male (Fable)bm_george- British Male (George)bm_lewis- British Male (Lewis)bm_v0george- British Male (George V0)bm_v0lewis- British Male (Lewis V0)
American Voices
af_alloy- American Female (Alloy)af_aoede- American Female (Aoede)af_bella- American Female (Bella)af_heart- American Female (Heart)af_jadzia- American Female (Jadzia)af_jessica- American Female (Jessica)af_kore- American Female (Kore)af_nicole- American Female (Nicole)af_nova- American Female (Nova)af_river- American Female (River)af_sarah- American Female (Sarah)af_sky- American Female (Sky)am_adam- American Male (Adam)am_echo- American Male (Echo)am_eric- American Male (Eric)am_fenrir- American Male (Fenrir)am_liam- American Male (Liam)am_michael- American Male (Michael)am_onyx- American Male (Onyx)am_puck- American Male (Puck)am_santa- American Male (Santa)
Other Voices
Additional voices are available for other languages and accents. Contact support for a complete list.
Response Format
The API returns a JSON object with the following structure:
Success Response
{
"speech": "BASE64_ENCODED_AUDIO_DATA",
"status": "success"
}
Error Response
{
"status": "error",
"message": "Error description"
}
Rate Limits
The API is subject to the following rate limits:
- Maximum 100 requests per minute per API key
- Maximum text length: 5000 characters
Notes
- The audio is returned as base64-encoded MP3 data
- For optimal performance, keep text inputs under 2000 characters
- Punctuation is supported and help create more natural-sounding speech
Security
- Ensure the API Key is kept secure and not exposed in the client-side code
- All responses are sent with the "Content-Type: application/json" header.
