Swagger Petstore - OpenAPI 3.0
POST/audio/voices

Create a custom voice

Creates a custom voice for use in text-to-speech and audio output endpoints. Supply an audio sample file, a name for the voice, and a previously uploaded consent recording identifier. The audio sample must be a supported format and not exceed 10 MiB.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

3 body fields

Multipart form data containing the voice configuration and audio sample.

namestringrequired
The name of the new voice.
audio_samplestringrequired
The sample audio recording file. Maximum size is 10 MiB. Supported MIME types: `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
consentstringrequired
The consent recording ID (for example, `cons_1234`).

1 status code
200Returns the created voice object with its unique identifier, name, and creation timestamp.
objectstringrequired
The object type, which is always `audio.voice`.
Allowed:audio.voice
idstringrequired
The voice identifier, which can be referenced in API endpoints.
namestringrequired
The name of the voice.
created_atintegerrequired
The Unix timestamp (in seconds) for when the voice was created.

Error handling

name, audio_sample, and consent are all required. audio_sample must be a file in one of the supported MIME types (audio/mpeg, audio/wav, audio/x-wav, audio/ogg, audio/aac, audio/flac, audio/webm, audio/mp4) and not exceed 10 MiB. consent must identify an existing voice consent recording.