Skip to main content
Create a stream via the API or SDK to get a stream key (for broadcasters) and a playback ID (for viewers). The example below uses the Create Stream API.

Create a stream with the SDK

import { Livepeer } from "livepeer";

const livepeer = new Livepeer({ apiKey: process.env.LIVEPEER_API_KEY });

const { data } = await livepeer.stream.create({
  name: "my-stream",
});

console.log("Stream key:", data.streamKey);
console.log("Playback ID:", data.playbackId);

Use the stream key and playback ID

  • Stream key — Give this to the broadcaster. They enter it in OBS (or another encoder) or use it for in-browser WebRTC broadcast. Keep the stream key secret; anyone with it can push video to the stream.
  • Playback ID — Use this in your app to play the stream (e.g. with the Livepeer Player or the Playback Info API). You can expose the playback ID to viewers.

Next steps

Last modified on February 18, 2026