TypeScript
import { Livepeer } from "livepeer";
import { Profile, TranscodeProfileEncoder, TranscodeProfileProfile, Type } from "livepeer/models/components";
const livepeer = new Livepeer({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeer.stream.update({
record: false,
multistream: {
targets: [
{
profile: "720p0",
videoOnly: false,
id: "PUSH123",
spec: {
name: "My target",
url: "rtmps://live.my-service.tv/channel/secretKey",
},
},
],
},
playbackPolicy: {
type: Type.Webhook,
webhookId: "1bde4o2i6xycudoy",
webhookContext: {
"streamerId": "my-custom-id",
},
refreshInterval: 600,
},
profiles: [
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
fps: 30,
fpsDen: 1,
quality: 23,
gop: "2",
profile: Profile.H264Baseline,
},
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
fps: 30,
fpsDen: 1,
quality: 23,
gop: "2",
profile: Profile.H264Baseline,
},
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
fps: 30,
fpsDen: 1,
quality: 23,
gop: "2",
profile: Profile.H264Baseline,
},
],
recordingSpec: {
profiles: [
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
quality: 23,
fps: 30,
fpsDen: 1,
gop: "2",
profile: TranscodeProfileProfile.H264Baseline,
encoder: TranscodeProfileEncoder.H264,
},
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
quality: 23,
fps: 30,
fpsDen: 1,
gop: "2",
profile: TranscodeProfileProfile.H264Baseline,
encoder: TranscodeProfileEncoder.H264,
},
],
},
name: "test_stream",
}, "<id>");
// Handle the result
console.log(result);
}
run();package main
import(
livepeergo "github.com/livepeer/livepeer-go"
"context"
"github.com/livepeer/livepeer-go/models/components"
"log"
)
func main() {
s := livepeergo.New(
livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Stream.Update(ctx, "<id>", components.StreamPatchPayload{
Record: livepeergo.Bool(false),
Multistream: &components.Multistream{
Targets: []components.Target{
components.Target{
Profile: "720p",
VideoOnly: livepeergo.Bool(false),
ID: livepeergo.String("PUSH123"),
Spec: &components.TargetSpec{
Name: livepeergo.String("My target"),
URL: "rtmps://live.my-service.tv/channel/secretKey",
},
},
},
},
PlaybackPolicy: &components.PlaybackPolicy{
Type: components.TypeWebhook,
WebhookID: livepeergo.String("1bde4o2i6xycudoy"),
WebhookContext: map[string]any{
"streamerId": "my-custom-id",
},
RefreshInterval: livepeergo.Float64(600),
},
Profiles: []components.FfmpegProfile{
components.FfmpegProfile{
Width: 1280,
Name: "720p",
Height: 720,
Bitrate: 3000000,
Fps: 30,
FpsDen: livepeergo.Int64(1),
Quality: livepeergo.Int64(23),
Gop: livepeergo.String("2"),
Profile: components.ProfileH264Baseline.ToPointer(),
},
},
RecordingSpec: &components.RecordingSpec{
Profiles: []components.TranscodeProfile{
components.TranscodeProfile{
Width: livepeergo.Int64(1280),
Name: livepeergo.String("720p"),
Height: livepeergo.Int64(720),
Bitrate: 3000000,
Quality: livepeergo.Int64(23),
Fps: livepeergo.Int64(30),
FpsDen: livepeergo.Int64(1),
Gop: livepeergo.String("2"),
Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(),
Encoder: components.TranscodeProfileEncoderH264.ToPointer(),
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}from livepeer import Livepeer
from livepeer.models import components
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.stream.update(id="<id>", stream_patch_payload={
"record": False,
"multistream": {
"targets": [
{
"profile": "720p",
"video_only": False,
"id": "PUSH123",
"spec": {
"name": "My target",
"url": "rtmps://live.my-service.tv/channel/secretKey",
},
},
],
},
"playback_policy": {
"type": components.Type.WEBHOOK,
"webhook_id": "1bde4o2i6xycudoy",
"webhook_context": {
"streamerId": "my-custom-id",
},
"refresh_interval": 600,
},
"profiles": [
{
"width": 1280,
"name": "720p",
"height": 720,
"bitrate": 3000000,
"fps": 30,
"fps_den": 1,
"quality": 23,
"gop": "2",
"profile": components.Profile.H264_BASELINE,
},
],
"recording_spec": {
"profiles": [
{
"width": 1280,
"name": "720p",
"height": 720,
"bitrate": 3000000,
"quality": 23,
"fps": 30,
"fps_den": 1,
"gop": "2",
"profile": components.TranscodeProfileProfile.H264_BASELINE,
"encoder": components.TranscodeProfileEncoder.H_264,
},
],
},
})
if res is not None:
# handle response
passcurl --request PATCH \
--url https://livepeer.studio/api/stream/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"creatorId": {
"type": "unverified",
"value": "<string>"
},
"record": "<unknown>",
"suspended": "<unknown>",
"multistream": "<unknown>",
"playbackPolicy": {
"type": "webhook",
"webhookId": "1bde4o2i6xycudoy",
"webhookContext": {
"streamerId": "my-custom-id"
},
"refreshInterval": 600,
"allowedOrigins": [
"<string>"
]
},
"profiles": "<unknown>",
"recordingSpec": "<unknown>",
"userTags": "<unknown>",
"name": "<unknown>"
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
creatorId: {type: 'unverified', value: '<string>'},
record: '<unknown>',
suspended: '<unknown>',
multistream: '<unknown>',
playbackPolicy: {
type: 'webhook',
webhookId: '1bde4o2i6xycudoy',
webhookContext: {streamerId: 'my-custom-id'},
refreshInterval: 600,
allowedOrigins: ['<string>']
},
profiles: '<unknown>',
recordingSpec: '<unknown>',
userTags: '<unknown>',
name: '<unknown>'
})
};
fetch('https://livepeer.studio/api/stream/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://livepeer.studio/api/stream/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'creatorId' => [
'type' => 'unverified',
'value' => '<string>'
],
'record' => '<unknown>',
'suspended' => '<unknown>',
'multistream' => '<unknown>',
'playbackPolicy' => [
'type' => 'webhook',
'webhookId' => '1bde4o2i6xycudoy',
'webhookContext' => [
'streamerId' => 'my-custom-id'
],
'refreshInterval' => 600,
'allowedOrigins' => [
'<string>'
]
],
'profiles' => '<unknown>',
'recordingSpec' => '<unknown>',
'userTags' => '<unknown>',
'name' => '<unknown>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://livepeer.studio/api/stream/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"creatorId\": {\n \"type\": \"unverified\",\n \"value\": \"<string>\"\n },\n \"record\": \"<unknown>\",\n \"suspended\": \"<unknown>\",\n \"multistream\": \"<unknown>\",\n \"playbackPolicy\": {\n \"type\": \"webhook\",\n \"webhookId\": \"1bde4o2i6xycudoy\",\n \"webhookContext\": {\n \"streamerId\": \"my-custom-id\"\n },\n \"refreshInterval\": 600,\n \"allowedOrigins\": [\n \"<string>\"\n ]\n },\n \"profiles\": \"<unknown>\",\n \"recordingSpec\": \"<unknown>\",\n \"userTags\": \"<unknown>\",\n \"name\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://livepeer.studio/api/stream/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"creatorId\": {\n \"type\": \"unverified\",\n \"value\": \"<string>\"\n },\n \"record\": \"<unknown>\",\n \"suspended\": \"<unknown>\",\n \"multistream\": \"<unknown>\",\n \"playbackPolicy\": {\n \"type\": \"webhook\",\n \"webhookId\": \"1bde4o2i6xycudoy\",\n \"webhookContext\": {\n \"streamerId\": \"my-custom-id\"\n },\n \"refreshInterval\": 600,\n \"allowedOrigins\": [\n \"<string>\"\n ]\n },\n \"profiles\": \"<unknown>\",\n \"recordingSpec\": \"<unknown>\",\n \"userTags\": \"<unknown>\",\n \"name\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"errors": [
[
"id not provided",
"Account not found"
]
]
}Livestream
Update a livestream
PATCH
/
stream
/
{id}
TypeScript
import { Livepeer } from "livepeer";
import { Profile, TranscodeProfileEncoder, TranscodeProfileProfile, Type } from "livepeer/models/components";
const livepeer = new Livepeer({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeer.stream.update({
record: false,
multistream: {
targets: [
{
profile: "720p0",
videoOnly: false,
id: "PUSH123",
spec: {
name: "My target",
url: "rtmps://live.my-service.tv/channel/secretKey",
},
},
],
},
playbackPolicy: {
type: Type.Webhook,
webhookId: "1bde4o2i6xycudoy",
webhookContext: {
"streamerId": "my-custom-id",
},
refreshInterval: 600,
},
profiles: [
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
fps: 30,
fpsDen: 1,
quality: 23,
gop: "2",
profile: Profile.H264Baseline,
},
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
fps: 30,
fpsDen: 1,
quality: 23,
gop: "2",
profile: Profile.H264Baseline,
},
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
fps: 30,
fpsDen: 1,
quality: 23,
gop: "2",
profile: Profile.H264Baseline,
},
],
recordingSpec: {
profiles: [
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
quality: 23,
fps: 30,
fpsDen: 1,
gop: "2",
profile: TranscodeProfileProfile.H264Baseline,
encoder: TranscodeProfileEncoder.H264,
},
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
quality: 23,
fps: 30,
fpsDen: 1,
gop: "2",
profile: TranscodeProfileProfile.H264Baseline,
encoder: TranscodeProfileEncoder.H264,
},
],
},
name: "test_stream",
}, "<id>");
// Handle the result
console.log(result);
}
run();package main
import(
livepeergo "github.com/livepeer/livepeer-go"
"context"
"github.com/livepeer/livepeer-go/models/components"
"log"
)
func main() {
s := livepeergo.New(
livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Stream.Update(ctx, "<id>", components.StreamPatchPayload{
Record: livepeergo.Bool(false),
Multistream: &components.Multistream{
Targets: []components.Target{
components.Target{
Profile: "720p",
VideoOnly: livepeergo.Bool(false),
ID: livepeergo.String("PUSH123"),
Spec: &components.TargetSpec{
Name: livepeergo.String("My target"),
URL: "rtmps://live.my-service.tv/channel/secretKey",
},
},
},
},
PlaybackPolicy: &components.PlaybackPolicy{
Type: components.TypeWebhook,
WebhookID: livepeergo.String("1bde4o2i6xycudoy"),
WebhookContext: map[string]any{
"streamerId": "my-custom-id",
},
RefreshInterval: livepeergo.Float64(600),
},
Profiles: []components.FfmpegProfile{
components.FfmpegProfile{
Width: 1280,
Name: "720p",
Height: 720,
Bitrate: 3000000,
Fps: 30,
FpsDen: livepeergo.Int64(1),
Quality: livepeergo.Int64(23),
Gop: livepeergo.String("2"),
Profile: components.ProfileH264Baseline.ToPointer(),
},
},
RecordingSpec: &components.RecordingSpec{
Profiles: []components.TranscodeProfile{
components.TranscodeProfile{
Width: livepeergo.Int64(1280),
Name: livepeergo.String("720p"),
Height: livepeergo.Int64(720),
Bitrate: 3000000,
Quality: livepeergo.Int64(23),
Fps: livepeergo.Int64(30),
FpsDen: livepeergo.Int64(1),
Gop: livepeergo.String("2"),
Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(),
Encoder: components.TranscodeProfileEncoderH264.ToPointer(),
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}from livepeer import Livepeer
from livepeer.models import components
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.stream.update(id="<id>", stream_patch_payload={
"record": False,
"multistream": {
"targets": [
{
"profile": "720p",
"video_only": False,
"id": "PUSH123",
"spec": {
"name": "My target",
"url": "rtmps://live.my-service.tv/channel/secretKey",
},
},
],
},
"playback_policy": {
"type": components.Type.WEBHOOK,
"webhook_id": "1bde4o2i6xycudoy",
"webhook_context": {
"streamerId": "my-custom-id",
},
"refresh_interval": 600,
},
"profiles": [
{
"width": 1280,
"name": "720p",
"height": 720,
"bitrate": 3000000,
"fps": 30,
"fps_den": 1,
"quality": 23,
"gop": "2",
"profile": components.Profile.H264_BASELINE,
},
],
"recording_spec": {
"profiles": [
{
"width": 1280,
"name": "720p",
"height": 720,
"bitrate": 3000000,
"quality": 23,
"fps": 30,
"fps_den": 1,
"gop": "2",
"profile": components.TranscodeProfileProfile.H264_BASELINE,
"encoder": components.TranscodeProfileEncoder.H_264,
},
],
},
})
if res is not None:
# handle response
passcurl --request PATCH \
--url https://livepeer.studio/api/stream/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"creatorId": {
"type": "unverified",
"value": "<string>"
},
"record": "<unknown>",
"suspended": "<unknown>",
"multistream": "<unknown>",
"playbackPolicy": {
"type": "webhook",
"webhookId": "1bde4o2i6xycudoy",
"webhookContext": {
"streamerId": "my-custom-id"
},
"refreshInterval": 600,
"allowedOrigins": [
"<string>"
]
},
"profiles": "<unknown>",
"recordingSpec": "<unknown>",
"userTags": "<unknown>",
"name": "<unknown>"
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
creatorId: {type: 'unverified', value: '<string>'},
record: '<unknown>',
suspended: '<unknown>',
multistream: '<unknown>',
playbackPolicy: {
type: 'webhook',
webhookId: '1bde4o2i6xycudoy',
webhookContext: {streamerId: 'my-custom-id'},
refreshInterval: 600,
allowedOrigins: ['<string>']
},
profiles: '<unknown>',
recordingSpec: '<unknown>',
userTags: '<unknown>',
name: '<unknown>'
})
};
fetch('https://livepeer.studio/api/stream/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://livepeer.studio/api/stream/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'creatorId' => [
'type' => 'unverified',
'value' => '<string>'
],
'record' => '<unknown>',
'suspended' => '<unknown>',
'multistream' => '<unknown>',
'playbackPolicy' => [
'type' => 'webhook',
'webhookId' => '1bde4o2i6xycudoy',
'webhookContext' => [
'streamerId' => 'my-custom-id'
],
'refreshInterval' => 600,
'allowedOrigins' => [
'<string>'
]
],
'profiles' => '<unknown>',
'recordingSpec' => '<unknown>',
'userTags' => '<unknown>',
'name' => '<unknown>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://livepeer.studio/api/stream/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"creatorId\": {\n \"type\": \"unverified\",\n \"value\": \"<string>\"\n },\n \"record\": \"<unknown>\",\n \"suspended\": \"<unknown>\",\n \"multistream\": \"<unknown>\",\n \"playbackPolicy\": {\n \"type\": \"webhook\",\n \"webhookId\": \"1bde4o2i6xycudoy\",\n \"webhookContext\": {\n \"streamerId\": \"my-custom-id\"\n },\n \"refreshInterval\": 600,\n \"allowedOrigins\": [\n \"<string>\"\n ]\n },\n \"profiles\": \"<unknown>\",\n \"recordingSpec\": \"<unknown>\",\n \"userTags\": \"<unknown>\",\n \"name\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://livepeer.studio/api/stream/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"creatorId\": {\n \"type\": \"unverified\",\n \"value\": \"<string>\"\n },\n \"record\": \"<unknown>\",\n \"suspended\": \"<unknown>\",\n \"multistream\": \"<unknown>\",\n \"playbackPolicy\": {\n \"type\": \"webhook\",\n \"webhookId\": \"1bde4o2i6xycudoy\",\n \"webhookContext\": {\n \"streamerId\": \"my-custom-id\"\n },\n \"refreshInterval\": 600,\n \"allowedOrigins\": [\n \"<string>\"\n ]\n },\n \"profiles\": \"<unknown>\",\n \"recordingSpec\": \"<unknown>\",\n \"userTags\": \"<unknown>\",\n \"name\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"errors": [
[
"id not provided",
"Account not found"
]
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of the stream
Body
application/json
Response
Success
Last modified on March 18, 2026
Was this page helpful?
⌘I