Getting started with ElevenLabs API

API Guides

Getting started with ElevenLabs API
3 min read

Getting Started with the ElevenLabs API: A Developer’s Guide

If you’re building audio into an application — text-to-speech, voice cloning, dubbing, or conversational agents — the ElevenLabs API is the most direct route to production-quality voice output without training your own model. This guide walks through getting your API key, making your first request, and the core concepts you need before you start building.

What ElevenLabs Offers Developers

ElevenLabs exposes its full audio AI stack as a REST API, with official Python and TypeScript SDKs. That includes text-to-speech, speech-to-text, voice cloning, dubbing, sound effects, music generation, and the Agents Platform for building conversational voice agents — all accessible programmatically rather than through the web app.

This matters if you’re building:

  • A product feature that needs dynamic voice output (e.g. narrating user-generated content)
  • An internal tool that converts documents or scripts to audio at scale
  • A conversational voice agent embedded in your own application
  • A pipeline that needs voice cloning or dubbing as part of a larger workflow

What You Need Before You Start

  • An ElevenLabs account — a free account is enough to test the API, though rate limits and voice access are more limited than on a paid plan
  • An API key, generated from your account dashboard
  • Basic familiarity with making HTTP requests, or with Python/Node if you’re using the official SDKs

Create your ElevenLabs account → https://aivoicehub.app/go/elevenlabs

Getting Your API Key

  1. Log into your ElevenLabs account and go to your profile settings.
  2. Click API Keys in the sidebar.
  3. Click Create Key, give it a descriptive name, and set any scope or credit restrictions you want.
  4. Copy the key immediately — ElevenLabs only shows it once.

Treat this key as a secret. Never expose it in client-side code or commit it to a public repository. For any user-facing application, route requests through your own backend rather than calling the API directly from the browser.

Making Your First Request

The fastest way to confirm everything is working is a simple text-to-speech call. Using the Python SDK:

from elevenlabs.client import ElevenLabs
from elevenlabs.play import play

client = ElevenLabs(api_key="YOUR_API_KEY")

audio = client.text_to_speech.convert(
    text="This is a test of the ElevenLabs API.",
    voice_id="JBFqnCBsd6RMkjVDRZzb",
    model_id="eleven_v3",
    output_format="mp3_44100_128",
)

play(audio)

Code verified against ElevenLabs’ official documentation and Python SDK repository as of June 2026. SDKs evolve — if a method here throws an error, check the official ElevenLabs Python SDK docs for the current syntax.

The same call works almost identically in the TypeScript/Node SDK, or as a raw HTTP request if you’re working in another language — every endpoint accepts standard REST calls with your API key passed in the xi-api-key header.

Core Concepts to Understand

Voices. Every voice has a unique ID, used in API requests. ElevenLabs maintains a library of thousands of pre-built voices, and you can clone a custom voice from an audio sample or generate one from a text description.

Models. Different models trade off quality, latency, and language coverage. eleven_v3 produces the most expressive output across 70+ languages; eleven_flash_v2_5 is built for real-time use at very low latency. Pick the model based on whether your use case prioritizes naturalness or speed.

Credits. Usage across every product — text-to-speech, speech-to-text, music, dubbing — draws from a shared credit pool tied to your plan.

Streaming. Both text-to-speech and speech-to-text support streaming output over WebSockets, which matters if you’re building anything real-time — a live voice agent, a read-aloud feature, or any interface where latency is user-facing.

Beyond Text-to-Speech

Once the basic request is working, the API opens up a few directions worth knowing about:

  • Voice cloning — generate a custom voice from a short audio sample, useful for personalized content or branded voice products
  • Dubbing — translate and voice over audio or video content into other languages programmatically
  • Agents Platform — build conversational voice agents with full programmatic control, the same underlying technology used in ElevenLabs’ no-code ElevenAgents builder (covered in our guide to AI receptionists)
  • Sound effects and music — generate audio assets from text prompts, useful for content pipelines that need more than spoken voice

Where This Fits With HeyGen and Other Tools

If you’re building video rather than audio-only output, the API pairs naturally with platforms like HeyGen, which can pull ElevenLabs-generated voices directly into avatar video projects. We cover that specific integration in our step-by-step HeyGen guide if that’s closer to what you’re building.

Frequently Asked Questions

Is the ElevenLabs API free to use? Most endpoints are available on the free plan with limited credits, enough to test integration before committing to a paid plan.

What’s the difference between the API and ElevenAgents? ElevenAgents is a no-code platform for building voice agents through a visual builder. The API gives developers full programmatic control over the same underlying voice agent infrastructure, along with every other ElevenLabs capability.

Does the API support real-time use? Yes. Text-to-speech and speech-to-text both support WebSocket streaming for real-time applications.

What languages are supported? Up to 70+ languages depending on the model selected.

Can I clone a voice through the API? Yes — voice cloning is available programmatically, using a short audio sample to generate a custom voice ID you can then use in any text-to-speech request.


Some links in this post are affiliate links. We may earn a commission if you sign up, at no extra cost to you.

Related Articles
Guide
How to Never Miss a Business Call Again
Review
Best AI Receptionist for Small Business 2026
Test the product
ElevenAgents
AI receptionist — set up in under an hour
Topics
AI Receptionists
Comparisons
Small Business
Voice Agents
Some links in this post are affiliate links. We may earn a commission if you sign up, at no extra cost to you.