
A live streaming API lets your code set up a broadcast, give an encoder somewhere to send video, track the stream's health and collect the recording. On AIOZ Stream that takes four documented endpoints plus one RTMP push from your encoder, and this tutorial walks you through them in order.
TL;DR:
POST /live_streams/{key_id}/streamings; a title is required and save defaults to false.hls_url, player_url or iframe.POST /live_streams/{key_id}/media lists the recordings of sessions created with save: true.A live streaming API is the control plane for a broadcast. It creates the event, hands out ingest details, reports health and tells you where the recording ended up. The video itself goes from an encoder to an ingest server over a protocol such as RTMP, outside the REST calls. For the full path from camera to screen, read how live streaming works from encoder to viewer, and look up unfamiliar terms in our video streaming glossary.
Most live APIs model the same few objects under different names. YouTube's Live Streaming API separates a broadcast, the event people watch, from a stream, the video your encoder sends, and you bind one to the other before going live. AIOZ Stream uses a stream key plus a streaming session, a split we explain in stream key vs streaming session. The diagram maps each step of a broadcast to its endpoint.

Every call goes to https://api.aiozstream.network/api and authenticates with a Bearer token or the stream-public-key and stream-secret-key headers. Use a full-access key, because the API key guide says an upload-only key can only upload content.
You also need a stream key before you can create a session. You make keys in the dashboard's Live Streaming tab, each with a name and a type of Video or Audio. The HTML API reference has no key endpoints, but the official Node.js client 1.0.16 lists createLiveStreamKey on POST /live_streams, plus calls to list, update and delete keys. We read these in the package source on October 29, 2026.
Plan your polling against the rate limits of 100 upload, 200 write and 500 read requests per minute. Going over returns HTTP 429 with X-RateLimit headers, as our guide to handling API rate limits explains.
Send a POST to /live_streams/{key_id}/streamings with a title. Add save: true if you want a recording, and list the output qualities you need. The live-streaming reference allows 240p to 1080p, with HLS in mpegts or mp4 containers and DASH in fmp4. This request is adapted from the Streamings API page with the key headers switched on; we didn't run it for this post:
curl --location --request POST 'https://api.aiozstream.network/api/live_streams/KEY_ID/streamings' \
--header 'stream-public-key: YOUR_PUBLIC_KEY' \
--header 'stream-secret-key: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Product launch Q and A",
"save": true,
"qualities": [
{ "resolution": "720p", "type": "hls", "container_type": "mpegts" },
{ "resolution": "1080p", "type": "hls", "container_type": "mpegts" }
]
}'The documented response returns the session with an id, a status of created, viewer counters at zero and an assets block. Store the id. The Node.js client names this call "Create a new live stream media", and the statistics endpoint asks for a live stream media ID. So this is the value we pass to it. The assets are for your viewers: play hls_url in your own player, link to player_url, or embed the iframe.
Then start your encoder, which sends video over RTMP to the server URL shown with your stream key. The session itself is optional. The Create Livestream guide says AIOZ Stream creates the live stream entry automatically when streaming starts with valid credentials. Create one through the API when the title, recording or qualities must be fixed before the show.
Poll GET /live_streams/statistic/{stream_media_id}. It returns fps_in and bitrate_in for what your encoder sends, fps_out and bitrate_out for what AIOZ Stream delivers, and data_transferred in megabytes. Bitrates are in Kbps; the docs' sample shows 60 FPS both ways, about 8,029 Kbps in and 8,406 Kbps out. Which gaps signal trouble is the subject of monitoring livestream health, so this section only gets the numbers into your code.
For the audience side, each session in GET /live_streams/{key_id}/streamings carries status, current_view and total_view, which the reference shows without defining. A monitor that wants both makes two reads per cycle. This script does that every 10 seconds on Node.js 18 or later:
// poll-live-stats.mjs usage: node poll-live-stats.mjs KEY_ID SESSION_ID
const BASE = 'https://api.aiozstream.network/api';
const HEADERS = {
'stream-public-key': process.env.AIOZ_PUBLIC_KEY,
'stream-secret-key': process.env.AIOZ_SECRET_KEY,
};
const [keyId, sessionId] = process.argv.slice(2);
async function call(path) {
const res = await fetch(BASE + path, { headers: HEADERS });
const body = await res.json();
if (!res.ok) throw new Error(`${res.status} ${body.reason ?? body.message}`);
return body.data;
}
async function tick() {
const stats = await call(`/live_streams/statistic/${sessionId}`);
const { medias } = await call(`/live_streams/${keyId}/streamings`);
const session = medias.find((s) => s.id === sessionId);
console.log(
new Date().toISOString(),
`in ${Math.round(stats.bitrate_in)} kbps ${stats.fps_in} fps`,
`out ${Math.round(stats.bitrate_out)} kbps ${stats.fps_out} fps`,
`status=${session?.status} current_view=${session?.current_view}`
);
}
const timer = setInterval(() => {
tick().catch((err) => {
console.error('stopping:', err.message);
clearInterval(timer);
});
}, 10_000);We ran it on October 29, 2026 with placeholder keys under Node.js 22, and it stopped on the first call with this output:
stopping: 401 api-key-not-foundA made-up path returned the same api-key-not-found body, so a 401 doesn't prove an endpoint exists. At 10 seconds the script makes 12 reads per minute per session. If these GETs count as reads, the 500-per-minute limit covers about 41 sessions per account.
Some live APIs push state changes instead; Cloudflare Stream, for one, can notify you on live_input.connected and live_input.disconnected. AIOZ Stream's webhooks cover upload and encoding events, from file_received to encoding_failed, as our post on event-driven pipelines with webhooks shows. For a running session, polling is the documented path.
If you created the session with save: true, the broadcast is kept as a standard video. You list those recordings with POST /live_streams/{key_id}/media, which takes offset, limit (25 by default, 100 at most), sorting and a search string in the body. Each item holds the session's title, duration and assets, plus a nested video object with its own qualities. What you lose with save off is covered in what live to VOD means.
To rename a session or change its save flag, the reference documents PUT /live_streams/{key_id}/streamings. Its path carries the key ID and no session ID, so test it before an important event. To send the broadcast to YouTube or Twitch as well, attach those destinations to the stream key as described in restreaming with AIOZ Stream multicast.
We built the live API around the same split the dashboard uses: a stream key per channel, a session per broadcast, statistics per session and saved media per key. A scripted run is five steps: create the session, start the encoder, poll statistics and the session list, then list the saved media. The AIOZ Stream developer guide shows where these endpoints sit in the wider API.
What the docs don't cover yet:
status beyond created, and what current_view and total_view count;Next step: open the Streamings API reference and create your first session with a test title.
Can I send video through the AIOZ Stream REST API?
No. The API sets up and monitors the broadcast, and your encoder sends the video over RTMP with the server URL and stream key.
Do I have to create a session before going live?
No. AIOZ Stream creates the live stream entry automatically when streaming starts with valid credentials; a session lets you fix the title, recording and qualities first.
How often should I poll live stream statistics?
Every 10 seconds is a sensible default, because AIOZ Stream updates the statistics every 5 to 30 seconds and faster polling only spends your read quota.
Does the live streaming API record my stream?
Only if you set save: true when you create the session, since the default is false.
Can I get the viewer count from the API?
The session object carries current_view and total_view, though the reference doesn't define them. The documented statistics response covers FPS, bitrate and data transferred only.

MPEG-DASH streams adaptive video over HTTP from an XML MPD file. See a real MPD: Periods, AdaptationSets, Representations, segment addressing and live MPDs.

What is CMAF? The ISO format that packages video as fragmented MP4 so one set of files serves HLS and DASH, with its chunks, brands and low-latency role.

CBR vs VBR vs CRF explained: what each video rate control mode holds fixed, how maxrate and bufsize cap it, our x264 test results, and which mode to use where.

A live streaming API tutorial for AIOZ Stream: create a session, push RTMP, poll real-time stats every 5 to 30 seconds, then list the saved recordings.

Restream to multiple platforms by sending one feed to a relay. Learn the bandwidth math, platform rules and how AIOZ Stream multicast forwards your RTMP stream.

MPEG-TS vs fMP4 for HLS: how 188-byte TS packets and fMP4 init segments differ, what each costs in overhead, which codecs need fMP4, and when TS still fits.