> 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 the source access of a media by ID

PATCH https://api.fastpix.com/v1/on-demand/{mediaId}/source-access
Content-Type: application/json

This endpoint allows you to update the `sourceAccess` setting of an existing media file. The `sourceAccess` parameter determines whether the original media file is accessible or restricted. Setting this to `true` enables access to the media source, while setting it to `false` restricts access.

#### How it works

1. Make a `PATCH` request to this endpoint, replacing `{mediaId}` with the ID of the media you want to update.

2. Include the updated `sourceAccess` parameter in the request body.

3. You receive a response confirming the update to the media’s source access status.

4. Webhook events: video.media.source.ready, video.media.source.deleted

Reference: https://fastpix.com/docs/video-on-demand-api/manage-videos/updated-source-access

## 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

- `mediaId` (string, required) — The unique identifier assigned to the media when created. The value must be a valid UUID.

### Body (application/json)

This endpoint expects an object.

- `sourceAccess` (boolean, required) — The sourceAccess parameter determines whether the original media file is accessible. Set to true to enable access or false to restrict it.

## Response

### 200

Media details updated successfully

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

## Types

### sourceAccessMedia

- `thumbnail` (string, optional, nullable) — A video thumbnail is a still image that acts as the preview image for your video.
- `id` (string, optional) — The unique identifier assigned to the media when created. The value must be a valid UUID.
- `workspaceId` (string, optional) — A unique identifier is generated by FastPix for the workspace.
- `metadata` (map from string to string, optional, nullable) — You can search for videos with specific key value pairs using metadata, when you tag a video in "key" : "value" 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.
- `mediaQuality` (enum, optional) — The quality tier applied to the media.
  - Allowed values: `standard`, `pro`, `premium`, `custom`
- `creatorId` (string, optional) — The unique identifier of the user who created this media.
- `title` (string, optional, nullable) — Title of the media file.
- `tags` (list of string, optional, nullable) — Free-form labels attached to the media for grouping or filtering.
- `thirdPartyId` (string, optional, nullable) — Your own identifier for this media in an external system. FastPix stores it with the media and returns it as is.
- `maxResolution` (enum, optional, default: 1080p) — The maximum resolution specified by the user for the media.
  - Allowed values: `2160p`, `1440p`, `1080p`, `720p`, `480p`
- `codecTier` (enum, optional) — The codec tier the media is encoded with. basic uses H.264, plus uses H.264 and H.265.
  - Allowed values: `basic`, `plus`
- `sourceResolution` (string, optional) — The actual resolution of the uploaded media. This represents the native quality of the source media.
- `status` (enum, optional) — Determines the media's status, which can be one of the possible values.
  - Allowed values: `Created`, `Downloading`, `Downloaded`, `Validating`, `In Queue`, `Processing`, `Ready`, `Failed`
- `mp4Support` (list of SourceAccessMediaMp4SupportItems, optional, nullable) — A list of MP4 renditions generated for the media when MP4 support is requested. Each entry represents one downloadable rendition (for example, a capped-4K video file or an audio-only m4a file) along with its generation status. Omitted when no MP4 support has been requested.
- `sourceAccess` (boolean, optional, nullable) — The sourceAccess parameter determines whether the original media file is accessible. Set to true to enable access or false to restrict it.
- `optimizeAudio` (boolean, optional, nullable) — Whether the audio track of the media has been volume-normalized.
- `playbackIds` (list of PlaybackId, optional) — A collection of Playback ID objects utilized for crafting HLS playback URLs.
- `tracks` (list of SourceAccessMediaTracksItems, optional) — A media consists of different media tracks, like video, audio, and subtitle, all combined.
- `generatedSubtitles` (list of TracksSubtitles, optional, nullable) — List of generated subtitle tracks associated with the media.
- `isAudioOnly` (boolean, optional, nullable) — Indicates whether the media contains only audio (no video track).
- `subtitleAvailable` (boolean, optional, nullable) — Indicates whether subtitles are available for the media.
- `duration` (double, optional) — The length of the media in seconds, with a maximum allowed duration of 12 hours per individual media.
- `aspectRatio` (string, optional, nullable) — The aspect ratio of a video describes its shape based on the relationship between its width and height.
- `createdAt` (datetime, optional) — Time the media was created, defined as a localDateTime (UTC Time).
- `updatedAt` (datetime, optional) — Time the media was updated, defined as a localDateTime (UTC Time).

### SourceAccessMediaMp4SupportItems

- `type` (enum, optional) — The MP4 rendition type. `capped_4k` is a downloadable MP4 video capped at 4K resolution, `audioOnly` is a downloadable m4a audio-only file.
  - Allowed values: `capped_4k`, `audioOnly`
- `status` (enum, optional) — Generation status of this MP4 rendition.
  - Allowed values: `preparing`, `ready`, `failed`
- `height` (integer, optional, nullable) — Pixel height of the rendition. Omitted for the `audioOnly` type.
- `width` (integer, optional, nullable) — Pixel width of the rendition. Omitted for the `audioOnly` type.
- `ext` (enum, optional) — File extension of the downloadable rendition.
  - Allowed values: `mp4`, `m4a`

### PlaybackId

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

- `id` (string, optional, nullable) — A unique identifier is generated by FastPix for the playbacks.
- `accessPolicy` (enum, optional) — Access policy for media content
  - Allowed values: `public`, `private`, `drm`
- `accessRestrictions` (PlaybackIdAccessRestrictions, 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.

### SourceAccessMediaTracksItems

- VIDEO_TRACK: VideoTrack
- AUDIO_TRACK: AudioTrack
- SUBTITLE_TRACK: SubtitleTrack

### TracksSubtitles

- `status` (string, optional) — Current status of the generated subtitle track.
- `url` (string, optional, nullable) — URL of the generated subtitle file (VTT). Null while preparing.

### PlaybackIdAccessRestrictions

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` (PlaybackIdAccessRestrictionsDomains, optional) — Restrictions based on the originating domain of a request (for example, whether requests from certain websites must be allowed or blocked).
- `userAgents` (PlaybackIdAccessRestrictionsUserAgents, optional) — Restrictions based on the user agent (which is typically a string sent by browsers or bots identifying themselves).

### VideoTrack

A media consists of different media tracks, like video, audio, and subtitle, all combined.

- `id` (string, optional) — FastPix generates a unique identifier for each track.
- `type` (enum, optional) — Defines the type of input. This option is mandatory.
  - Allowed values: `video`
- `width` (double, optional) — Track width denotes the range of widths applicable to a specific track. Currently, this setting can be modified only for video tracks
- `height` (double, optional) — Track height denotes the range of height applicable to a specific track. Currently, this setting can be modified only for video tracks.
- `frameRate` (string, optional) — Frame rate quantifies the speed at which frames are displayed per second. It represents the range of frames available for a specific track. The indeterminable frame rate of the input file is indicated by a value of -1.
- `status` (string, optional) — Indicates the current state of the track. 'available' means the track has been processed successfully and is ready to be used or played.
- `title` (string, optional) — Title of the track.

### AudioTrack

A media consists of different media tracks, like video, audio, and subtitle, all combined.

- `id` (string, optional) — FastPix generates a unique identifier for each track.
- `type` (enum, optional) — Defines the type of input track.
  - Allowed values: `audio`
- `status` (string, optional) — Indicates the current state of the track. 'available' means the track has been processed successfully and is ready to be used or played.
- `title` (string, optional) — Title of the track.
- `languageName` (string, optional) — Name of the language in which the subtitles will be generated.
- `languageCode` (string, optional) — Language codes are concise, standardized symbols that denote languages, utilizing either two or three characters for identification. The language code must be compliant with the BCP 47 standard to ensure compatibility. (for text only).

### SubtitleTrack

A media consists of different media tracks, like video, audio, and subtitle, all combined.

- `id` (string, optional) — FastPix generates a unique identifier for each track.
- `type` (enum, optional) — Defines the type of input track.
  - Allowed values: `subtitle`
- `status` (string, optional) — Indicates the current state of the track. 'available' means the track has been processed successfully and is ready to be used or played.
- `title` (string, optional) — Title of the track.
- `languageName` (string, optional) — Name of the language in which the subtitles will be generated.
- `languageCode` (string, optional) — Language codes are concise, standardized symbols that denote languages, utilizing either two or three characters for identification. The language code must be compliant with the BCP 47 standard to ensure compatibility. (for text only).

### PlaybackIdAccessRestrictionsDomains

Restrictions based on the originating domain of a request (for example, whether requests from certain websites must be 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.
- `deny` (list of string, optional) — A list of domains that are explicitly blocked from accessing the resource.

### PlaybackIdAccessRestrictionsUserAgents

Restrictions based on the user agent (which is 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.
- `deny` (list of string, optional) — A list of specific user agents that are blocked.

## Examples

**Request**

```json
{
  "sourceAccess": true
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "thumbnail": "https://venus-images.fastpix.dev/cf41c9f7-ece3-4efe-8d31-c6e000dc422b/thumbnail.png",
    "id": "eb56a668-0354-40c2-9233-f3197e1baabd",
    "workspaceId": "c788be40-91a5-4d2d-abf7-47398a6276a1",
    "metadata": {
      "key1": "value1"
    },
    "mediaQuality": "standard",
    "maxResolution": "1080p",
    "codecTier": "basic",
    "sourceResolution": "1080p",
    "status": "Ready",
    "sourceAccess": true,
    "playbackIds": [
      {
        "id": "cf41c9f7-ece3-4efe-8d31-c6e000dc422b",
        "accessPolicy": "public",
        "accessRestrictions": {
          "domains": {
            "defaultPolicy": "allow",
            "allow": [],
            "deny": []
          },
          "userAgents": {
            "defaultPolicy": "allow",
            "allow": [],
            "deny": []
          }
        }
      }
    ],
    "tracks": [
      {
        "id": "344fd5bc-82af-4d11-bc1c-785d9e6f9aef",
        "type": "video",
        "width": 1920,
        "height": 1080,
        "frameRate": "30/1",
        "status": "available"
      }
    ],
    "generatedSubtitles": [],
    "isAudioOnly": false,
    "subtitleAvailable": false,
    "duration": 10.5,
    "aspectRatio": "16:9",
    "createdAt": "2024-12-06T03:47:26.489888Z",
    "updatedAt": "2024-12-06T03:47:47.593400Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.fastpix.com/v1/on-demand/4fa85f64-5717-4562-b3fc-2c963f66afa6/source-access"

payload = { "sourceAccess": True }
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/on-demand/4fa85f64-5717-4562-b3fc-2c963f66afa6/source-access';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'PATCH',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"sourceAccess":true}'
};

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/on-demand/4fa85f64-5717-4562-b3fc-2c963f66afa6/source-access"

	payload := strings.NewReader("{\n  \"sourceAccess\": true\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/on-demand/4fa85f64-5717-4562-b3fc-2c963f66afa6/source-access")

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  \"sourceAccess\": true\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/on-demand/4fa85f64-5717-4562-b3fc-2c963f66afa6/source-access")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{\n  \"sourceAccess\": true\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.fastpix.com/v1/on-demand/4fa85f64-5717-4562-b3fc-2c963f66afa6/source-access', [
  'body' => '{
  "sourceAccess": true
}',
  '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/on-demand/4fa85f64-5717-4562-b3fc-2c963f66afa6/source-access");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.PATCH);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"sourceAccess\": true\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 = ["sourceAccess": true] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fastpix.com/v1/on-demand/4fa85f64-5717-4562-b3fc-2c963f66afa6/source-access")! 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()
```