Skip to content

API Key Authentication

API Key authentication is the standard method for all partner integrations.

Overview

  • Header: ls-api-key
  • Format: ls_proj_v1_<random_string>
  • Scope: All operations within your project
  • Expiration: Never (managed by Lunar Stream admin)

Receiving Your API Key

Your API Key and Project ID will be provided by Lunar Stream admin. You will receive:

API Key: ls_proj_v1_ydi3lLihcIW0Z9ZAkGz2BjV6caLYqzK41TQAGblW-4E
Project ID: ce4b77e3-3ed0-47ee-a307-ade5f3fbef91

Important

Store your API Key securely. Contact Lunar Stream admin if you need to regenerate it.

Using API Key

Include the API Key in the ls-api-key header:

bash
curl -X GET "https://api.lunarstream.kozow.com/api/v1/livestream?projectId=YOUR_PROJECT_ID" \
  -H "ls-api-key: ls_proj_v1_ydi3lLihcIW0Z9ZAkGz2BjV6caLYqzK41TQAGblW-4E" \
  -H "Content-Type: application/json"
javascript
const axios = require('axios');

const client = axios.create({
  baseURL: 'https://api.lunarstream.kozow.com/api/v1',
  headers: {
    'ls-api-key': process.env.LUNAR_STREAM_API_KEY,
    'Content-Type': 'application/json'
  }
});

const response = await client.get('/livestream', {
  params: { projectId: process.env.LUNAR_STREAM_PROJECT_ID }
});
python
import requests
import os

headers = {
    'ls-api-key': os.environ['LUNAR_STREAM_API_KEY'],
    'Content-Type': 'application/json'
}

response = requests.get(
    'https://api.lunarstream.kozow.com/api/v1/livestream',
    headers=headers,
    params={'projectId': os.environ['LUNAR_STREAM_PROJECT_ID']}
)

API Key Permissions

With your API Key, you can perform these operations:

OperationEndpointMethod
List media servers/media-servers/availableGET
Create livestream/livestreamPOST
Get livestream/livestream/:idGET
List livestreams/livestreamGET
Update livestream/livestream/:idPATCH
Delete livestream/livestream/:idDELETE
Generate push token/livestream/generate-push-tokenPOST

Environment Configuration

Store your credentials in environment variables:

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

Error Responses

StatusErrorDescription
401UNAUTHORIZEDMissing or invalid API Key
403FORBIDDENAPI Key doesn't have access to resource
json
{
  "statusCode": 401,
  "message": "Invalid API Key",
  "error": "Unauthorized"
}

Security Best Practices

  1. Store securely - Use environment variables or secret managers
  2. Never commit - Add .env to .gitignore
  3. Server-side only - Never expose in client-side code
  4. Monitor usage - Check for unusual API activity
  5. Report issues - Contact admin immediately if key is compromised

Released under the MIT License.