Uploads an audio file and stores it in the workspace. Use an asset of kind hold_music as custom hold music during warm transfers by setting on_hold_music to its asset_id. Files go to S3 when the deployment has S3 configured, and to local disk otherwise.
Request#
Send the file either as multipart/form-data or as JSON with base64 content.
Multipart#
| Part | Type | Required | Description |
|---|---|---|---|
file |
file | Yes | The audio file. Its content type is used as the asset's mime_type. |
name |
string | No | Display name. Defaults to the uploaded file name. |
kind |
string | No | hold_music (default) or audio. |
JSON#
| Field | Type | Required | Description |
|---|---|---|---|
mime_type |
string | Yes | Content type of the audio, for example audio/mpeg. |
content_base64 |
string | Yes | The file, base64 encoded. |
name |
string | No | Display name. Defaults to the asset_id. |
kind |
string | No | hold_music (default) or audio. |
Limits#
- Accepted types:
audio/wav,audio/x-wav,audio/wave,audio/mpeg,audio/mp3,audio/ogg,audio/opus,audio/webm,audio/flac,audio/aac,audio/mp4. - Up to 10 MB. Empty files are rejected.
- Names are cut to 200 characters.
Example request#
curl -X POST https://api.tried.com.au/create-asset \
-H "Authorization: Bearer $TRIED_API_KEY" \
-F "file=@hold-music.mp3;type=audio/mpeg" \
-F "name=Hold music" \
-F "kind=hold_music"import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("file", new Blob([await readFile("hold-music.mp3")], { type: "audio/mpeg" }), "hold-music.mp3");
form.append("name", "Hold music");
form.append("kind", "hold_music");
const res = await fetch("https://api.tried.com.au/create-asset", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.TRIED_API_KEY}` },
body: form,
});
const asset = await res.json();import os, requests
with open("hold-music.mp3", "rb") as f:
res = requests.post(
"https://api.tried.com.au/create-asset",
headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
files={"file": ("hold-music.mp3", f, "audio/mpeg")},
data={"name": "Hold music", "kind": "hold_music"},
)
asset = res.json()Response#
201 Created
{
"asset_id": "asset_3c8e1a5f7b9d2e4a6c0f1b3d",
"name": "Hold music",
"kind": "hold_music",
"mime_type": "audio/mpeg",
"size_bytes": 1843200,
"url": "https://api.tried.com.au/public/assets/asset_3c8e1a5f7b9d2e4a6c0f1b3d?exp=1760922000000&sig=8f2c4e6a1b3d5f7a9c0e2b4d6f8a1c3e5b7d9f0a2c4e6b8d1f3a5c7e9b0d2f4a",
"created_timestamp": 1760918400000
}| Field | Type | Description |
|---|---|---|
asset_id |
string | Use it as on_hold_music on a warm transfer. |
size_bytes |
integer | File size in bytes. |
url |
string | Signed download link. Works without an API key and expires 1 hour after the response was made. Fetch the asset again for a fresh link. |
Errors#
| Status | When |
|---|---|
400 |
file is required, kind must be one of hold_music, audio, Assets must be audio files (wav, mp3, ogg, opus, webm, flac, aac, m4a), The asset file is empty, Assets are limited to 10 MB, or a JSON field is missing. |
401 |
Missing or invalid API key. |
403 |
The key's IP allowlist or scopes reject the request. This route needs the admin scope. Dashboard members get The member role is read-only. |
429 |
Rate limit exceeded. See Rate limits. |
See Errors for the body format.