API Reference

Text To Speech · REST

POSThttps://api.shabd.tech/v1/text-to-speech

Generates natural human-like audio from text, supporting multiple voices and languages. Enables the creation of engaging audio experiences for applications like virtual assistants, e-learning, and accessibility.

Headers

  • x-api-keystringrequired

    API Key for authentication

    Example:
    <your-api-key>
  • Content-Typestringrequired

    Content type of the request body

    Example:
    application/json
  • x-request-idstringrequired

    Unique request ID in UUID format

    Example:
    550e8400-e29b-41d4-a716-446655440000

Request bodyapplication/json

  • textstringrequired

    Text to convert to speech

    Example:
    Enter text in any script and get the high quality audio in your desired language.
  • languagestringrequired

    Language for speech

    Example:
    english
  • genderstringrequired

    Gender for voice

    Example:
    male
  • formatstring or nulloptional

    Audio format (only "wav" supported)

    Example:
    wav
  • sampleRatenumber or nulloptional

    Sample rate for the audio (e.g., 48000)

    Example:
    48000
  • speedstring or nulloptional

    Speed of speech (fast, normal, or slow). Default is normal if not specified.

    Allowed:
    fast
    normal
    slow
    Default:
    normal
  • wordStreamboolean or nulloptional

    Whether to stream word-level timing information (optional)

    Example:
    false
  • returnTextboolean or nulloptional

    Whether to return the input text alongside the audio (optional)

    Example:
    false
  • projectIdstring or nulloptional

    Optional project identifier

    Example:
    <your-project-id-here>

Responses

  • 200Speech audio in WAV format

    Body: application/octet-stream — binary

    Example response

    <binary audio — application/octet-stream>
  • 400Bad 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."}
  • 401Unauthorized Access - Authentication credentials are missing or invalid.

    Bodyapplication/json

    • statusbooleanoptional
      Example:
      false
    • messagestringoptional
      Example:
      Unauthorized access.

    Example response

    {  "status": false,  "message": "Unauthorized access."}
  • 403Usage 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"}
  • 500Internal 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."}