APIYard
Back to APIs
AI & MLAPI KeyFree tier

ElevenLabs

Convert text to speech with hyper-realistic AI voices, clone voices from audio samples, and build audio experiences with ElevenLabs' voice API.

Base URL

https://api.elevenlabs.io/v1
text-to-speechvoice cloningaudioTTSsynthesis

Endpoints

POST/text-to-speech/{voice_id}

Convert text to speech using a specific voice.

const response = await fetch("https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM", {
  method: "POST",
  headers: {
  "Content-Type": "application/json",
  "xi-api-key": "YOUR_API_KEY"
  },
  body: JSON.stringify({
  "text": "Hello, world!",
  "model_id": "eleven_monolingual_v1"
})
});

const data = await response.json();
console.log(data);

Response Preview

// Returns raw audio bytes (audio/mpeg)
// Save as .mp3 or stream directly to audio element
GET/voices

List all available voices.

const response = await fetch("https://api.elevenlabs.io/v1/voices", {
  method: "GET",
  headers: {
  "Content-Type": "application/json",
  "xi-api-key": "YOUR_API_KEY"
  }
});

const data = await response.json();
console.log(data);

Response Preview

{
  "voices": [{
    "voice_id": "21m00Tcm4TlvDq8ikWAM",
    "name": "Rachel",
    "category": "premade",
    "labels": { "accent": "american", "age": "young" }
  }]
}