API Endpoints

Complete reference of all TTS API endpoints.

Base URL

https://yourvoic.com/api/v1

Authentication

All requests require the X-API-Key header:

X-API-Key: your_api_key_here

Endpoints Overview

MethodEndpointDescription
POST/v1/tts/generateGenerate speech from text
POST/v1/tts/streamStream speech in real-time
GET/v1/voicesList available voices
GET/v1/languagesList supported languages
GET/v1/modelsList available models
GET/v1/usageGet usage statistics
GET/healthHealth check

Generate Speech

POST /v1/tts/generate

Convert text to speech and return audio file.

Request Body

{
    "text": "Hello, world!",
    "voice": "Peter",
    "language": "en-US",
    "model": "aura-prime",
    "speed": 1.0,
    "format": "wav"
}

Response

Binary audio data with appropriate Content-Type header (e.g., audio/wav).

cURL Example

curl -X POST "https://yourvoic.com/api/v1/tts/generate" \
  -H "X-API-Key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello!", "voice": "Peter", "language": "en-US"}' \
  --output output.wav

Streaming Generation

POST /v1/tts/stream

Stream audio as it's generated for low-latency playback (~40ms first byte).

Request Body

{
    "text": "Streaming audio content.",
    "voice": "Peter",
    "language": "en-US",
    "model": "aura-prime",
    "sample_rate": 24000
}

Response

Chunked transfer encoding with raw PCM audio data (16-bit, mono).

HeaderValueDescription
Content-Typeaudio/pcmRaw PCM format
X-Sample-Rate24000Sample rate in Hz
X-Bits-Per-Sample1616-bit audio
X-Channels1Mono audio
Note: rapid-flash does NOT support streaming. Use aura-* models or rapid-max for streaming.

Get Voices

GET /v1/voices

List all available voices.

Query Parameters

ParameterTypeDescription
languagestringGet localized voice names (e.g., "hi" for Hindi)
genderstringFilter by gender: "male" or "female"

cURL Example

# Get all voices
curl "https://yourvoic.com/api/v1/voices" \
  -H "X-API-Key: your_api_key"

# Get Hindi voice names
curl "https://yourvoic.com/api/v1/voices?language=hi" \
  -H "X-API-Key: your_api_key"

Response

{
    "voices": [
        {
            "voice_id": "peter",
            "name": "Peter",
            "gender": "male",
            "language": "en-US"
        },
        {
            "voice_id": "kylie",
            "name": "Kylie",
            "gender": "female",
            "language": "en-US"
        }
    ],
    "total": 30
}

Get Languages

GET /v1/languages

List all supported languages. Optionally filter by model.

Query Parameters

ParameterTypeDescription
modelstringFilter by model: aura-lite, aura-prime, aura-max, rapid-flash, rapid-max

Response

{
    "success": true,
    "languages": [
        {"code": "en-US", "name": "English (US)", "region": "Global"},
        {"code": "hi-IN", "name": "Hindi", "region": "India"},
        {"code": "ja-JP", "name": "Japanese", "region": "Asia"}
    ],
    "total": 50,
    "model": "aura-prime"
}

Get Models

GET /v1/models

List available TTS models with their capabilities.

Response

{
    "models": [
        {
            "id": "aura-lite",
            "name": "Aura Lite",
            "description": "Fast model for real-time applications",
            "languages": 50
        },
        {
            "id": "aura-prime",
            "name": "Aura Prime",
            "description": "High-quality general purpose TTS",
            "languages": 50
        },
        {
            "id": "aura-max",
            "name": "Aura Max",
            "description": "Premium quality for professional use",
            "languages": 50
        },
        {
            "id": "rapid-flash",
            "name": "Rapid Flash",
            "description": "Ultra-fast for low latency",
            "languages": 18
        },
        {
            "id": "rapid-max",
            "name": "Rapid Max",
            "description": "Studio-quality premium voices",
            "languages": 35
        }
    ]
}

Get Usage

GET /v1/usage

Get your API usage statistics and quota information.

Response

{
    "plan": "basic",
    "period": {
        "start": "2025-12-01T00:00:00Z",
        "end": "2025-12-31T23:59:59Z"
    },
    "usage": {
        "characters_used": 125000,
        "characters_limit": 500000,
        "characters_remaining": 375000,
        "requests_today": 45,
        "requests_this_month": 1250
    },
    "rate_limits": {
        "requests_per_minute": 50,
        "requests_per_hour": 1000
    }
}

Health Check

GET /health

Check if the API is operational. No authentication required.

Response

{
    "status": "healthy",
    "version": "1.0.0",
    "timestamp": "2025-12-07T10:30:00Z"
}