> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fastpix.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fastpix.com/docs/_mcp/server.

# Update a stream

PATCH https://api.fastpix.com/v1/live/streams/{streamId}
Content-Type: application/json

This endpoint allows you to modify the parameters of an existing live stream, such as its `metadata` (title, description) or the `reconnectWindow`. It’s useful for making changes to a stream that has already been created but not yet ended. After the live stream is disabled, you cannot update a stream.

The updated stream parameters and the `streamId` needs to be shared in the request, and FastPix returns the updated stream details. After the update, video.live\_stream.updated webhook event notifies your system.

#### Example

A host realizes they need to extend the reconnect window for their live stream in case they lose connection temporarily during the event. Or suppose during a multi-day online conference, the event organizers need to update the stream title to reflect the next day"s session while keeping the same stream ID for continuity.

Related guide: Manage streams

Reference: https://fastpix.com/docs/live-stream-api/manage-live-stream/update-live-stream

## Authentication

- `Authorization` header (basic auth, required) — FastPix APIs are secured with Basic Authentication. Use your Access Token ID as the username and Secret Key as the password in the Authorization header of each API request. * Username: Access Token ID * Password: Secret Key Activate your FastPix account to generate your API credentials. See the guide here

## Request

### Path parameters

- `streamId` (string, required) — After creating a new live stream, FastPix assigns a unique identifier to the stream.

### Body (application/json)

This endpoint expects a patchLiveStreamRequest.

- `metadata` (map from string to string, optional) — You can search for videos with specific key value pairs using metadata, when you tag a video in "key":"value"s pairs. Dynamic metadata allows you to define a key that allows any value pair. You can have maximum of 255 characters and upto 10 entries are allowed.
- `reconnectWindow` (integer, optional, default: 60) — In case the software streaming the live, gets disrupted for any reason and gets disconnected from FastPix, the reconnect window defines the duration FastPix waits before automatically terminating the stream. Before starting the stream, you can set the reconnect window time which is up to 1800 seconds.

## Response

### 200

Stream details updated successfully

- `success` (boolean, optional) — Shows the request status. Returns true for success and false for failure.
- `data` (patchResponseData, optional) — Displays the result of the request.

## Types

### patchResponseData

Displays the result of the request.

- `streamId` (string, optional) — Upon creating a new live stream, FastPix assigns a unique identifier to the stream.
- `streamKey` (string, optional) — A unique stream key is generated for streaming, allowing the user to start streaming on any third-party platform using this key.
- `srtSecret` (string, optional) — A secret used for securing the SRT stream. This ensures that only authorized users can access the stream.
- `trial` (boolean, optional) — FastPix allows for a to trial the live stream for free. The duration of trial streams is five minutes. After five minutes of activity, the trial stream is turned off, and the recorded asset is removed after a day.
- `status` (string, optional) — The current live stream status can be one of four values:Idle, Preparing, Active or Disabled.The Idle status signifies that there isn"t a broadcast in progress.The preparing status indicates that the stream is getting prepared. while, the Active status indicates that a broadcast is currently in progress. The Disabled status means that no more RTMPS streams can be published.
- `maxResolution` (string, optional) — Max resolution can be used to control the maximum resolution your media is encoded, stored, and streamed at.
- `maxDuration` (integer, optional) — The maximum duration in seconds that a live stream can have before it ends the stream.
- `createdAt` (datetime, optional) — It is the moment when the stream was created Time the media was generated, defined as a localDateTime (UTC Time).
- `reconnectWindow` (integer, optional) — In case the software streaming the live, gets disrupted for any reason and gets disconnected from FastPix, the reconnect window specifies the time span FastPix will wait before ending the stream. Before starting the stream, you can set the reconnect window time which is up to 1800 seconds.
- `enableRecording` (boolean, optional) — When set to true, the livestream will be recorded and stored for later viewing purposes. If set to false, the livestream will not be recorded.
- `enableDvrMode` (boolean, optional) — Enables DVR (Digital Video Recorder) functionality for the live stream. When set to true, viewers can pause, rewind, and resume playback during the live broadcast. This allows time-shifted viewing of the stream while it is still ongoing.
- `mediaPolicy` (string, optional) — Determines whether the recorded stream must be publicly accessible or private in Live to VOD (Video on Demand).
- `metadata` (map from string to string, optional) — You can search for videos with specific key value pairs using metadata, when you tag a video in "key":"value"s pairs. Dynamic metadata allows you to define a key that allows any value pair. You can have maximum of 255 characters and upto 10 entries are allowed.
- `lowLatency` (boolean, optional) — Enables low-latency streaming mode to reduce playback delay.
- `closedCaptions` (boolean, optional) — when provided true Enables closed captions for the livestream.
- `playbackIds` (list of PlaybackIdResponse, optional)
- `srtPlaybackResponse` (SrtPlaybackResponse, optional) — This object contains the livestream playback response details for SRT Protocol

### PlaybackIdResponse

A collection of Playback ID objects utilized for crafting HLS playback urls.

- `id` (string, optional) — Unique identifier for the playbackId
- `accessPolicy` (string, optional) — Determines if access to the streamed content is kept private or available to all.
- `accessRestrictions` (PlaybackIdResponseAccessRestrictions, optional) — Controls access based on domains and user agents. Defines a default policy (either "allow" or "deny") and provides lists for explicitly allowed or denied domains and user agents.

### SrtPlaybackResponse

This object contains the livestream playback response details for SRT Protocol

- `srtPlaybackStreamId` (string, optional) — A unique identifier for the SRT playback stream. This ID is used to distinguish between different playback streams
- `srtPlaybackSecret` (string, optional) — A playback secret used for securing the SRT playback stream. This ensures that only authorized users can access the playback

### PlaybackIdResponseAccessRestrictions

Controls access based on domains and user agents. Defines a default policy (either "allow" or "deny") and provides lists for explicitly allowed or denied domains and user agents.

- `domains` (PlaybackIdResponseAccessRestrictionsDomains, optional) — Restrictions based on the originating domain of a request (for example, whether requests from certain websites are allowed or blocked).
- `userAgents` (PlaybackIdResponseAccessRestrictionsUserAgents, optional) — Restrictions based on the user agent (typically a string sent by browsers or bots identifying themselves).

### PlaybackIdResponseAccessRestrictionsDomains

Restrictions based on the originating domain of a request (for example, whether requests from certain websites are allowed or blocked).

- `defaultPolicy` (enum, optional) — Policy action type
  - Allowed values: `allow`, `deny`
- `allow` (list of string, optional) — A list of domains that are explicitly allowed access. Only effective when defaultPolicy is "deny".
- `deny` (list of string, optional) — A list of domains that are explicitly blocked from accessing the resource. Only effective when defaultPolicy is "allow".

### PlaybackIdResponseAccessRestrictionsUserAgents

Restrictions based on the user agent (typically a string sent by browsers or bots identifying themselves).

- `defaultPolicy` (enum, optional) — Policy action type
  - Allowed values: `allow`, `deny`
- `allow` (list of string, optional) — A list of specific user agents that are allowed to access the resource. Only effective when defaultPolicy is "deny".
- `deny` (list of string, optional) — A list of specific user agents that are blocked. Only effective when defaultPolicy is "allow".

## Examples

**Request**

```json
{
  "metadata": {
    "livestream_name": "Gaming_stream"
  },
  "reconnectWindow": 100
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "streamId": "fa7f8c0950ea48ebcc5ef9de8c23deaa",
    "streamKey": "3dc5d7641f918baa083a5c52a5bd9cbckfa7f8c0950ea48ebcc5ef9de8c23deaa",
    "srtSecret": "c51739512d0088d98a46925c9b74c73akfa7f8c0950ea48ebcc5ef9de8c23deaa",
    "trial": false,
    "status": "idle",
    "maxResolution": "1080p",
    "maxDuration": 28800,
    "createdAt": "2024-10-15T08:48:31.551351Z",
    "reconnectWindow": 100,
    "enableRecording": true,
    "enableDvrMode": false,
    "mediaPolicy": "public",
    "metadata": {
      "livestream_name": "Gaming_stream"
    },
    "lowLatency": true,
    "closedCaptions": false,
    "playbackIds": [
      {
        "id": "4e43ec52-4775-4f68-a3ff-a57d8a59bba8",
        "accessPolicy": "public",
        "accessRestrictions": {
          "domains": {
            "defaultPolicy": "allow",
            "allow": [],
            "deny": []
          },
          "userAgents": {
            "defaultPolicy": "allow",
            "allow": [],
            "deny": []
          }
        }
      }
    ],
    "srtPlaybackResponse": {
      "srtPlaybackStreamId": "playfa7f8c0950ea48ebcc5ef9de8c23deaa",
      "srtPlaybackSecret": "490e707dd4d165c9e38d261b252f9457kfa7f8c0950ea48ebcc5ef9de8c23deaa"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.fastpix.com/v1/live/streams/91a264dcc447b63da6fb79ef925cd76d"

payload = {
    "metadata": { "livestream_name": "Gaming_stream" },
    "reconnectWindow": 100
}
headers = {
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript
const url = 'https://api.fastpix.com/v1/live/streams/91a264dcc447b63da6fb79ef925cd76d';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'PATCH',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"metadata":{"livestream_name":"Gaming_stream"},"reconnectWindow":100}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.fastpix.com/v1/live/streams/91a264dcc447b63da6fb79ef925cd76d"

	payload := strings.NewReader("{\n  \"metadata\": {\n    \"livestream_name\": \"Gaming_stream\"\n  },\n  \"reconnectWindow\": 100\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.SetBasicAuth("<username>", "<password>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.fastpix.com/v1/live/streams/91a264dcc447b63da6fb79ef925cd76d")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"metadata\": {\n    \"livestream_name\": \"Gaming_stream\"\n  },\n  \"reconnectWindow\": 100\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.fastpix.com/v1/live/streams/91a264dcc447b63da6fb79ef925cd76d")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{\n  \"metadata\": {\n    \"livestream_name\": \"Gaming_stream\"\n  },\n  \"reconnectWindow\": 100\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.fastpix.com/v1/live/streams/91a264dcc447b63da6fb79ef925cd76d', [
  'body' => '{
  "metadata": {
    "livestream_name": "Gaming_stream"
  },
  "reconnectWindow": 100
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<username>', '<password>'],
]);

echo $response->getBody();
```

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://api.fastpix.com/v1/live/streams/91a264dcc447b63da6fb79ef925cd76d");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.PATCH);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"metadata\": {\n    \"livestream_name\": \"Gaming_stream\"\n  },\n  \"reconnectWindow\": 100\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "metadata": ["livestream_name": "Gaming_stream"],
  "reconnectWindow": 100
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fastpix.com/v1/live/streams/91a264dcc447b63da6fb79ef925cd76d")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```