API Reference
Text To Speech · HTTP Stream
https://api.shabd.tech/v1/text-to-speech/streamSynthesizes text to audio and streams back binary chunks — each a 48-byte header followed by raw PCM-16 audio (see the field breakdown under the 200 response). Note: curl cannot frame the binary packet protocol — use Python or JavaScript.
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 synthesize
- Example:
Without language, we cannot communicate.
languagestringrequiredTarget language code
- Example:
english
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 (e.g. "wav")
- Example:
wav
wordStreambooleanoptionalWhether to stream word-level timing information (optional)
- Example:
false
returnTextbooleanoptionalWhether to return the input text alongside the audio (optional)
- Example:
false
projectIdstringoptionalOptional project identifier
- Example:
<your-project-id-here>
Responses
Binary stream of audio chunks. Each chunk is a 48-byte header followed by raw PCM-16 audio; audio content begins at byte 48.
On error, the chunk with
status = 0carries a UTF-8 error message as its content.Example response
<binary audio — application/octet-stream>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."}