List available voices
Retrieve a list of available voices from one or all TTS providers. When provider is specified, returns voices for that provider only. Otherwise, returns voices from all providers.
Some providers (ElevenLabs, Resemble) require an API key to list voices.
GET
/
text-to-speech
/
voices
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.textToSpeech.listVoices();
console.log(response.voices);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.text_to_speech.list_voices()
print(response.voices)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.TextToSpeech.ListVoices(context.TODO(), telnyx.TextToSpeechListVoicesParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Voices)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.texttospeech.TextToSpeechListVoicesParams;
import com.telnyx.sdk.models.texttospeech.TextToSpeechListVoicesResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
TextToSpeechListVoicesResponse response = client.textToSpeech().listVoices();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.text_to_speech.list_voices
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->textToSpeech->listVoices(
apiKey: 'api_key', provider: 'aws'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx text-to-speech list-voices \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/text-to-speech/voices \
--header 'Authorization: Bearer <token>'{
"voices": [
{
"provider": "string",
"name": "string",
"voice_id": "string",
"language": "string",
"gender": "string"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The request failed because it was not well-formed."
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Filter voices by provider. If omitted, voices from all providers are returned.
Available options:
aws, telnyx, azure, elevenlabs, minimax, resemble, xai, humain API key for providers that require one to list voices (e.g. ElevenLabs).
Response
List of available voices.
List of available voices.
Show child attributes
Show child attributes
Was this page helpful?
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.textToSpeech.listVoices();
console.log(response.voices);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.text_to_speech.list_voices()
print(response.voices)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.TextToSpeech.ListVoices(context.TODO(), telnyx.TextToSpeechListVoicesParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Voices)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.texttospeech.TextToSpeechListVoicesParams;
import com.telnyx.sdk.models.texttospeech.TextToSpeechListVoicesResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
TextToSpeechListVoicesResponse response = client.textToSpeech().listVoices();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.text_to_speech.list_voices
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->textToSpeech->listVoices(
apiKey: 'api_key', provider: 'aws'
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx text-to-speech list-voices \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/text-to-speech/voices \
--header 'Authorization: Bearer <token>'{
"voices": [
{
"provider": "string",
"name": "string",
"voice_id": "string",
"language": "string",
"gender": "string"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The request failed because it was not well-formed."
}
]
}