client.audio_assets
Uploaded prompts and hold music. These methods are on client.audio_assets, where client is a MoreVoice client (see the Python SDK). On AsyncMoreVoice the same methods are awaited. Each one returns the response object and raises an exception when the API answers with an error.
create()
Section titled “create()”Upload an audio asset. Uploads a WAV (mono or stereo PCM 8–48 kHz, 8/16/24/32-bit or float, or G.711 μ-law / A-law), up to 20 MB and 10 minutes, as multipart/form-data (a file part) or as JSON with the file base64. It is stored as mono 16-bit PCM at up to 16 kHz. MP3 is not accepted: convert it to WAV first.
def create(self, body: _m.AudioAssetsCreateJsonBody | _m.AudioAssetsCreateFilesBody | Mapping[str, Any] | Unset = UNSET, *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.AudioAssetclient.audio_assets.create() · await async_client.audio_assets.create() · POST /audio_assets · API reference
Request body
Section titled “Request body”| Field | Type | Required | Description |
|---|---|---|---|
file |
object |
yes | The recording. JSON uploads send it base64; multipart/form-data uploads send a file part. |
kind |
"prompt" | "music" |
no | Default prompt. |
name |
string |
no | Default: “Prompt” / “Music” with the time. |
text |
string |
no | What the recording says. |
Returns
Section titled “Returns”AudioAsset:
| Field | Type | Description |
|---|---|---|
object |
"audio_asset" |
Always audio_asset. |
id |
string |
A audio asset ID (prefix aud_). |
livemode |
boolean |
true in live mode, false in test mode. |
name |
string |
— |
kind |
"prompt" | "music" |
prompt (an IVR / flow prompt) or music (queue hold music). |
sample_rate |
integer |
The stored rate (mono PCM16, up to 16 kHz). |
duration_ms |
integer |
— |
text |
string |
What the recording says (shown in the flow editor and the transcript). |
created |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
audio_asset = client.audio_assets.create({ "file": { "content_base64": "UklGRiQAAABXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAAZGF0YQAAAAA=", "filename": "welcome.wav", }, "kind": "prompt", "name": "Welcome (Hebrew)", "text": "שלום, הגעתם ל…",})print(audio_asset)delete()
Section titled “delete()”Delete an audio asset. Refused (409) while a flow (draft or a published version) or a queue’s hold audio uses it; details.used_by lists them.
def delete(self, id: str, *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.DeletedAudioAssetclient.audio_assets.delete() · await async_client.audio_assets.delete() · DELETE /audio_assets/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
str |
yes | A audio asset ID (aud_…). |
Returns
Section titled “Returns”DeletedAudioAsset:
| Field | Type | Description |
|---|---|---|
object |
"audio_asset" |
Always audio_asset. |
id |
string |
A audio asset ID (prefix aud_). |
deleted |
true |
— |
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
deleted_audio_asset = client.audio_assets.delete("aud_7Hk2Lm9Qp")print(deleted_audio_asset)list()
Section titled “list()”List audio assets. Returns a page of AudioAsset objects, newest first. Pass next_cursor as starting_after for the next page; the SDKs iterate every page for you.
def list(self, *, limit: int | Unset = 20, starting_after: str | Unset = UNSET, ending_before: str | Unset = UNSET, kind: _m.AudioAssetsListKind | Unset = UNSET, more_voice_version: str | Unset = UNSET) -> AsyncPage[_m.AudioAsset]client.audio_assets.list() · await async_client.audio_assets.list() · GET /audio_assets · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
limit |
integer |
no | How many objects to return, 1–100 (default 20). |
starting_after |
string |
no | A cursor (next_cursor) or object ID: return the objects after it (older). |
ending_before |
string |
no | A cursor or object ID: return the objects before it (newer). |
kind |
"prompt" | "music" |
no | Only prompts or only music. |
Returns
Section titled “Returns”A page of results (AudioAssetList): data, has_more and next_cursor.
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
for audio_asset in client.audio_assets.list(): print(audio_asset)retrieve()
Section titled “retrieve()”Retrieve an audio asset. Returns the AudioAsset object. Answers 404 with the code resource_missing when nothing has this ID in this organisation and mode.
def retrieve(self, id: str, *, more_voice_version: str | Unset = UNSET) -> _m.AudioAssetclient.audio_assets.retrieve() · await async_client.audio_assets.retrieve() · GET /audio_assets/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
str |
yes | A audio asset ID (aud_…). |
Returns
Section titled “Returns”AudioAsset:
| Field | Type | Description |
|---|---|---|
object |
"audio_asset" |
Always audio_asset. |
id |
string |
A audio asset ID (prefix aud_). |
livemode |
boolean |
true in live mode, false in test mode. |
name |
string |
— |
kind |
"prompt" | "music" |
prompt (an IVR / flow prompt) or music (queue hold music). |
sample_rate |
integer |
The stored rate (mono PCM16, up to 16 kHz). |
duration_ms |
integer |
— |
text |
string |
What the recording says (shown in the flow editor and the transcript). |
created |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
audio_asset = client.audio_assets.retrieve("aud_7Hk2Lm9Qp")print(audio_asset)retrieve_content()
Section titled “retrieve_content()”Download an audio asset. The recording as a WAV file (mono 16-bit PCM at its stored rate).
def retrieve_content(self, id: str, *, more_voice_version: str | Unset = UNSET) -> bytesclient.audio_assets.retrieve_content() · await async_client.audio_assets.retrieve_content() · GET /audio_assets/{id}/content · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
str |
yes | A audio asset ID (aud_…). |
Returns
Section titled “Returns”Nothing, on success.
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
data = client.audio_assets.retrieve_content("aud_7Hk2Lm9Qp")print(len(data), "bytes")update()
Section titled “update()”Rename an audio asset. Changes the name or the text (what it says). To replace the audio, upload a new asset.
def update(self, id: str, body: _m.AudioAssetsUpdateBody | Mapping[str, Any] | Unset = UNSET, *, more_voice_version: str | Unset = UNSET) -> _m.AudioAssetclient.audio_assets.update() · await async_client.audio_assets.update() · PATCH /audio_assets/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
str |
yes | A audio asset ID (aud_…). |
Request body
Section titled “Request body”| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
no | — |
text |
string |
no | — |
Returns
Section titled “Returns”AudioAsset:
| Field | Type | Description |
|---|---|---|
object |
"audio_asset" |
Always audio_asset. |
id |
string |
A audio asset ID (prefix aud_). |
livemode |
boolean |
true in live mode, false in test mode. |
name |
string |
— |
kind |
"prompt" | "music" |
prompt (an IVR / flow prompt) or music (queue hold music). |
sample_rate |
integer |
The stored rate (mono PCM16, up to 16 kHz). |
duration_ms |
integer |
— |
text |
string |
What the recording says (shown in the flow editor and the transcript). |
created |
string |
An ISO-8601 timestamp in UTC. |
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
audio_asset = client.audio_assets.update("aud_7Hk2Lm9Qp", { "name": "Welcome (Hebrew, v2)",})print(audio_asset)