curl -X GET "https://dubsmart.ai/api/v1/upload?region=EU&fileExtension=mp3" \
-H "Authorization: Bearer YOUR_API_KEY"
# Response:
{
"url": "https://storage.dubsmart.ai/uploads/...",
"key": "uploads/user_id/filename.mp3"
}
# Upload file
curl -X PUT -T your_audio_file.mp3 "https://storage.dubsmart.ai/uploads/..."
curl -X POST "https://dubsmart.ai/api/v1/custom-voices/create" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "My Custom Voice",
"examplePath": "uploads/user_id/filename.mp3"
}'
# Response:
{
"id": "67c123...",
"name": "My Custom Voice",
"examplePath": "https://...",
"createdAt": "2024-01-15T10:30:00Z"
}'
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 world!",
"voice": "67c123...",
"language": "en"
}
]
}'
/upload
Query Parameters:
- region: string (default: "EU")
- fileExtension: string (mp3, wav, aac, m4a, flac)
{
"url": "https://storage.dubsmart.ai/uploads/...",
"key": "uploads/user_id/filename.mp3"
}
// 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 createCustomVoice() {
try {
// Step 1: Get upload URL
const uploadResponse = await axios.get(`${BASE_URL}/upload`, {
params: {
region: 'EU',
fileExtension: 'mp3'
},
headers: { 'Authorization': `Bearer ${API_KEY}` }
});
console.log('Upload URL:', uploadResponse.data.url);
// Step 2: Upload audio file (you would use the presigned URL here)
// This is typically done with a PUT request to the presigned URL
// Step 3: Create custom voice
const voiceResponse = await axios.post(`${BASE_URL}/custom-voices/create`, {
name: 'My Custom Voice',
examplePath: uploadResponse.data.key
}, {
headers: { 'Authorization': `Bearer ${API_KEY}` }
});
console.log('Custom voice created:', voiceResponse.data);
// Step 4: List custom voices
const voicesResponse = await axios.post(`${BASE_URL}/custom-voices/list`, {
limit: 10
}, {
headers: { 'Authorization': `Bearer ${API_KEY}` }
});
console.log('Custom voices:', voicesResponse.data.items);
return voiceResponse.data;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
}
// Usage
createCustomVoice();