Installation

You can interact with the TTSLab API through HTTP requests from any language. For Python, we recommend using the requests library with a virtual environment.

Python Setup

Create a virtual environment and install requests:
# Create virtual environment
python -m venv ttslab-env

# Activate virtual environment (Windows)
ttslab-env\Scripts\activate

# Activate virtual environment (macOS/Linux)
source ttslab-env/bin/activate

# Install requests
pip install requests python-dotenv

Node.js Setup

For Node.js projects, install the required packages:
npm install node-fetch dotenv

API Base URL

All API requests should be made to:
https://api.elevenlabs8.com

Authentication

All API requests require authentication using the X-API-KEY header:
X-API-KEY: your_api_key_here

Available Endpoints

Endpoints

  • Text-to-Speech: POST /v1/text-to-speech - Convert text to speech
  • Models: GET /api/tts/models/ - List available models
  • Voices: GET /api/tts/voices/ - List available voices
  • History: GET /api/tts/elevenlabs-histories/ - Get generation history

Voice Management

  • Create Voice: POST /api/tts/voices/ - Create a new voice
  • Get Voice: GET /api/tts/voices/{voice_id} - Get voice details

User Management

  • User Profile: GET /api/users/me/ - Get user profile

Response Format

All API responses are returned in JSON format with the following structure:
{
  "success": true,
  "data": {
    // Response data here
  },
  "message": "Success message"
}

Error Handling

Errors are returned with appropriate HTTP status codes and error messages:
{
  "success": false,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Invalid API key provided"
  }
}