API Reference
Text Translate To Speech · HTTP Stream
https://api.shabd.tech/v1/text-translate-to-speech/streamTranslates text and synthesizes the translation to audio — streamed as NDJSON (a ttt line, then progressive tts lines) over one chunked connection.
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 translate and synthesize
- Example:
Without language, we cannot communicate.
sourceLanguagestringrequiredLanguage of the input text
- Example:
english
targetLanguagestringrequiredLanguage to translate and synthesize into
- Example:
tamil
genderstringrequiredVoice gender ("male" or "female")
- Example:
male
sampleRateintegeroptionalOutput audio sample rate in Hz
- Example:
48000
speedstringoptionalSpeed of speech (fast, normal, or slow). Default is normal if not specified.
- Example:
normal
formatstringoptionalOutput audio format (default "wav")
- Example:
wav
stylestringoptionalTranslation style ("conversational" or "formal")
- Allowed:
conversationalformal- Default:
conversational
wordStreambooleanoptionalWhen true, each
ttsline carries the word its audio speaks in thewordfield. When false or omitted,wordis present but empty.- Default:
false- Example:
true
projectIdstringoptionalOptional project identifier
- Example:
<your-project-id-here>
Responses
NDJSON stream — one JSON object per line, newline-separated.
The single
tttline iscompleted: true. Every audio-bearingttsline iscompleted: false; a single terminalttsline with emptyaudioandcompleted: truemarks the end of the stream.wordholds the word that line's audio speaks, mirroring the word stream of/text-to-speech/stream. It is populated only whenwordStream: truewas requested; otherwise it is an empty string. Concatenatingwordacross thettslines reproduces the translation in playback order. On failure a single error line is sent:{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": false, "completed": false, "message": "An unexpected error occurred. Please try again later." }Example response
"string"Bad Request
Bodyapplication/json
statusbooleanoptional- Example:
false
messagestringoptional- Example:
Invalid input parameters.
Example response
{ "status": false, "message": "Invalid input parameters."}Unauthorized Access
Bodyapplication/json
statusbooleanoptional- Example:
false
messagestringoptional- Example:
Unauthorized access.
Example response
{ "status": false, "message": "Unauthorized access."}Usage Limit 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."}