Skip to content
Products

HTTP API Quick Start

This article shows how to log in to the Alta HTTP API and publish a channel with curl. For an overview of roles, response codes, and conventions, read HTTP API.

  • Requests go to the API Server (default port 8100), not to the OTT Server. Read more HTTP Server.
  • You need a user of the Alta web interface with the admin role. Read more Users.

The API supports two methods:

  • Bearer token: Get a token with /api/login and send it in the Authorization: Bearer <token> header.
  • HTTP Basic: Send the login and the password of the user in every request.

Log in:

Terminal window
curl -sS -X POST 'http://alta.example.com:8100/api/login' \
-H 'Content-Type: application/json' \
-d '{"id": "admin", "password": "PASSWORD"}'

The response is the token as plain text. Save it in a variable:

Terminal window
TOKEN=$(curl -sS -X POST 'http://alta.example.com:8100/api/login' \
-H 'Content-Type: application/json' \
-d '{"id": "admin", "password": "PASSWORD"}')

Check the token with the application information request:

Terminal window
curl -sS -H "Authorization: Bearer $TOKEN" 'http://alta.example.com:8100/api/about'

With HTTP Basic, use the -u option of curl instead of the token:

Terminal window
curl -sS -u 'admin:PASSWORD' 'http://alta.example.com:8100/api/about'

A channel needs a receiver with the input stream. Create the receiver first, then the channel that uses it.

1. Create a receiver:

Terminal window
curl -sS -X POST 'http://alta.example.com:8100/api/ott/receiver' \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"id": "news-source",
"name": "News source",
"source": "udp://239.1.1.1:1234",
"enable": true
}'

2. Create a channel with one variant:

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

Both requests return 204 with an empty body.

3. Open the playlist in a player. The playlist is served by the OTT Server, not by the API Server:

http://alta.example.com:<ott-port>/news/index.m3u8

The OTT port is set in Settings → HTTP Servers. Read more about playlist addresses in URL Format for HLS Access.

4. Check the viewers:

Terminal window
curl -sS -H "Authorization: Bearer $TOKEN" 'http://alta.example.com:8100/api/ott/sessions/status'

To remove the example, delete the channel first, then the receiver:

Terminal window
curl -sS -X DELETE -H "Authorization: Bearer $TOKEN" 'http://alta.example.com:8100/api/ott/channel?id=news'
curl -sS -X DELETE -H "Authorization: Bearer $TOKEN" 'http://alta.example.com:8100/api/ott/receiver?id=news-source'
  • Channels: variants, archive storage, access control, start and stop.
  • Receivers: sources and import from an M3U playlist.
  • Authorizers: protect channels with IP rules or Securetoken.