Skip to content

Quick Start

Get your first livestream running in 5 minutes.

Prerequisites

  • API Key and Project ID from Lunar Stream admin
  • An RTMP encoder (OBS Studio, FFmpeg, or mobile app)

Step 1: Configure Environment

Store your credentials securely:

bash
# .env file
LUNAR_STREAM_API_URL=https://api.lunarstream.kozow.com/api/v1
LUNAR_STREAM_API_KEY=ls_proj_v1_ydi3lLihcIW0Z9ZAkGz2BjV6caLYqzK41TQAGblW-4E
LUNAR_STREAM_PROJECT_ID=ce4b77e3-3ed0-47ee-a307-ade5f3fbef91

Step 2: Get Available Media Servers

First, check which media servers are available:

bash
curl -X GET "https://api.lunarstream.kozow.com/api/v1/media-servers/available?projectId=YOUR_PROJECT_ID" \
  -H "ls-api-key: YOUR_API_KEY"

Response:

json
{
  "data": [
    {
      "id": "40fb0295-9fdf-4a97-b1a8-43cdc64dd512",
      "name": "zlmediakit",
      "serverType": "ZLMediaKIT",
      "host": "stream.lunarstream.kozow.com",
      "port": 1935
    }
  ]
}

Step 3: Create a Livestream

Use your API Key to create a livestream:

bash
curl -X POST https://api.lunarstream.kozow.com/api/v1/livestream \
  -H "ls-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My First Stream",
    "projectId": "YOUR_PROJECT_ID",
    "mediaServerId": "MEDIA_SERVER_ID"
  }'

Response:

json
{
  "data": {
    "id": "d926da37-56ae-4212-83bc-f20d9de64d6b",
    "name": "My First Stream",
    "status": "READY_FOR_USE",
    "streamKey": "ee04affe2a669854052102fe762bd715",
    "pushToken": "eyJhbGciOiJSUzI1NiIs...",
    "rmtpServer": "rtmp://stream.lunarstream.kozow.com/live",
    "streamKeyWithParams": "ee04affe2a669854052102fe762bd715?pushToken=eyJhbGci...",
    "hlsSources": [
      {
        "name": "original",
        "url": "https://stream.lunarstream.kozow.com/live/ee04affe2a669854052102fe762bd715/hls.m3u8"
      }
    ]
  }
}

Step 4: Configure OBS Studio

  1. Open OBS StudioSettingsStream

  2. Set Service to Custom...

  3. Enter the following:

    • Server: rtmp://stream.lunarstream.kozow.com/live
    • Stream Key: ee04affe2a669854052102fe762bd715?pushToken=eyJhbGci...
  4. Click Start Streaming

TIP

Use the streamKeyWithParams value from the API response as your Stream Key in OBS.

Step 5: Watch Your Stream

Open the HLS URL in any compatible player:

https://stream.lunarstream.kozow.com/live/ee04affe2a669854052102fe762bd715/hls.m3u8

Or use the preview URL:

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

What's Next?

Released under the MIT License.