Skip to content
StatusSupportDashboard

Add stream

client.streams.add(stringnamespace, StreamAddParams { id, stream_url } body, RequestOptionsoptions?): StreamAddResponse { requestId, status }
POST/v1/streams/{namespace}

Monitor the livestream at the given stream URL. This method returns immediately.

ParametersExpand Collapse
namespace: string

The namespace to ingest stream data into

body: StreamAddParams { id, stream_url }
id: string
stream_url: string
ReturnsExpand Collapse
StreamAddResponse { requestId, status }

Stream ingestion request accepted for asynchronous processing.

requestId: string
status: "accepted"

Add stream

import Safetykit from 'safetykit';

const client = new Safetykit({
  apiKey: process.env['SAFETYKIT_API_KEY'], // This is the default and can be omitted
});

const response = await client.streams.add('namespace', {
  id: 'YOUR_STREAM_ID',
  stream_url: 'https://cdn.example.com/20948D23.m3u8',
});

console.log(response.requestId);
{
  "requestId": "req_01h2m7qdmdjckc30e1mnq6xqfd",
  "status": "accepted"
}
Returns Examples
{
  "requestId": "req_01h2m7qdmdjckc30e1mnq6xqfd",
  "status": "accepted"
}