AIOZ Stream API
Media
Audio

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:

FieldTypeDescriptionSupported ValuesExamples
resolutionstringA descriptive label for the audio quality."standard", "good", "highest","lossless""highest", "lossless"
typestringThe streaming format."hls", "dash""hls"
container_typestringContainer format for the output stream. Must match the type field.hls: "mpegts", "mp4",
dash: "fmp4"
"mpegts"
audio_configobjectAudio encoding parameters.See details belowSee details below

Audio Config Details

This object configures specific audio encoding parameters:

FieldTypeDescriptionSupported ValuesExample
codecstringCodec for audio encoding"aac""aac"
bitratenumberTarget audio bitrate (bits/sec)Positive integer128000 (~128kbps)
channelsstringNumber of audio channels"2" (stereo)"2"
sample_ratenumberAudio sampling rate (Hz)Typically 44100 or 4800044100
languagestringAudio track language (BCP 47 format)"en", "es", "ja""en"
indexnumberAudio track index from input fileUsually 0 (default track)0

Recommended Audio Bitrates

Audio QualityBitrate (bps)
Standard (Stereo)128,000 – 192,000 bps
High Quality192,000 – 256,000 bps

Your audio must use one of the following valid sample rates:

Sample Rate (Hz)Usage & Quality
8,000Telephone quality (lowest)
11,025Low-quality audio for voice recordings
16,000Suitable for clear speech recordings
22,050Medium-quality voice and music
32,000Higher-quality audio, common for streaming voice
44,100CD-quality audio (standard music/audio)
48,000Professional audio & streaming standard
88,200High-definition audio
96,000Studio-grade audio quality

Important Notes

  • For audio-only content, only the audio_config is required.
  • Supported audio codec: Only AAC is supported.
  • Track Index (index): Specifies which track from the original input file to encode. Typically, this is 0 for 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
      }
    }
  ]
}
POSThttps://api.aiozstream.network/api/media/create

Headers

Authorization Bearer your_access_token_here
or
stream-public-key your_public_key_here
stream-secret-key your_secret_key_here

Body

title* Audio's title
type Type must be "audio"
description Audio's description
is_public Audio public's status
metadata Audio's pairs of key and value
tags Audio's tags
qualities Audio's transcoded qualities

Response

201: Created
{
    "data": {
          "id": "audio_id",
          "user_id": "user_id",
          "type": "audio",
          "title": "audio's title (required)",
          "description": "",
          "metadata": null,
          "tags": null,
          "qualities": [
              {
                  "name": "highest",
                  "status": "done",
                  "type": "hls"
              },
              {
                  "name": "standard",
                  "status": "done",
                  "type": "hls"
              }
          ],
          "captions": null,
          "chapters": null,
          "player_theme": null,
          "duration": 283.492426,
          "size": 5234567,
          "is_mp4": false,
          "is_public": true,
          "status": "done",
          "created_at": "created_at",
          "updated_at": "updated_at",
          "assets": {
              "source_url": "https://api.aiozstream.network/api/media/audio_id/source",
              "thumbnail_url": "https://api.aiozstream.network/api/media/audio_id/thumbnail?resolution=original",
              "hls_url": "https://api.aiozstream.network/api/media/audio_id/m3u8",
              "hls_iframe": "\u003ciframe src=\"https://embed.aiozstream.network/vod/hls/audio_id\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"no\" allowfullscreen=\"true\"\u003e\u003c/iframe\u003e",
              "hls_player_url": "https://embed.aiozstream.network/vod/hls/audio_id",
              "dash_url": "https://api.aiozstream.network/api/media/audio_id/manifest",
              "dash_iframe": "\u003ciframe src=\"https://embed.aiozstream.network/vod/dash/audio_id\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"no\" allowfullscreen=\"true\"\u003e\u003c/iframe\u003e",
              "dash_player_url": "https://embed.aiozstream.network/vod/dash/audio_id",
              "mp4_url": "https://api.aiozstream.network/api/media/audio_id/mp4"
          },
          "player_theme_id": ""
      },
    "status": "success"
}
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.

POSThttps://api.aiozstream.network/api/media

Headers

Authorization Bearer your_access_token_here
or
stream-public-key your_public_key_here
stream-secret-key your_secret_key_here

Body

offset The number of records to skip before starting to return the results (default: 0)
limit The maximum number of records to return in a query (default: 25, max: 100)
sort_by The field or property to sort by (sort_by defaults to created_at and supports: created_at, updated_at, title, size)
order_by The way record should be arranged (orderBy defaults to asc and supports: asc, desc)
type Filter by media type. Use audio to return audios only. If omitted, the response may include other media types
tags Audio's tags (ex: podcast,music)
metadata Audio's metadata (ex: {"genre":"podcast"})
status Audio's status (allowed: new, transcoding, done, fail, deleted)
search The keyword to search in both the title and description fields

Response

200: OK
{
    "status": "success",
    "data": {
        "videos": [
            {
                "id": "audio_id",
                "user_id": "user_id",
                "type": "audio",
                "title": "audio's title",
                "description": "",
                "metadata": null,
                "tags": null,
                "qualities": [
                    {
                        "name": "highest",
                        "status": "done",
                        "type": "hls"
                    },
                    {
                        "name": "standard",
                        "status": "done",
                        "type": "hls"
                    }
                ],
                "captions": null,
                "chapters": null,
                "player_theme": null,
                "duration": 283.492426,
                "size": 5234567,
                "is_mp4": false,
                "is_public": true,
                "status": "done",
                "created_at": "created_at",
                "updated_at": "updated_at",
                "assets": {
                    "source_url": "https://api.aiozstream.network/api/media/audio_id/source",
                    "thumbnail_url": "https://api.aiozstream.network/api/media/audio_id/thumbnail?resolution=original",
                    "hls_url": "https://api.aiozstream.network/api/media/audio_id/m3u8",
                    "hls_iframe": "\u003ciframe src=\"https://embed.aiozstream.network/vod/hls/audio_id\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"no\" allowfullscreen=\"true\"\u003e\u003c/iframe\u003e",
                    "hls_player_url": "https://embed.aiozstream.network/vod/hls/audio_id",
                    "dash_url": "https://api.aiozstream.network/api/media/audio_id/manifest",
                    "dash_iframe": "\u003ciframe src=\"https://embed.aiozstream.network/vod/dash/audio_id\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"no\" allowfullscreen=\"true\"\u003e\u003c/iframe\u003e",
                    "dash_player_url": "https://embed.aiozstream.network/vod/dash/audio_id",
                    "mp4_url": "https://api.aiozstream.network/api/media/audio_id/mp4"
                },
                "player_theme_id": ""
            }
        ],
        "total": 1
    }
}
 
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.

GEThttps://api.aiozstream.network/api/media/:audio_id

Parameters

audio_id The unique identifier of the audio.

Headers

Authorization Bearer your_access_token_here
or
stream-public-key your_public_key_here
stream-secret-key your_secret_key_here

Response

200: OK
{
    "status": "success",
    "data": {
                "id": "audio_id",
                "user_id": "user_id",
                "type": "audio",
                "title": "audio's title",
                "description": "",
                "metadata": null,
                "tags": null,
                "qualities": [
                    {
                        "name": "highest",
                        "status": "done",
                        "type": "hls"
                    },
                    {
                        "name": "standard",
                        "status": "done",
                        "type": "hls"
                    }
                ],
                "captions": null,
                "chapters": null,
                "player_theme": null,
                "duration": 283.492426,
                "size": 5234567,
                "is_public": true,
                "status": "done",
                "created_at": "created_at",
                "updated_at": "updated_at",
                "assets": {
                    "source_url": "https://api.aiozstream.network/api/media/audio_id/source",
                    "thumbnail_url": "https://api.aiozstream.network/api/media/audio_id/thumbnail?resolution=original",
                    "hls_url": "https://api.aiozstream.network/api/media/audio_id/m3u8",
                    "hls_iframe": "\u003ciframe src=\"https://embed.aiozstream.network/vod/hls/audio_id\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"no\" allowfullscreen=\"true\"\u003e\u003c/iframe\u003e",
                    "hls_player_url": "https://embed.aiozstream.network/vod/hls/audio_id",
                    "dash_url": "https://api.aiozstream.network/api/media/audio_id/manifest",
                    "dash_iframe": "\u003ciframe src=\"https://embed.aiozstream.network/vod/dash/audio_id\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"no\" allowfullscreen=\"true\"\u003e\u003c/iframe\u003e",
                    "dash_player_url": "https://embed.aiozstream.network/vod/dash/audio_id"
                },
                "player_theme_id": ""
    }
}
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.

GEThttps://api.aiozstream.network/api/media/cost

Query

qualities Comma-separated list of audio quality presets. (Ex: qualities=good,highest.)
type Type must be "audio"
duration Audio's duration in seconds

Headers

Authorization Bearer your_access_token_here
or
stream-public-key your_public_key_here
stream-secret-key your_secret_key_here

Response

200: OK
{
    "status": "success",
    "data": {
      "price": 0.45,
      "is_enough": true
    }
}
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.

POSThttps://api.aiozstream.network/api/media/:audio_id/part

Parameters

audio_id The unique identifier of the audio.

Headers

Authorization Bearer your_access_token_here
or
stream-public-key your_public_key_here
stream-secret-key your_secret_key_here
Content-Range bytes {start_pos}-{end_pos}/{file_size}

Body

file* The audio file (or chunk) to upload.
index* The index of the part to upload.
hash* MD5 hash of the part's content.

Response

200: OK
{"status":"success","message":"Upload part successfully."}
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.

GEThttps://api.aiozstream.network/api/media/:audio_id/complete

Parameters

audio_id The unique identifier of the audio.

Headers

Authorization Bearer your_access_token_here
or
stream-public-key your_public_key_here
stream-secret-key your_secret_key_here

Response

200: OK
{"status":"success","message":"Upload completed successfully."}
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.

PATCHhttps://api.aiozstream.network/api/media/:audio_id

Parameters

audio_id The unique identifier of the audio.

Headers

Authorization Bearer your_access_token_here
or
stream-public-key your_public_key_here
stream-secret-key your_secret_key_here

Body

title Audio's title
description Audio's description
metadata Pairs of key and value
tags Audio's tags
is_public Whether the audio is publicly available or not (default: true).
player_theme_id The unique Id for the player you want to associate with your audio.

Response

200: OK
{"status":"success","message":"Update audio info successfully."}
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.

DELETEhttps://api.aiozstream.network/api/media/:audio_id

Parameters

audio_id The unique identifier of the audio.

Headers

Authorization Bearer your_access_token_here
or
stream-public-key your_public_key_here
stream-secret-key your_secret_key_here

Response

200: OK
{"status":"success","message":"Audio deleted successfully."}
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'