#Can we change the voice id from api without going to the website?

1 messages · Page 1 of 1 (latest)

proud daggerBOT
#
AI-generated Answer for afkarxyz

Yes, you can retrieve and use the voice_id directly through the API without needing to visit the website. To do this, you can use the GET /v1/voices endpoint, which will return a list of all voices available in your account, including their voice_id. Here's an example Python script to fetch the voice_id:

import requests
import json

# Replace with your actual API key
XI_API_KEY = "<xi-api-key>"

# API endpoint to fetch voices
url = "https://api.elevenlabs.io/v1/voices"

# Set up headers with your API key
headers = {
    "Accept": "application/json",
    "xi-api-key": XI_API_KEY,
    "Content-Type": "application/json"
}

# Send a GET request to the API
response = requests.get(url, headers=headers)

# Parse the JSON response
data = response.json()

# Print the name and voice_id of each voice
for voice in data['voices']:
    print(f"{voice['name']}; {voice['voice_id']}")

This script will list all the voices in your account along with their voice_id, which you can then use in your API requests. Make sure your API key is correctly set up to access your account's voices.

pine dew
#

What I mean is changing the list available in our account without opening the website. Is that possible?