How to Call the API
Send authenticated requests to voiceasy.ai endpoints using curl, Node, or Python.
Authentication
Get an API key from your dashboard and include it:
Authorization: Bearer YOUR_API_KEY
Example: Text to Speech
curl
curl -X POST https://api.voiceasy.ai/v1/tts -H "Authorization: Bearer $VOICEASY_API_KEY" -H "Content-Type": "application/json" -d '{
"text": "Welcome to voiceasy.ai",
"voice_id": "en-male-2",
"format": "wav",
"sample_rate": 48000
}' -o speech.wavNode
const res = await fetch("https://api.voiceasy.ai/v1/tts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.VOICEASY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ text: "Welcome to voiceasy.ai", voice_id: "en-male-2", format: "wav" }),
});
const buf = Buffer.from(await res.arrayBuffer());
await import("node:fs").then(fs => fs.writeFileSync("speech.wav", buf));Python
import requests
res = requests.post(
"https://api.voiceasy.ai/v1/tts",
headers={"Authorization": f"Bearer {os.environ['VOICEASY_API_KEY']}", "Content-Type": "application/json"},
json={"text": "Welcome to voiceasy.ai", "voice_id": "en-male-2", "format": "wav"}
)
open("speech.wav", "wb").write(res.content)Error Handling
Standard JSON errors with code and message fields.
{
"error": { "code": "invalid_request", "message": "voice_id not found" }
}Next Steps
- Choose a voice and synthesize speech via Text to Speech.
- Create tones and generate speech with style via Tone Synthesis.
- Manage your tones via My Tones.