API Reference

Speech To Speech · REST

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

Facilitates seamless spoken language translation by converting speech from one language to another. Maintains natural voice characteristics, making it ideal for multilingual communication and real-time applications.

Headers

  • x-api-keystringrequired

    API Key for authentication

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

    Content type of the request body

    Example:
    multipart/form-data
  • x-request-idstringrequired

    Unique request ID in UUID format

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

Request bodymultipart/form-data

  • sourceLanguagestringrequired

    Source language of the speech

    Example:
    english
  • targetLanguagestringrequired

    Target language to translate to

    Example:
    hindi
  • genderstringrequired

    Gender for voice

    Example:
    male
  • filefileoptional

    Audio file to be translated. Optional when audioUrl is supplied.

  • audioUrlstringoptional

    Public http(s) URL to fetch the audio from, as an alternative to uploading file. Exactly one of file or audioUrl is 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
  • formatstring or nulloptional

    Output audio format (default "wav")

    Example:
    wav
  • speedstring or nulloptional

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

    Example:
    normal
  • inputSampleRatenumber or nulloptional

    Sample rate of the audio (default 16000)

    Example:
    16000
  • sampleRatenumber or nulloptional

    Audio Sample rate for synthesis (e.g., 48000)

    Example:
    48000
  • projectIdstring or nulloptional

    Optional project identifier

    Example:
    <your-project-id-here>
  • stylestring or nulloptional

    Translation style ("conversational" or "formal")

    Allowed:
    conversational
    formal
    Default:
    conversational

Responses

  • 200Translated 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.

    Body: application/octet-stream — binary

    Bodyapplication/json

    • statusbooleanoptional
      Example:
      true
    • transcriptstringoptional
      Example:
      hello
    • translationstringoptional
      Example:
      नमस्ते
    • audiostringoptional

      Base64-encoded audio

      Example:
      UklGR... (base64)
    • mimeTypestringoptional
      Example:
      audio/wav
    • fileNamestringoptional
      Example:
      output.wav

    Example response

    {  "status": true,  "transcript": "hello",  "translation": "नमस्ते",  "audio": "UklGR... (base64)",  "mimeType": "audio/wav",  "fileName": "output.wav"}
  • 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."}