API Reference
Text Translate To Speech · REST
https://api.shabd.tech/v1/text-translate-to-speechConverts text into natural human-like speech while supporting multiple voices and languages. First, the text is translated into the desired language, then high-quality audio is generated. Ideal for applications such as virtual assistants, e-learning, and accessibility solutions.
Headers
x-api-keystringrequiredAPI Key for authentication
- Example:
<your-api-key>
Content-TypestringrequiredContent type of the request body
- Example:
application/json
x-request-idstringrequiredUnique request ID in UUID format
- Example:
550e8400-e29b-41d4-a716-446655440000
Request bodyapplication/json
textstringrequiredText to convert to speech
- Example:
Enter text in any script and get the high quality audio in your desired language.
sourceLanguagestringrequiredsource language of text
- Example:
english
targetLanguagestringrequiredtarget language for speech
- Example:
tamil
genderstringrequiredGender for voice
- Example:
male
formatstring or nulloptionalAudio format (only "wav" supported)
- Example:
wav
sampleRatenumber or nulloptionalSample rate for the audio (e.g., 48000)
- Example:
48000
speedstring or nulloptionalSpeed of speech (fast, normal, or slow). Default is normal if not specified.
- Allowed:
fastnormalslow- Default:
normal
stylestring or nulloptionalTranslation style ("conversational" or "formal")
- Allowed:
conversationalformal- Default:
conversational
projectIdstring or nulloptionalOptional project identifier
- Example:
<your-project-id-here>
Responses
Synthesized speech. When responseType is "audio" (default) the raw audio bytes are returned as application/octet-stream. When responseType is "base64" a JSON object is returned with the audio base64-encoded.
Bodyapplication/json
statusbooleanoptional- Example:
true
translationstringoptional- Example:
மொழி
audiostringoptionalBase64-encoded audio
- Example:
UklGR... (base64)
mimeTypestringoptional- Example:
audio/wav
fileNamestringoptional- Example:
output.wav
Example response
{ "status": true, "translation": "மொழி", "audio": "UklGR... (base64)", "mimeType": "audio/wav", "fileName": "output.wav"}Bad Request - The request is malformed or contains invalid parameters.
Bodyapplication/json
statusbooleanoptional- Example:
false
messagestringoptional- Example:
Invalid input parameters.
Example response
{ "status": false, "message": "Invalid input parameters."}Unauthorized Access - Authentication credentials are missing or invalid.
Bodyapplication/json
statusbooleanoptional- Example:
false
messagestringoptional- Example:
Unauthorized access.
Example response
{ "status": false, "message": "Unauthorized access."}Usage Limit Exceeded - The usage limit for the API has been exceeded.
Bodyapplication/json
statusbooleanoptional- Example:
false
messagestringoptional- Example:
Limit Exceeded
Example response
{ "status": false, "message": "Limit Exceeded"}Internal server error
Bodyapplication/json
statusbooleanoptional- Example:
false
messagestringoptional- Example:
An unexpected error occurred. Please try again later.
Example response
{ "status": false, "message": "An unexpected error occurred. Please try again later."}