Audio
This section covers the Audio API endpoints for managing audio content.
Create audio object
This endpoint is used to programmatically create an audio object.
The request body when creating audio will look like this:
{
"type": "audio",
"title": "string",
"description": "string",
"is_public": true,
"metadata": [
{
"key": "string",
"value": "string"
}
],
"qualities": [
{
"resolution": "string",
"type": "string",
"container_type": "string",
"audio_config": {
"bitrate": 0,
"channels": "string",
"codec": "string",
"index": 0,
"language": "string",
"sample_rate": 0
}
}
],
"tags": ["string"]
}The type field is required and must be set to audio. Requests that omit type will be rejected.
For example, this would be a simplified body for creating audio:
NOTE: For audio objects, qualities[].resolution represents an audio quality preset, not a video resolution.
{
"title": "My Audio Title",
"type": "audio"
}Audio Encoding Configuration
For audio content, you can configure detailed encoding settings to control the audio quality outputs.
Configuration Structure
The qualities field is an array containing one or more objects, each defining specific audio encoding parameters.
Fields available for each quality object:
| Field | Type | Description | Supported Values | Examples |
|---|---|---|---|---|
resolution | string | A descriptive label for the audio quality. | "standard", "good", "highest","lossless" | "highest", "lossless" |
type | string | The streaming format. | "hls", "dash" | "hls" |
container_type | string | Container format for the output stream. Must match the type field. | hls: "mpegts", "mp4",dash: "fmp4" | "mpegts" |
audio_config | object | Audio encoding parameters. | See details below | See details below |
Audio Config Details
This object configures specific audio encoding parameters:
| Field | Type | Description | Supported Values | Example |
|---|---|---|---|---|
codec | string | Codec for audio encoding | "aac" | "aac" |
bitrate | number | Target audio bitrate (bits/sec) | Positive integer | 128000 (~128kbps) |
channels | string | Number of audio channels | "2" (stereo) | "2" |
sample_rate | number | Audio sampling rate (Hz) | Typically 44100 or 48000 | 44100 |
language | string | Audio track language (BCP 47 format) | "en", "es", "ja" | "en" |
index | number | Audio track index from input file | Usually 0 (default track) | 0 |
Recommended Audio Bitrates
| Audio Quality | Bitrate (bps) |
|---|---|
| Standard (Stereo) | 128,000 – 192,000 bps |
| High Quality | 192,000 – 256,000 bps |
Your audio must use one of the following valid sample rates:
| Sample Rate (Hz) | Usage & Quality |
|---|---|
8,000 | Telephone quality (lowest) |
11,025 | Low-quality audio for voice recordings |
16,000 | Suitable for clear speech recordings |
22,050 | Medium-quality voice and music |
32,000 | Higher-quality audio, common for streaming voice |
44,100 | CD-quality audio (standard music/audio) |
48,000 | Professional audio & streaming standard |
88,200 | High-definition audio |
96,000 | Studio-grade audio quality |
Important Notes
- For audio-only content, only the
audio_configis required. - Supported audio codec: Only
AACis supported. - Track Index (
index): Specifies which track from the original input file to encode. Typically, this is0for single-track media.
Example Configurations
Example 1: Audio with Multiple Quality Settings
{
"title": "My Podcast Episode",
"type": "audio",
"qualities": [
{
"resolution": "highest",
"type": "hls",
"container_type": "mpegts",
"audio_config": {
"codec": "aac",
"bitrate": 320000,
"channels": "2",
"sample_rate": 44100,
"language": "en",
"index": 0
}
},
{
"resolution": "standard",
"type": "hls",
"container_type": "mpegts",
"audio_config": {
"codec": "aac",
"bitrate": 128000,
"channels": "2",
"sample_rate": 44100,
"language": "en",
"index": 0
}
}
]
}Example 2: Simple Audio Configuration
{
"title": "My Audio Track",
"type": "audio",
"qualities": [
{
"resolution": "standard",
"type": "dash",
"container_type": "fmp4",
"audio_config": {
"codec": "aac",
"bitrate": 128000,
"channels": "2",
"sample_rate": 44100,
"language": "en",
"index": 0
}
}
]
}Headers
Body
Response
curl --location https://api.aiozstream.network/api/media/create \
--header 'Authorization: Bearer your_access_token_here' \
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here' \
--header 'Content-Type: application/json' \
--data '{
"title": "My Audio Title",
"type": "audio"
}'List audio
This endpoint lists and searches audios with multiple filters.
Headers
Body
Response
curl 'https://api.aiozstream.network/api/media' \
-H 'authorization: Bearer your_access_token_here' \
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here' \
-H 'Content-Type: application/json' \
--data-raw '{"limit":10,"offset":0,"sort_by":"created_at","order_by":"desc","type":"audio"}' \Get audio detail
This API will show audio's detail.
NOTE: Audio outputs do not expose mp4_url.
Parameters
Headers
Response
curl --location 'https://api.aiozstream.network/api/media/audio_id' \
--header 'authorization: Bearer your_access_token_here'
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here'Calculate transcode price
Calculates an estimated transcode cost based on the selected audio quality presets and the media duration. The returned price is in USD.
Query
Headers
Response
curl --location 'https://api.aiozstream.network/api/media/cost?duration=60&type=audio&qualities=highest%2Cstandard' \
--header 'Authorization: Bearer your_access_token_here'
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here'Upload audio part
This API allows you to upload your audio or a part of it. If your file size is larger than the chunk size (chunk size: 50MB – 200MB), split the file into parts and upload each one sequentially.
Parameters
Headers
Body
Response
curl --location 'https://api.aiozstream.network/api/media/audio_id/part' \
--header 'Authorization: Bearer your_access_token_here' \
--header 'Content-Range: bytes 0-49999999/100000000' \
--form 'hash="part_content_md5_hash"' \
--form 'index="0"' \
--form 'file=@"/path/to/file"'Upload audio completed
This API notifies the server that the audio upload process is done. Call this endpoint after all parts have been uploaded successfully.
Parameters
Headers
Response
curl --location 'https://api.aiozstream.network/api/media/audio_id/complete' \
--header 'Authorization: Bearer your_access_token_here'Update audio info
This API allows you to update audio's information.
Parameters
Headers
Body
Response
curl --location --request PATCH 'https://api.aiozstream.network/api/media/audio_id' \
--header 'Authorization: Bearer your_access_token_here' \
--header 'Content-Type: application/json' \
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here' \
--data '{
"description": "string",
"player_theme_id": "string",
"is_public": true,
"metadata": [
{
"key": "string",
"value": "string"
}
],
"tags": [
"string"
],
"title": "string"
}'Delete audio
Deletes an audio object by ID.
Parameters
Headers
Response
curl --location --request DELETE 'https://api.aiozstream.network/api/media/audio_id' \
--header 'Authorization: Bearer your_access_token_here'
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here'