Get started
Quickstart
Create a key and make your first request in a few minutes.
1. Create an API key
Open API keys in the dashboard and create a key. It starts with sk_ and is shown once, so store it somewhere safe, for example in an environment variable:
Shell
export DUBVOICE_API_KEY="sk_your_api_key"2. Submit your first job
This turns a sentence into speech with an ElevenLabs voice. The response comes back immediately with a task_id.
cURL
curl -X POST "https://www.dubvoice.ai/api/v1/tts" \
-H "Authorization: Bearer $DUBVOICE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "text": "Hello from DubVoice!", "voice_id": "LB3SchLS4lHotJg4GcZW", "language": "auto" }'JSON
{ "task_id": "550e8400-e29b-41d4-a716-446655440000", "status": "pending", "characters": 20 }3. Wait for the result
Poll the job every few seconds until status is completed or failed. The finished job carries the audio URL in result.
cURL
curl "https://www.dubvoice.ai/api/v1/tts?task_id=550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer $DUBVOICE_API_KEY"4. The same in code
Node (fetch)
JavaScript
const res = await fetch("https://www.dubvoice.ai/api/v1/tts", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.DUBVOICE_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
text: "Hello world",
voice_id: "LB3SchLS4lHotJg4GcZW",
language: "auto",
}),
});
const { task_id } = await res.json();Python (requests)
Python
import os, requests
r = requests.post(
"https://www.dubvoice.ai/api/v1/tts",
headers={"Authorization": f"Bearer {os.environ['DUBVOICE_API_KEY']}"},
json={"text": "Hello world", "voice_id": "LB3SchLS4lHotJg4GcZW", "language": "auto"},
)
task_id = r.json()["task_id"]Polling helper
Python
import time
while True:
j = requests.get(
f"https://www.dubvoice.ai/api/v1/tts?task_id={task_id}",
headers={"Authorization": f"Bearer {api_key}"},
).json()
if j["status"] in ("completed", "failed"): break
time.sleep(3)
print(j["result"])Next steps
- Read Authentication and Rate limits before going to production.
- Get results pushed to you with Webhooks.
- Browse every endpoint in the API reference.