Skip to content
Products

Channels API

A channel is the stream address that viewers open. A channel has one or more variants, for example different bitrates. Each variant takes its input from a receiver.

IDs in the API:

  • Channel ID: the path in the playlist URL, for example news. Use letters, digits, -, _, and /.
  • Variant ID: the channel ID and the variant name, for example news/main.

Create, change, and delete requests work with the whole channel. Start and stop requests work with one variant.

{
"id": "news",
"name": "News",
"enable": true,
"storage": "archive",
"duration": 48,
"authorizer": "token-auth",
"tvg_id": 101,
"tvg_logo": "https://example.com/news.png",
"variants": {
"main": { "enable": true, "receiver": "news-source" },
"low": { "enable": true, "receiver": "news-low-source" }
}
}
  • id: Channel ID.
  • name: Name of the channel. Required.
  • enable: Starts or stops all variants of the channel.
  • storage (optional): ID of the storage for the archive.
  • duration (optional): Archive duration for this channel in hours. Overrides the duration of the storage.
  • authorizer (optional): ID of the authorizer that protects the channel.
  • tvg_id, tvg_logo (optional): EPG identifier and logo for the M3U playlist.
  • variants: Object with the variants by name. At least one variant is required.
    • enable: Enables the variant.
    • receiver: ID of the receiver. Required.
    • old_name: Only for PUT. See Update a Channel.
Terminal window
POST /api/ott/channel

Example:

Terminal window
curl -sS -X POST -H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
'http://alta.example.com:8100/api/ott/channel' \
-d '{
"id": "news",
"name": "News",
"enable": true,
"storage": "archive",
"variants": {
"main": { "enable": true, "receiver": "news-source" }
}
}'
CodeDescription
204The channel is created
400A variant has no receiver, or an enabled variant cannot start. The body has the reason
409The channel already exists, or one receiver is used by more than one variant
422No name or no variants
Terminal window
PUT /api/ott/channel?id=<channel_id>

Send the complete channel object. The id in the body must be the same as in the query parameter.

Alta compares the variants in the request with the variants it has by the old_name field:

  • A variant that exists: set old_name to its current name. Without old_name, Alta treats the variant as new and deletes the existing variant with the same name.
  • A new variant: do not set old_name.
  • A renamed variant: set old_name to the previous name and put the new name in the key.
  • A variant you want to remove: omit it from the request.

Example: keep main, rename low to sd, and add hd:

Terminal window
curl -sS -X PUT -H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
'http://alta.example.com:8100/api/ott/channel?id=news' \
-d '{
"id": "news",
"name": "News",
"enable": true,
"variants": {
"main": { "enable": true, "receiver": "news-source", "old_name": "main" },
"sd": { "enable": true, "receiver": "news-low-source", "old_name": "low" },
"hd": { "enable": true, "receiver": "news-hd-source" }
}
}'

When the channel enable value differs from its current state, Alta applies it to all variants. To turn off one variant, keep the channel enable as it is and change the variant enable. To start or stop one variant without a full update, use Start and Stop.

Changing the storage of a channel removes the archive recorded in the previous storage.

CodeDescription
204The channel is updated
400A variant cannot start. The body has the reason
404A variant from old_name does not exist
409One receiver is used by more than one variant
422No variants
Terminal window
DELETE /api/ott/channel?id=<channel_id>

Alta stops and removes all variants of the channel.

Returns 204, or 404 if the channel does not exist.

Terminal window
POST /api/ott/channel/start?id=<channel_id>/<variant>
POST /api/ott/channel/stop?id=<channel_id>/<variant>

Example:

Terminal window
curl -sS -X POST -H "Authorization: Bearer $TOKEN" \
'http://alta.example.com:8100/api/ott/channel/stop?id=news/main'

The requests change the enable value of the variant and save it, so the state stays after a restart of Alta. A repeated request is not an error.

CodeDescription
204Done
400The variant cannot start. The body has the reason
404The variant does not exist
Terminal window
GET /api/ott/channel/storage?id=<channel_id>/<variant>

Returns the archive of the variant as continuous blocks. A gap in the recording starts a new block. Available to admin and observer.

Response:

[
{ "start_time": 1747485787, "size": 1572864000, "duration": 3600 }
]
  • start_time: Start of the block as a Unix timestamp.
  • size: Size of the block in bytes.
  • duration: Duration of the block in seconds.

Returns 204 if the channel has no storage, and 404 if the variant does not exist. To get the MP4 preview clips of the archive, read Preview API.

Terminal window
PUT /api/ott/channel/exportm3u

Builds an M3U playlist from the list you send. Alta adds the archive parameters to channels that have a storage, and the EPG parameters to channels that have tvg_id or tvg_logo. Available to admin and observer.

The body is an object. Each item has the id of the channel, the name for the playlist, and the full address of the playlist on the OTT Server:

Terminal window
curl -sS -X PUT -H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
'http://alta.example.com:8100/api/ott/channel/exportm3u' \
-d '{
"news": {
"id": "news",
"name": "News",
"address": "http://alta.example.com:8101/news/index.m3u8"
}
}'

Response (plain text):

#EXTM3U
#EXTINF:-1 tvg-id="101" catchup="append" catchup-days="2" catchup-source="?start=${start}", News
http://alta.example.com:8101/news/index.m3u8

Read more about the playlist parameters in Export M3U8.