Skip to content

Public APIs

Public APIs do not require authentication. These are designed for viewer applications to retrieve stream information.

Get Stream Info

Get public stream information by stream key. Use this to get HLS URLs for playback.

http
GET /livestreams/stream-info/:streamKey

Path Parameters

ParameterTypeDescription
streamKeystringThe stream key (32-char hex)

Example

bash
curl -X GET "https://api.lunarstream.kozow.com/api/v1/livestreams/stream-info/ee04affe2a669854052102fe762bd715"
javascript
const response = await fetch(
  'https://api.lunarstream.kozow.com/api/v1/livestreams/stream-info/ee04affe2a669854052102fe762bd715'
);
const { data } = await response.json();
console.log(data.hlsSources); // HLS URLs for playback
python
import requests

response = requests.get(
    'https://api.lunarstream.kozow.com/api/v1/livestreams/stream-info/ee04affe2a669854052102fe762bd715'
)
data = response.json()['data']
print(data['hlsSources'])  # HLS URLs for playback

Response

json
{
  "data": {
    "id": "d926da37-56ae-4212-83bc-f20d9de64d6b",
    "name": "Partner Test Stream",
    "status": "READY_FOR_USE",
    "streamKey": "ee04affe2a669854052102fe762bd715",
    "hlsPaths": [
      "https://stream.lunarstream.kozow.com/live/ee04affe2a669854052102fe762bd715/hls.m3u8"
    ],
    "hlsSources": [
      {
        "name": "original",
        "url": "https://stream.lunarstream.kozow.com/live/ee04affe2a669854052102fe762bd715/hls.m3u8"
      }
    ],
    "startedAt": null,
    "endedAt": null,
    "createdAt": "2026-01-12T18:12:38.918Z",
    "rmtpServer": "rtmp://stream.lunarstream.kozow.com/live",
    "previewPlayback": "https://api.lunarstream.kozow.com/api/v1/livestreams/preview-playback/ee04affe2a669854052102fe762bd715"
  },
  "meta": {}
}

Response Fields

FieldDescription
statusStream status: READY_FOR_USE, STARTED, ENDED
hlsSourcesArray of HLS playback URLs
hlsPathsArray of HLS URL strings
previewPlaybackURL to preview player page

Preview Playback

Get an HTML page with embedded video player for stream preview.

http
GET /livestreams/preview-playback/:streamKey

Path Parameters

ParameterTypeDescription
streamKeystringThe stream key

Example

Open in browser:

https://api.lunarstream.kozow.com/api/v1/livestreams/preview-playback/ee04affe2a669854052102fe762bd715

Response

Returns an HTML page with an embedded HLS video player.


Use Cases

Viewer App Integration

javascript
// In your viewer app, fetch stream info and play
async function playStream(streamKey) {
  const response = await fetch(
    `https://api.lunarstream.kozow.com/api/v1/livestreams/stream-info/${streamKey}`
  );
  const { data } = await response.json();
  
  if (data.status === 'STARTED') {
    // Stream is live, play it
    const hlsUrl = data.hlsSources[0].url;
    videoPlayer.src = hlsUrl;
    videoPlayer.play();
  } else {
    // Stream not live yet
    showMessage('Stream is not live');
  }
}

Mobile App Integration

javascript
// React Native example
import Video from 'react-native-video';

const StreamPlayer = ({ streamKey }) => {
  const [streamUrl, setStreamUrl] = useState(null);
  
  useEffect(() => {
    fetch(`https://api.lunarstream.kozow.com/api/v1/livestreams/stream-info/${streamKey}`)
      .then(res => res.json())
      .then(({ data }) => {
        if (data.hlsSources?.length > 0) {
          setStreamUrl(data.hlsSources[0].url);
        }
      });
  }, [streamKey]);
  
  if (!streamUrl) return <Text>Loading...</Text>;
  
  return <Video source={{ uri: streamUrl }} style={{ flex: 1 }} />;
};

Released under the MIT License.