Livestreams API
Endpoints for livestream management. Requires API Key authentication.
Create Livestream
Create a new livestream.
http
POST /livestreamHeaders
| Header | Value |
|---|---|
ls-api-key | <your_api_key> |
Content-Type | application/json |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Stream name |
projectId | string | Yes | Project UUID |
mediaServerId | string | Yes | Media server UUID |
Example
bash
curl -X POST https://api.lunarstream.kozow.com/api/v1/livestream \
-H "ls-api-key: ls_proj_v1_ydi3lLihcIW0Z9ZAkGz2BjV6caLYqzK41TQAGblW-4E" \
-H "Content-Type: application/json" \
-d '{
"name": "My Live Stream",
"projectId": "ce4b77e3-3ed0-47ee-a307-ade5f3fbef91",
"mediaServerId": "40fb0295-9fdf-4a97-b1a8-43cdc64dd512"
}'javascript
const response = await fetch('https://api.lunarstream.kozow.com/api/v1/livestream', {
method: 'POST',
headers: {
'ls-api-key': process.env.LUNAR_STREAM_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'My Live Stream',
projectId: 'ce4b77e3-3ed0-47ee-a307-ade5f3fbef91',
mediaServerId: '40fb0295-9fdf-4a97-b1a8-43cdc64dd512'
})
});Response
json
{
"data": {
"id": "d926da37-56ae-4212-83bc-f20d9de64d6b",
"name": "My Live Stream",
"status": "READY_FOR_USE",
"streamKey": "ee04affe2a669854052102fe762bd715",
"pushToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"hlsPaths": [
"https://stream.lunarstream.kozow.com/live/ee04affe2a669854052102fe762bd715/hls.m3u8"
],
"hlsSources": [
{
"name": "original",
"url": "https://stream.lunarstream.kozow.com/live/ee04affe2a669854052102fe762bd715/hls.m3u8"
}
],
"rmtpServer": "rtmp://stream.lunarstream.kozow.com/live",
"streamKeyWithParams": "ee04affe2a669854052102fe762bd715?pushToken=eyJhbGci...",
"previewPlayback": "https://api.lunarstream.kozow.com/api/v1/livestreams/preview-playback/ee04affe2a669854052102fe762bd715",
"createdAt": "2026-01-12T18:12:38.918Z",
"mediaServer": {
"id": "40fb0295-9fdf-4a97-b1a8-43cdc64dd512",
"name": "zlmediakit",
"serverType": "ZLMediaKIT",
"host": "stream.lunarstream.kozow.com",
"port": 1935
}
},
"meta": {}
}Response Fields
| Field | Description |
|---|---|
streamKey | Unique stream identifier |
pushToken | JWT token for RTMP authentication |
rmtpServer | RTMP server URL |
streamKeyWithParams | Stream key with push token (use in OBS) |
hlsSources | Array of HLS playback URLs |
previewPlayback | URL to preview the stream |
Get Livestream
Get a specific livestream by ID.
http
GET /livestream/:idHeaders
| Header | Value |
|---|---|
ls-api-key | <your_api_key> |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | Project UUID |
Example
bash
curl -X GET "https://api.lunarstream.kozow.com/api/v1/livestream/d926da37-56ae-4212-83bc-f20d9de64d6b?projectId=ce4b77e3-3ed0-47ee-a307-ade5f3fbef91" \
-H "ls-api-key: ls_proj_v1_ydi3lLihcIW0Z9ZAkGz2BjV6caLYqzK41TQAGblW-4E"Response
json
{
"data": {
"id": "d926da37-56ae-4212-83bc-f20d9de64d6b",
"name": "My Live Stream",
"status": "READY_FOR_USE",
"streamKey": "ee04affe2a669854052102fe762bd715",
"hlsPaths": [
"https://stream.lunarstream.kozow.com/live/ee04affe2a669854052102fe762bd715/hls.m3u8",
"https://zlmediakit-cdn.b-cdn.net/live/ee04affe2a669854052102fe762bd715/hls.m3u8",
"https://gcore-zlmediakit.lunarstream.kozow.com/live/ee04affe2a669854052102fe762bd715/hls.m3u8"
],
"rmtpServer": "rtmp://stream.lunarstream.kozow.com/live"
},
"meta": {}
}