# Upload an audio asset

`POST https://api.morevoice.ai/v1/audio_assets`

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.

Authenticate with a secret API key: `Authorization: Bearer $MOREVOICE_API_KEY`.

Operation ID: `audio_assets_create`.

## Parameters

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `MoreVoice-Version` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |
| `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. |

## Request body

Required, `application/json` or `multipart/form-data`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `file` | `object` | yes | The recording. JSON uploads send it base64; multipart/form-data uploads send a `file` part. |
| `file.content_base64` | `string` | yes | The WAV file, base64 (up to 20 MB of audio). |
| `file.filename` | `string` | no | — |
| `kind` | `"prompt" \| "music"` | no | Default prompt. |
| `name` | `string` | no | Default: “Prompt” / “Music” with the time. |
| `text` | `string` | no | What the recording says. |

Example:

```json
{
  "file": {
    "content_base64": "UklGRiQAAABXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAAZGF0YQAAAAA=",
    "filename": "welcome.wav"
  },
  "kind": "prompt",
  "name": "Welcome (Hebrew)",
  "text": "שלום, הגעתם ל…"
}
```

## Responses

### 201 Created

Created. Returns `AudioAsset`.

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"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:

```json
{
  "created": "2026-11-03T09:14:22.000Z",
  "duration_ms": 4210,
  "id": "aud_8b2KxQ4mLp9",
  "kind": "prompt",
  "livemode": true,
  "name": "Welcome (Hebrew)",
  "object": "audio_asset",
  "sample_rate": 16000,
  "text": "שלום, הגעתם ל…"
}
```

### 400 Bad Request

The request is invalid: a parameter is missing, malformed or unknown, or the version header is unknown. Returns `ErrorEnvelope`.

### 401 Unauthorized

No valid API key was sent. Returns `ErrorEnvelope`.

### 403 Forbidden

The key may not do this (a missing scope, a plan limit, or a compliance block). Returns `ErrorEnvelope`.

### 409 Conflict

The request conflicts with the object's state, or the Idempotency-Key was reused with other parameters. Returns `ErrorEnvelope`.

### 429 Too Many Requests

Too many requests, or no call capacity right now. Retry after the Retry-After delay. Returns `ErrorEnvelope`.

### 500 Internal Server Error

Something went wrong on MoreVoice's side. Retry with the same Idempotency-Key. Returns `ErrorEnvelope`.

## Code samples

**TypeScript**

```ts
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);
```

**Python**

```python
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)
```

**cURL**

```sh
curl -X POST https://api.morevoice.ai/v1/audio_assets \
  -H "Authorization: Bearer $MOREVOICE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "file": {
    "content_base64": "UklGRiQAAABXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAAZGF0YQAAAAA=",
    "filename": "welcome.wav"
  },
  "kind": "prompt",
  "name": "Welcome (Hebrew)",
  "text": "שלום, הגעתם ל…"
}'
```
