Authentication

API Keys

The ElevenLabs API uses API keys for authentication. Every request to the API must include your API key, used to authenticate your requests and track usage quota.

Each API key can be scoped to one of the following:

  1. Scope restriction: Set access restrictions by limiting which API endpoints the key can access.
  2. Credit quota: Define custom credit limits to control usage.

Remember that your API key is a secret. Do not share it with others or expose it in any client-side code (browsers, apps).

All API requests should include your API key in an xi-api-key HTTP header as follows:

$xi-api-key: ELEVENLABS_API_KEY

Making Requests

You can paste the command below into your terminal to run your first API request. Make sure to replace $ELEVENLABS_API_KEY with your secret API key.

$curl 'https://api.elevenlabs.io/v1/models' \
> -H 'Content-Type: application/json' \
> -H 'xi-api-key: $ELEVENLABS_API_KEY'

Example with the elevenlabs Python package:

1from elevenlabs.client import ElevenLabs
2
3client = ElevenLabs(
4 api_key='YOUR_API_KEY',
5)

Example with the elevenlabs Node.js package:

1import { ElevenLabsClient } from "elevenlabs";
2
3const client = new ElevenLabsClient({
4 apiKey: "YOUR_API_KEY",
5});