> ## Documentation Index
> Fetch the complete documentation index at: https://docs.livepeer.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a livestream



## OpenAPI

````yaml PATCH /stream/{id}
openapi: 3.1.0
info:
  title: Livepeer API Reference
  description: |
    Welcome to the Livepeer API reference docs. Here you will find all the
    endpoints exposed on the standard Livepeer API, learn how to use them and
    what they return.
  version: 1.0.0
servers:
  - url: https://livepeer.studio/api
security:
  - apiKey: []
tags:
  - name: stream
    description: Operations related to livestream api
  - name: asset
    description: Operations related to asset/vod api
  - name: webhook
    description: Operations related to webhook api
  - name: multistream
    description: Operations related to multistream api
  - name: session
    description: Operations related to session api
  - name: room
    description: Operations related to rooms api
  - name: transcode
    description: Operations related to transcode api
  - name: metrics
    description: Operations related to metrics api
  - name: playback
    description: Operations related to playback api
  - name: accessControl
    description: Operations related to access control/signing keys api
  - name: task
    description: Operations related to tasks api
  - name: generate
    description: Operations related to AI generate api
paths:
  /stream/{id}:
    parameters:
      - name: id
        description: ID of the stream
        in: path
        required: true
        schema:
          type: string
    patch:
      tags:
        - stream
      summary: Update a stream
      operationId: updateStream
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/stream-patch-payload'
      responses:
        '204':
          description: Success
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      x-codeSamples:
        - lang: typescript
          label: updateStream
          source: >-
            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();
        - lang: go
          label: updateStream
          source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n    s := livepeergo.New(\n        livepeergo.WithSecurity(\"<YOUR_BEARER_TOKEN_HERE>\"),\n    )\n\n    ctx := context.Background()\n    res, err := s.Stream.Update(ctx, \"<id>\", components.StreamPatchPayload{\n        Record: livepeergo.Bool(false),\n        Multistream: &components.Multistream{\n            Targets: []components.Target{\n                components.Target{\n                    Profile: \"720p\",\n                    VideoOnly: livepeergo.Bool(false),\n                    ID: livepeergo.String(\"PUSH123\"),\n                    Spec: &components.TargetSpec{\n                        Name: livepeergo.String(\"My target\"),\n                        URL: \"rtmps://live.my-service.tv/channel/secretKey\",\n                    },\n                },\n            },\n        },\n        PlaybackPolicy: &components.PlaybackPolicy{\n            Type: components.TypeWebhook,\n            WebhookID: livepeergo.String(\"1bde4o2i6xycudoy\"),\n            WebhookContext: map[string]any{\n                \"streamerId\": \"my-custom-id\",\n            },\n            RefreshInterval: livepeergo.Float64(600),\n        },\n        Profiles: []components.FfmpegProfile{\n            components.FfmpegProfile{\n                Width: 1280,\n                Name: \"720p\",\n                Height: 720,\n                Bitrate: 3000000,\n                Fps: 30,\n                FpsDen: livepeergo.Int64(1),\n                Quality: livepeergo.Int64(23),\n                Gop: livepeergo.String(\"2\"),\n                Profile: components.ProfileH264Baseline.ToPointer(),\n            },\n        },\n        RecordingSpec: &components.RecordingSpec{\n            Profiles: []components.TranscodeProfile{\n                components.TranscodeProfile{\n                    Width: livepeergo.Int64(1280),\n                    Name: livepeergo.String(\"720p\"),\n                    Height: livepeergo.Int64(720),\n                    Bitrate: 3000000,\n                    Quality: livepeergo.Int64(23),\n                    Fps: livepeergo.Int64(30),\n                    FpsDen: livepeergo.Int64(1),\n                    Gop: livepeergo.String(\"2\"),\n                    Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(),\n                    Encoder: components.TranscodeProfileEncoderH264.ToPointer(),\n                },\n            },\n        },\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res != nil {\n        // handle response\n    }\n}"
        - lang: python
          label: updateStream
          source: |-
            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
                pass
components:
  schemas:
    stream-patch-payload:
      type: object
      additionalProperties: false
      properties:
        creatorId:
          $ref: '#/components/schemas/input-creator-id'
        record: 04d1ba22-5ef9-4cc1-9bd1-6dcb5d4767c9
        suspended: b0adfb77-a9b7-4f9e-bc07-e52854ba659c
        multistream: 0c6002da-f256-463f-82af-6e197b8fca4d
        playbackPolicy:
          $ref: '#/components/schemas/playback-policy'
        profiles: 90660885-cf84-47c8-8d9e-3fe506be5e1d
        recordingSpec: fba456cb-6a07-4374-be0f-eea9651c6132
        userTags: 5d7bbc4f-93b4-4731-b947-5f9109e9680a
        name: 3642e947-59c5-4848-b5b6-a5e560d54957
    error:
      type: object
      properties:
        errors:
          type: array
          minItems: 1
          items:
            type: string
            example:
              - id not provided
              - Account not found
    input-creator-id:
      oneOf:
        - type: object
          additionalProperties: false
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - unverified
            value:
              type: string
        - type: string
          description: >-
            Helper syntax to specify an unverified creator ID, fully managed by
            the developer.
    playback-policy:
      type:
        - object
        - 'null'
      description: Whether the playback policy for an asset or stream is public or signed
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - public
            - jwt
            - webhook
          example: webhook
        webhookId:
          type: string
          description: ID of the webhook to use for playback policy
          example: 1bde4o2i6xycudoy
        webhookContext:
          type: object
          description: User-defined webhook context
          additionalProperties: true
          example:
            streamerId: my-custom-id
        refreshInterval:
          type: number
          description: |
            Interval (in seconds) at which the playback policy should be
            refreshed (default 600 seconds)
          example: 600
        allowedOrigins:
          type: array
          description: >-
            List of allowed origins for CORS playback
            (<scheme>://<hostname>:<port>, <scheme>://<hostname>)
          items:
            type: string
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````