mv.audioAssets
Uploaded prompts and hold music. These methods are on mv.audioAssets, where mv is your client (see the Node.js SDK). Each one returns the response object and throws 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.
mv.audioAssets.create(body: AudioAssetsCreateData["body"], options?: RequestOptions): Promise<AudioAssetsCreateResponse>POST /audio_assets · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
body.file |
object |
yes | The recording. JSON uploads send it base64; multipart/form-data uploads send a file part. |
body.kind |
"prompt" | "music" |
no | Default prompt. |
body.name |
string |
no | Default: “Prompt” / “Music” with the time. |
body.text |
string |
no | What the recording says. |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options.headers["Idempotency-Key"] |
string |
no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
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”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const audioAsset = await mv.audioAssets.create({ file: { content_base64: "UklGRiQAAABXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAAZGF0YQAAAAA=", filename: "welcome.wav", }, kind: "prompt", name: "Welcome (Hebrew)", text: "שלום, הגעתם ל…",});console.log(audioAsset);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.
mv.audioAssets.delete(id: AudioAssetsDeleteData["path"]["id"], options?: RequestOptions): Promise<AudioAssetsDeleteResponse>DELETE /audio_assets/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A audio asset ID (aud_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options.headers["Idempotency-Key"] |
string |
no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
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”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const deletedAudioAsset = await mv.audioAssets.delete("aud_7Hk2Lm9Qp");console.log(deletedAudioAsset);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.
mv.audioAssets.list(query?: NonNullable<AudioAssetsListData["query"]>, options?: RequestOptions): PagedList<AudioAssetsListResponse["data"][number], NonNullable<AudioAssetsListData["query"]>>GET /audio_assets · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
query.limit |
integer |
no | How many objects to return, 1–100 (default 20). |
query.starting_after |
string |
no | A cursor (next_cursor) or object ID: return the objects after it (older). |
query.ending_before |
string |
no | A cursor or object ID: return the objects before it (newer). |
query.kind |
string |
no | Only prompts or only music. |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”A PagedList: await it for the first page, for await it for every item.
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
for await (const audioAsset of mv.audioAssets.list()) { console.log(audioAsset);}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.
mv.audioAssets.retrieve(id: AudioAssetsRetrieveData["path"]["id"], options?: RequestOptions): Promise<AudioAssetsRetrieveResponse>GET /audio_assets/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A audio asset ID (aud_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
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”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const audioAsset = await mv.audioAssets.retrieve("aud_7Hk2Lm9Qp");console.log(audioAsset);retrieveContent()
Section titled “retrieveContent()”Download an audio asset. The recording as a WAV file (mono 16-bit PCM at its stored rate).
mv.audioAssets.retrieveContent(id: AudioAssetsRetrieveContentData["path"]["id"], options?: RequestOptions): Promise<AudioAssetsRetrieveContentResponse>GET /audio_assets/{id}/content · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A audio asset ID (aud_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”Nothing, on success.
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const data = await mv.audioAssets.retrieveContent("aud_7Hk2Lm9Qp");console.log(data);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.
mv.audioAssets.update(id: AudioAssetsUpdateData["path"]["id"], body?: AudioAssetsUpdateData["body"], options?: RequestOptions): Promise<AudioAssetsUpdateResponse>PATCH /audio_assets/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A audio asset ID (aud_…). |
body.name |
string |
no | |
body.text |
string |
no | |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
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”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const audioAsset = await mv.audioAssets.update("aud_7Hk2Lm9Qp", { name: "Welcome (Hebrew, v2)",});console.log(audioAsset);