Text to Speech API

Convert text to natural speech with TTS API. 300+ AI voices, unlimited voice cloning, and realistic speech generation
300+ AI Voices
Voice Cloning
REST API
TTS Editor Interface
Trusted by over 500,000+ users

Powerful TTS API features

Everything you need to integrate professional text-to-speech into your applications
Neural TTS
300+ AI VoicesAccess premium neural voices in 33+ languages including English, Portuguese, Spanish, French, German, Chinese, Japanese, and more.
Unlimited
Voice CloningCreate custom voices from audio samples with unlimited voice cloning. Perfect for personalized content and brand voices.
Global
33+ LanguagesSupport for 33+ languages including English, Portuguese, Spanish, French, German, Chinese, Japanese, and many more.

TTS API workflow

Convert text to speech with just a few simple API calls
01

Create TTS Project

Create a new text-to-speech project with your text content and voice preferences.
API Request
curl -X POST "https://dubsmart.ai/api/v1/projects/tts" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My TTS Project",
    "segments": [
      {
        "text": "Hello, this is a test message",
        "voice": "anna_en_v2",
        "language": "en"
      }
    ]
  }'
02

Monitor Processing

Track the progress of your TTS project as it processes your text into natural speech.
API Request
curl -X GET "https://dubsmart.ai/api/v1/projects/tts/{projectId}" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Response:
{
  "id": "project_id",
  "status": "processing",
  "progress": 75,
  "segments": [
    {
      "id": "segment_id",
      "status": "completed",
      "audioUrl": "https://..."
    }
  ]
}
03

Download Audio

Download high-quality audio files when processing is complete. Get MP3 format with 22kHz quality.
API Request
curl -X GET "https://dubsmart.ai/api/v1/projects/tts/{projectId}" \
  -H "Authorization: Bearer YOUR_API_KEY"

# When status is "completed":
{
  "id": "project_id",
  "status": "completed",
  "audioUrl": "https://storage.dubsmart.ai/audio.mp3",
  "segments": [
    {
      "id": "segment_id",
      "audioUrl": "https://storage.dubsmart.ai/segment.mp3"
    }
  ]
}

TTS API endpoints

Complete API reference for text-to-speech functionality
POST
/projects/tts

Create TTS Project

Create a new Text-to-Speech project with text segments and voice configurations
Request
JSON
{
  "title": "My TTS Project",
  "segments": [
    {
      "text": "Hello world! This is a test message.",
      "voice": "anna_en_v2",
      "language": "en",
      "speed": 1.0,
      "pitch": 1.0
    }
  ]
}
Response
JSON
{
  "id": "64f8a2b1c3d4e5f6a7b8c9d0",
  "title": "My TTS Project",
  "status": "pending",
  "progress": 0,
  "createdAt": "2023-09-06T10:30:00Z",
  "segments": [
    {
      "id": "segment_1",
      "text": "Hello world! This is a test message.",
      "status": "pending"
    }
  ]
}
GET
/projects/tts

Get TTS Projects

Retrieve a list of your TTS projects with pagination and filtering options
Request
JSON
Query Parameters:
- limit: number (default: 20, max: 100)
- cursor: string (for pagination)
- status: "pending" | "processing" | "completed" | "failed"
Response
JSON
{
  "items": [
    {
      "id": "64f8a2b1c3d4e5f6a7b8c9d0",
      "title": "My TTS Project",
      "status": "completed",
      "progress": 100,
      "createdAt": "2023-09-06T10:30:00Z",
      "audioUrl": "https://storage.dubsmart.ai/audio.mp3"
    }
  ],
  "nextCursor": "next_cursor_value"
}
GET
/projects/tts/{projectId}

Get TTS Project by ID

Retrieve detailed information about a specific TTS project
Request
JSON
Path Parameters:
- projectId: string (required)
Response
JSON
{
  "id": "64f8a2b1c3d4e5f6a7b8c9d0",
  "title": "My TTS Project",
  "status": "completed",
  "progress": 100,
  "createdAt": "2023-09-06T10:30:00Z",
  "audioUrl": "https://storage.dubsmart.ai/audio.mp3",
  "segments": [
    {
      "id": "segment_1",
      "text": "Hello world! This is a test message.",
      "status": "completed",
      "audioUrl": "https://storage.dubsmart.ai/segment_1.mp3"
    }
  ]
}

TTS API code examples

Ready-to-use code examples in multiple programming languages
JavaScript Example
// JavaScript/Node.js Example
const axios = require('axios');

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://dubsmart.ai/api/v1';

async function createTTSProject() {
  try {
    // Create TTS project
    const projectResponse = await axios.post(`${BASE_URL}/projects/tts`, {
      title: 'My TTS Project',
      segments: [
        {
          text: 'Hello! This is a sample text for text-to-speech conversion.',
          voice: 'anna_en_v2',
          language: 'en',
          speed: 1.0,
          pitch: 1.0
        },
        {
          text: 'This is the second segment with a different voice.',
          voice: 'john_en_v2',
          language: 'en',
          speed: 1.1,
          pitch: 0.9
        }
      ]
    }, {
      headers: { 'Authorization': `Bearer ${API_KEY}` }
    });

    console.log('Project created:', projectResponse.data);
    
    // Monitor project status
    const projectId = projectResponse.data.id;
    await monitorProjectStatus(projectId);
    
    return projectResponse.data;
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}

// Monitor project status
async function monitorProjectStatus(projectId) {
  let status = 'pending';
  
  while (status !== 'completed' && status !== 'failed') {
    await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds
    
    const response = await axios.get(`${BASE_URL}/projects/tts/${projectId}`, {
      headers: { 'Authorization': `Bearer ${API_KEY}` }
    });
    
    status = response.data.status;
    console.log(`Project status: ${status}, Progress: ${response.data.progress}%`);
    
    if (status === 'completed') {
      console.log('Audio URL:', response.data.audioUrl);
      console.log('Segments:', response.data.segments);
    }
  }
}

// Usage
createTTSProject();

FAQ

What is the TTS API and how does it work?Our TTS API is a RESTful service that converts text into natural-sounding speech using advanced AI technology. Simply send a POST request with your text content and voice preferences, and receive high-quality audio files in return.
How many voices and languages are available?Our TTS API provides access to 300+ premium AI voices across 33+ languages and dialects. This includes popular languages like English, Spanish, French, German, Chinese, Japanese, and many others.
Can I use voice cloning with the API?Yes! Our API supports unlimited custom voice cloning. You can create personalized voices by providing audio samples, then use these custom voices in your TTS projects.
What audio formats and quality does the API support?The TTS API generates high-quality audio in MP3 format.
How long does it take to process TTS requests?Processing time depends on text length and complexity. Typical segments (1-2 sentences) process in 10-30 seconds.