📚 API Documentation

Complete guide to using Sanvika AI Service APIs

🔐 Authentication

All API requests require the app's registered client secret in this header:

x-client-secret: your-client-secret-here

🎤 Text-to-Speech (TTS)

POST/api/tts

Convert text to speech in multiple Indian languages.

Request Body:

{
  "text": "नमस्ते",
  "languageCode": "hi-IN"
}

Response:

{
  "audio": "base64-encoded-audio",
  "cost": 0.15,
  "units": 10
}

Supported Languages:

  • Hindi: hi-IN
  • English (India): en-IN
  • English (USA): en-US
  • Tamil: ta-IN
  • Telugu: te-IN
  • Bengali: bn-IN
  • Marathi: mr-IN
  • Urdu: ur-IN
  • Kannada: kn-IN
  • Malayalam: ml-IN
  • Assamese: as-IN
  • Odia: or-IN

🎧 Speech-to-Text (STT)

POST/api/stt

Transcribe audio to text.

Request Body:

{
  "audio": "base64-encoded-audio",
  "languageCode": "hi-IN"
}

Response:

{
  "text": "नमस्ते",
  "confidence": 0.95,
  "cost": 0.25
}

🔄 Streaming STT

POST/api/stt/stream

Real-time speech-to-text streaming for live transcription.

📊 Analytics

GET/api/analytics

Get usage statistics and billing information for your app.

Response:

{
  "clientId": "your-client-id",
  "displayName": "Your App",
  "monthlyLimit": 1000,
  "totalSpent": 245.50,
  "remaining": 754.50,
  "status": "active"
}

💰 Pricing

  • TTS: ₹0.015 per character
  • STT: ₹0.10 per minute

⚡ Rate Limits

  • All endpoints: 60 requests per minute per app
  • TTS payload: Max 5000 characters
  • STT duration: Max 10 minutes per request

❌ Error Codes

  • 401: Invalid or missing x-client-secret (client secret)
  • 403: App suspended (limit exceeded)
  • 429: Rate limit exceeded
  • 400: Invalid request parameters
  • 500: Server error