API Reference
Speech To Speech · HTTP Stream
https://api.shabd.tech/v1/speech-to-speech/streamTranscribes speech, translates it, then synthesizes the translation to audio — streamed as NDJSON (stt, ttt, then 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:
multipart/form-data
x-request-idstringrequiredUnique request ID in UUID format
- Example:
550e8400-e29b-41d4-a716-446655440000
Request bodymultipart/form-data
filefileoptionalAudio file in WAV or PCM format. Optional when
audioUrlis supplied.audioUrlstringoptionalPublic http(s) URL to fetch the audio from, as an alternative to uploading
file. Exactly one offileoraudioUrlis required; if both are sent the uploaded file wins. The URL must be publicly reachable and the downloaded audio is subject to the same size limit as an upload.- Example:
https://example.com/audio/sample.wav
sourceLanguagestringrequiredLanguage of the speech
- Example:
english
targetLanguagestringrequiredLanguage to translate and synthesize into
- Example:
tamil
genderstringrequiredVoice gender for synthesis ("male" or "female")
- Example:
male
sampleRateintegeroptionalOutput audio sample rate in Hz
- Example:
48000
inputSampleRatenumberoptionalSample rate of the input audio in Hz (default 16000)
- Example:
16000
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.
Transcript, translation and audio interleave per segment.
wordholds the word that line's audio speaks, populated only whenwordStream: truewas requested; otherwise it is an empty string. Every audio-bearingttsline iscompleted: false; a single terminalttsline with emptyaudioandcompleted: truemarks the end of the stream. 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."}