API Reference

Text Translation · WebSocket

WSSwss://stream.shabd.tech/v1/text-translate

Connection headers

  • x-api-keystringrequired

    API key for authentication.

Message flow

  • Outgoing Message (↑): The client sends a JSON object with the necessary parameters for text translation.
  • Incoming Message (↓): The server responds json with requestId, status, translation, chunk, completed, mode.

Send Message (↑):

{  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "text": "नमस्ते, आपका दिन शुभ हो!",  "sourceLanguage": "hindi",  "targetLanguage": "tamil"}

Initial messageapplication/json

  • requestIdstringrequired

    Unique identifier for the request

  • textstringrequired

    Text content to be translated

  • sourceLanguagestringrequired

    Source Language of the text

  • targetLanguagestringrequired

    Target language of the text

Server messages

  • 101The server streams translated text along with status and progress updates.

    Receive Translation (↓):

    {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "translation": "வணக்கம் இனிய நாள்!",  "chunk": 1,  "completed": false,  "mode": "ttt"}

    When the translation is complete:

    {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "translation": "",  "chunk": 2,  "completed": true,  "mode": "ttt"}

    Messages

    Message TypeExampleDescription
    Send (↑){ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "text": "नमस्ते, आपका दिन शुभ हो!", "sourceLanguage": "hindi", "targetLanguage": "tamil" }The client sends parameters for getting the translated text.
    Receive (↓){ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "translation": "வணக்கம் இனிய நாள்!", "chunk": 1, "completed": false, "mode": "ttt" }The server sends translation along with status and progress updates.
    Receive (↓){ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "status": true, "translation": "", "chunk": 2, "completed": true, "mode": "ttt" }The server sends completed message.

    Example response

    {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "translation": "வணக்கம் இனிய நாள்!",  "chunk": 1,  "completed": false,  "mode": "ttt"} {  "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02",  "status": true,  "translation": "",  "chunk": 2,  "completed": true,  "mode": "ttt"}