API Reference

Text Translation · HTTP Stream

POSThttps://api.shabd.tech/v1/text-translate/stream

Translates text, streamed as NDJSON — one ttt line per translation chunk, ending with a completed: true line.

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 translate

    Example:
    Language is a powerful tool that allows us to connect and share knowledge.
  • sourceLanguagestringrequired

    Language of the input text

    Example:
    english
  • targetLanguagestringrequired

    Language to translate into

    Example:
    tamil
  • stylestringoptional

    Translation style ("conversational" or "formal")

    Allowed:
    conversational
    formal
    Default:
    conversational
  • projectIdstringoptional

    Optional project identifier

    Example:
    <your-project-id-here>

Responses

  • 200NDJSON stream — one ttt JSON object per line, newline-separated.
    lineExample
    chunk{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "mode": "ttt", "status": true, "completed": false, "chunk": 1, "translation": "மொழி" }
    final{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "mode": "ttt", "status": true, "completed": true, "chunk": 4, "translation": "" }

    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." }

    Bodyapplication/x-ndjson

    • requestIdstringoptional
      Example:
      550e8400-e29b-41d4-a716-446655440000
    • modestringoptional
      Example:
      ttt
    • statusbooleanoptional
      Example:
      true
    • completedbooleanoptional
      Example:
      false
    • chunkintegeroptional
      Example:
      1
    • translationstringoptional
      Example:
      மொழி என்பது நம்மை இணைக்கும் ஒரு சக்திவாய்ந்த கருவி.

    Example response

    {  "requestId": "550e8400-e29b-41d4-a716-446655440000",  "mode": "ttt",  "status": true,  "completed": false,  "chunk": 1,  "translation": "மொழி என்பது நம்மை இணைக்கும் ஒரு சக்திவாய்ந்த கருவி."}
  • 400Bad Request

    Bodyapplication/json

    • statusbooleanoptional
      Example:
      false
    • messagestringoptional
      Example:
      Invalid input parameters.

    Example response

    {  "status": false,  "message": "Invalid input parameters."}
  • 401Unauthorized Access

    Bodyapplication/json

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

    Example response

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