Skip to navigation

API reference

Comprehensive API reference documentation for Bakbak TTS and Bakbak STT
View as Markdown

This section provides detailed API reference documentation for Bakbak Text-to-Speech API and Bakbak Speech-to-Text (STT) API.

All endpoints use HTTPS. HTTP is not supported. API keys that call the API over HTTP may be subject to automatic rotation.

API Overview

Bakbak TTS API

The Bakbak Text-to-Speech API provides endpoints for converting text into high-quality speech audio. It supports multiple Indian languages and various audio formats.

Base URL: https://hub.getraya.app/v1

Authentication: API key via X-API-Key header

Available Endpoints:

  • GET /v1/voices - List all available voices
  • POST /v1/text-to-speech - Generate speech (non-streaming)
  • POST /v1/text-to-speech/stream - Generate speech (streaming)

Bakbak STT API

The Bakbak Speech-to-Text (STT) API provides endpoints for transcribing WAV audio into text. It supports both HTTPS multipart transcription and WebSocket transcription.

Base URL: https://hub.getraya.app

Authentication: API key via X-API-Key header

Available Endpoints:

  • POST /transcribe - Transcribe audio file (multipart/form-data)
  • WebSocket wss://hub.getraya.app/transcribe - Transcribe base64 audio payloads (one message per payload)
  • Interactive WSS playground: available under API Reference → Speech to Text (AsyncAPI)

Authentication

All APIs require authentication using an API key. Include the API key in the request headers:

Bakbak TTS API

-H "X-API-Key: <YOUR_API_KEY>"

Bakbak STT API

-H "X-API-Key: <YOUR_API_KEY>"

Obtaining API Keys

To obtain your API key for any of these APIs, please contact your administrator.

Request and Response Formats

Content Types

  • Request: application/json for most endpoints
  • Request: multipart/form-data for POST /transcribe
  • Response: application/json for data endpoints, binary audio for TTS endpoints

Error Responses

Both APIs return errors in a consistent format:

{
"error": "Error type",
"message": "Detailed error message"
}

Common HTTP status codes:

  • 200 - Success
  • 400 - Bad Request (validation error)
  • 401 - Unauthorized (invalid or missing API key)
  • 404 - Not Found
  • 429 - Rate Limit Exceeded
  • 500 - Internal Server Error

Rate Limiting

Bakbak TTS API

Rate limits vary by endpoint. Check individual endpoint documentation for specific limits.

When rate limited, you’ll receive a 429 status code with details about when to retry.

Best Practices

  1. Store API keys securely - Never commit API keys to version control
  2. Handle errors gracefully - Always check response status codes
  3. Use appropriate endpoints - Use streaming for real-time applications, non-streaming for batch processing
  4. Respect rate limits - Implement exponential backoff for retries
  5. Validate input - Check required fields and formats before making requests

Code Examples

Bakbak TTS - Generate Speech

curl -X POST https://hub.getraya.app/v1/text-to-speech \
-H "X-API-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello, this is a test message.",
"voice_id": "voice_001",
"model": "standard",
"language": "hi",
"output_format": {"container": "wav", "encoding": "pcm_s16le", "sample_rate": 24000},
"speed": 1.0
}'

Bakbak STT - Transcribe Audio (HTTPS)

curl --location 'https://hub.getraya.app/transcribe' \
-H 'X-API-Key: <YOUR_API_KEY>' \
--form 'file=@"/path/to/audio.wav"' \
--form 'language="hi"'

SDKs and Libraries

Official SDKs are available for Bakbak TTS: the Python SDK and the JavaScript SDK. The REST APIs are also straightforward to use with any HTTP client library. Popular options include:

  • Python: requests library
  • JavaScript/Node.js: axios or fetch
  • cURL: Command-line tool
  • Postman: For testing and exploration

Support and Resources

Next Steps

  1. Explore the TTS API endpoints for text-to-speech functionality
  2. Explore the STT API endpoints for speech-to-text transcription
  3. Review the request/response schemas for each endpoint
  4. Try the examples in your preferred programming language