Skip to main content
GET
/
tts
/
v1
/
voice:preview
cURL
curl 'https://api.inworld.ai/tts/v1/voice:preview?voice_id=Ashley&model_id=inworld-tts-2' \
--header "Authorization: Basic $INWORLD_API_KEY" \
| jq -r '.audioContent' | base64 -d > preview.mp3
import requests
import base64
import os

url = "https://api.inworld.ai/tts/v1/voice:preview"
headers = {
"Authorization": f"Basic {os.getenv('INWORLD_API_KEY')}"
}
params = {
"voice_id": "Ashley",
"model_id": "inworld-tts-2"
}

response = requests.get(url, headers=headers, params=params)
response.raise_for_status()
audio_content = base64.b64decode(response.json()["audioContent"])

with open("preview.mp3", "wb") as f:
f.write(audio_content)
print("Preview saved to preview.mp3")
const fs = require('fs');

async function main() {
const url = 'https://api.inworld.ai/tts/v1/voice:preview?voice_id=Ashley&model_id=inworld-tts-2';

const response = await fetch(url, {
headers: {
'Authorization': `Basic ${process.env.INWORLD_API_KEY}`,
},
});

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}

const result = await response.json();
const audioBuffer = Buffer.from(result.audioContent, 'base64');
fs.writeFileSync('preview.mp3', audioBuffer);
console.log('Preview saved to preview.mp3');
}

main();
{
  "audioContent": "SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYwLjE2LjEwMAAAAAAAAAAAAAAA..."
}
{
"code": 5,
"message": "Unknown voice: John not found!",
"details": []
}

Authorizations

Authorization
string
header
required

Your authentication credentials. For Basic authentication, please populate Basic $INWORLD_API_KEY. You can create a key in one command with the Inworld CLI: inworld workspace add-key.

Query Parameters

voice_id
string
required

The identifier of the voice to preview. Use the List Voices endpoint to discover available voice IDs.

Example:

"Ashley"

model_id
string
required

The identifier of the TTS model to use for generating the preview. See Models for available models.

Example:

"inworld-tts-2"

Response

A successful response containing the voice preview audio.

audioContent
string<byte>

The audio data bytes encoded as MP3. The preview text is determined server-side and cannot be customized.