Text to Speech

Get batch item audio

Download the audio of one batch item by its ref.

GET/v1/batches/{id}/items/{ref}/audio

Returns the audio bytes of one item, in the format the item asked for (audio/mpeg or audio/wav). This is the audio_url of a succeeded item in GET /v1/batches/{id}. Read-only keys can call it.

from wistfareai import WistfareAI

client = WistfareAI()  # reads WISTFARE_API_KEY

audio = client.text_to_speech.batches.audio("batch_4d81f7", "welcome")
with open("welcome.mp3", "wb") as f:
    f.write(audio)

Path parameters

ParameterTypeDescription
idstringThe batch id, batch_….
refstringThe item's ref.

Response

200 OK with the audio bytes. Audio is kept for 30 days after the batch was created.

Errors

StatusCodeMeaning
401unauthorizedMissing, invalid or revoked API key.
404not_foundUnknown batch or ref, or the item hasn't succeeded (yet).

On this page