#how do i add voices from the Get Voices API so i can query the voice_id in the Get Voice API?
1 messages · Page 1 of 1 (latest)
To add voices from the Get Voices API and query the voice_id, you can follow these steps:
-
Fetch the Voices: Use the
GET /v1/voicesendpoint to retrieve the list of voices accessible to your account. This will provide you with thevoice_idfor each voice. Ensure you include your API key in the request headers for authentication.Here's a sample Python code snippet to get the list of voices:
import requests import json XI_API_KEY = "<your_api_key>" url = "https://api.elevenlabs.io/v1/voices" headers = { "Accept": "application/json", "xi-api-key": XI_API_KEY, "Content-Type": "application/json" } response = requests.get(url, headers=headers) data = response.json() for voice in data['voices']: print(f"{voice['name']}; {voice['voice_id']}") -
Add a Voice: If you want to add a voice to your collection, you can use the "Add Sharing Voice" endpoint. This requires the
public_user_idandvoice_idof the voice you want to add, along with a new name for the voice.Here's a sample code snippet to add a voice:
import requests url = "https://api.elevenlabs.io/v1/voices/add/public_owner_id/voice_id" payload = {"new_name": "voice_name"} headers = { "xi-api-key": "your_api_key", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text)
By following these steps, you can manage and query the voice_id for the voices you wish to use.
how many voices do you get on each tier of the subscription?