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

# Upload media from device

POST https://api.fastpix.com/v1/on-demand/upload
Content-Type: application/json

This endpoint enables accelerated uploads of large media files directly from your local device to FastPix for processing and storage.

> **NOTE**
>
> This version now supports uploads with no file size limitations and offers faster uploads. The previous endpoint (which had a 500MB size limit) is now deprecated. You can find details in the [changelog](https://fastpix.com/docs/changelog/release-notes).

#### How it works

1. Send a POST request to this endpoint with optional media settings.

2. The response includes an `uploadId` and a signed `url` for direct video file upload.

3. Upload your video file to the provided url by making a PUT request. The API accepts the media file from your device and uploads it to the FastPix platform. (Refer to Step 3: Initiate the upload for complete instructions.)

4. Once uploaded, the media undergoes processing and is assigned a unique ID for tracking. Retain this `uploadId` for any future operations related to this upload.

After uploading, you can use the Get Media by ID endpoint to check the status of the uploaded media asset and see if it has transitioned to a `Ready` status for playback.

To notify your application about the status of this API request check for the webhooks for media related events.

#### Example

A social media platform allows users to upload video content directly from their phones or computers. This endpoint facilitates the upload process. For example, if you are developing a video-sharing app where users can upload short clips from their mobile devices, this endpoint enables them to select a video, upload it to the platform.

Related guide: Upload videos directly

Reference: https://fastpix.com/docs/video-on-demand-api/input-video/direct-upload-video-media

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

### Body (application/json)

This endpoint expects an object.

- `corsOrigin` (string, required, default: *) — Upload media directly from a device using the URL name or enter "*" to allow all.
- `pushMediaSettings` (OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettings, optional) — Configuration settings for uploading and processing media on the FastPix platform.\ These settings define how the uploaded video is handled, including access control, resolution, DRM, and optional metadata.\ For a complete explanation of how media uploads and processing work, refer to the\ FastPix Video on Demand Overview.

## Response

### 201

Direct upload created successfully

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

## Types

### OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettings

Configuration settings for uploading and processing media on the FastPix platform.\ These settings define how the uploaded video is handled, including access control, resolution, DRM, and optional metadata.\ For a complete explanation of how media uploads and processing work, refer to the\ FastPix Video on Demand Overview.

- `accessPolicy` (enum, required, default: public) — Determines if access to the streamed content is kept private, drm or available to all.
  - Allowed values: `public`, `private`, `drm`
- `startTime` (double, optional) — Start time indicates where encoding must begin within the video file, in seconds.
- `endTime` (double, optional) — End time indicates where encoding must end within the video file, in seconds.
- `inputs` (list of OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsInputsItems, optional) — Add one input object at a time. For example, first add a **WatermarkInput** object. If you also need a audio, click **Add item** again and select **AudioInput**. Repeat this process for **SubtitleInput** as needed.
- `metadata` (map from string to string, optional) — "Tag a video in "key" : "value" pairs for searchable metadata. Maximum 10 entries, 255 characters each."
- `drmConfigurationId` (string, optional) — UUID of the DRM configuration to be used.
- `title` (string, optional) — Title of the media file.
- `creatorId` (string, optional) — The unique identifier of the user who created this media.
- `subtitles` (OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsSubtitles, optional) — Generates subtitle files for audio/video files.
- `optimizeAudio` (boolean, optional) — Enhance the quality and volume of the audio track. This is available for pre-recorded content only.
- `maxResolution` (enum, optional, default: 1080p) — Determines the highest quality resolution available.
  - Allowed values: `2160p`, `1440p`, `1080p`, `720p`, `480p`
- `mediaQuality` (enum, optional, default: standard) — The quality tier applied to the media.
  - Allowed values: `standard`, `pro`, `premium`
- `sourceAccess` (boolean, optional) — The sourceAccess parameter determines whether the original media file is accessible. Set to true to enable access or false to restrict it
- `mp4Support` (enum, optional) — Generates MP4 video up to 4K ("capped_4k"), m4a audio only ("audioOnly"), or both for offline viewing.
  - Allowed values: `capped_4k`, `audioOnly`, `audioOnly,capped_4k`
- `summary` (OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsSummary, optional)
- `chapters` (boolean, optional) — Enable or disable the chapters feature for the media. Set to `true` to enable chapters or `false` to disable.
- `namedEntities` (boolean, optional) — Enable or disable named entity extraction. Set to `true` to enable or `false` to disable.
- `moderation` (OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsModeration, optional)
- `accessRestrictions` (OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsAccessRestrictions, optional)

### DirectUpload

Displays the result of the request.

- `uploadId` (string, optional) — The unique identifier assigned to the media when created. The value must be a valid UUID.
- `trial` (boolean, optional) — Indicates if the upload was a trial.
- `status` (enum, optional) — Determines the media's status, which can be one of the possible values.
  - Allowed values: `waiting`
- `url` (string, optional) — The url hosts the media file for FastPix, which needs to be download to use further. It supports formats like MP3, MP4, MOV, MKV, or TS, and includes text tracks for subtitles/CC (SRT file/VTT file). While FastPix can handle various audio and video formats and codecs, using standard inputs can help with optimal processing speed.
- `timeout` (double, optional, default: 14400) — The duration set for the validity of the upload URL. If the upload isn't completed within this timespan, it's marked as timed out.
- `corsOrigin` (string, optional) — Upload media directly from a device using the url name or enter "*" to allow all.
- `pushMediaSettings` (DirectUploadResponse, optional)

### OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsInputsItems

### OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsSubtitles

Generates subtitle files for audio/video files.

- `languageName` (string, optional) — Name of the language for the subtitles.
- `metadata` (map from string to string, optional) — "Tag a video in "key" : "value" pairs for searchable metadata. Maximum 10 entries, 255 characters each."
- `languageCode` (enum, optional) — Language codes (BCP 47 compliant) used for text files.
  - Allowed values: `en`, `it`, `pl`, `es`, `fr`, `ru`, `nl`

### OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsSummary

- `generate` (boolean, optional) — Enable or disable the summary feature for the media. Set to true to enable summary or false to disable.
- `summaryLength` (integer, optional) — Specifies the desired word count for the generated summary. - The value must be between **30** and **250** words.

### OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsModeration

- `type` (enum, optional) — Defines the type of input. Possible values include video, audio, av.
  - Allowed values: `video`, `audio`, `av`

### OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsAccessRestrictions

- `domains` (OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsAccessRestrictionsDomains, optional)
- `userAgents` (OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsAccessRestrictionsUserAgents, optional)

### DirectUploadResponse

- `playbackIds` (list of PlaybackId, optional)
- `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" 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`
- `sourceAccess` (boolean, optional) — 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) — Enhance the quality and volume of the audio track. This is available for pre-recorded content only.

### VideoInput

- `type` (string, required) — Defines the type of input.
- `introUrl` (string, optional) — The url of the intro video which is to be added at the start of the video.
- `outroUrl` (string, optional) — The url of the outro video which is to be added at the end of the video.
- `expungeSegments` (list of string, optional) — The list of the startTime-endTime of the segments to be removed from the actual video.
- `segments` (list of VideoInputSegmentsItems, optional) — A list of media segments to be added or processed. Each segment includes details such as the URL of the media file and instructions on where it should be inserted in the final media composition. A segment can either specify an exact timestamp (`insertAt`) or indicate that it should be added at the end (`insertAtEnd`).

### WatermarkInput

Contains configuration details for applying a watermark overlay to a video.\ The watermark is placed over the media content during processing.\ For detailed setup steps and customization options, refer to the FastPix Watermark Guide.

- `type` (enum, required) — Type of overlay (currently only supports "watermark").
  - Allowed values: `watermark`
- `url` (string, required) — URL of the watermark image.
- `placement` (WatermarkInputPlacement, optional)
- `width` (string, optional) — Width of the watermark in percentage or pixels.
- `height` (string, optional) — Height of the watermark in percentage or pixels.
- `opacity` (string, optional) — Opacity of the watermark in percentage.

### AudioInput

- `type` (enum, required) — Type of overlay (currently only supports "audio").
  - Allowed values: `audio`
- `swapTrackUrl` (string, required) — URL of the audio track to replace the existing audio in the video.
- `imposeTracks` (list of AudioInputImposeTracksItems, optional) — List of additional audio tracks to overlay on the video.

### SubtitleInput

Generates subtitle files for audio/video files.

- `type` (string, required) — Defines the type of input.
- `url` (string, required) — The direct URL of the subtitle file.
- `languageName` (string, required) — Name of the language in which the subtitles will be generated.
- `languageCode` (enum, required, default: en-US) — Language code for content localization
  - Allowed values: `ar-SA`, `bn-BD`, `bn-IN`, `ca-ES`, `cs-CZ`, `da-DK`, `de-AT`, `de-CH`, `de-DE`, `el-GR`, `en-AU`, `en-CA`, `en-GB`, `en-IE`, `en-IN`, `en-NZ`, `en-US`, `en-ZA`, `es-AR`, `es-CL`, `es-CO`, `es-ES`, `es-MX`, `es-US`, `fi-FI`, `fr-BE`, `fr-CA`, `fr-CH`, `fr-FR`, `he-IL`, `hi-IN`, `hr-HR`, `hu-HU`, `id-ID`, `it-CH`, `it-IT`, `ja-JP`, `ko-KR`, `ms-MY`, `nb-NO`, `nl-BE`, `nl-NL`, `no-NO`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sv-SE`, `ta-IN`, `ta-LK`, `te-IN`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `bg-BG`, `zh-CN`, `zh-HK`, `zh-TW`

### OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsAccessRestrictionsDomains

- `defaultPolicy` (enum, optional) — Specifies the default access policy for domains. If set to `allow`, all domains are allowed access unless otherwise specified in the `deny` list. If set to `deny`, all domains are denied access unless otherwise specified in the `allow` list.
  - Allowed values: `allow`, `deny`
- `allow` (list of string, optional) — A list of domain names or patterns that are explicitly allowed access. This list is only effective when the `defaultPolicy` is set to `deny`.
- `deny` (list of string, optional) — A list of domain names or patterns that are explicitly denied access. This list is only effective when the `defaultPolicy` is set to `allow`.

### OnDemandUploadPostRequestBodyContentApplicationJsonSchemaPushMediaSettingsAccessRestrictionsUserAgents

- `defaultPolicy` (enum, optional) — Specifies the default access policy for user agents (browsers, bots, etc.). If set to `allow`, all user agents are allowed access unless otherwise specified in the `deny` list. If set to `deny`, all user agents are denied access unless otherwise specified in the `allow` list.
  - Allowed values: `allow`, `deny`
- `allow` (list of string, optional) — A list of user agents (identified by string names or patterns) that are explicitly allowed access. This list is only effective when the `defaultPolicy` is set to `deny`.
- `deny` (list of string, optional) — A list of user agents (identified by string names or patterns) that are explicitly denied access. This list is only effective when the `defaultPolicy` is set to `allow`.

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

### VideoInputSegmentsItems

### WatermarkInputPlacement

- `xAlign` (enum, optional) — Horizontal alignment of the watermark.
  - Allowed values: `left`, `center`, `right`
- `xMargin` (string, optional) — Horizontal margin from the edge of the video.
- `yAlign` (enum, optional) — Vertical alignment of the watermark.
  - Allowed values: `top`, `middle`, `bottom`
- `yMargin` (string, optional) — Vertical margin from the edge of the video.

### AudioInputImposeTracksItems

- `url` (string, optional) — URL of the audio track to impose on the video.
- `startTime` (integer, optional) — Start time (in seconds) of the imposed audio in the video.
- `endTime` (integer, optional) — End time (in seconds) of the imposed audio in the video.
- `fadeInLevel` (integer, optional) — Level of fade-in effect (in seconds) at the start of the imposed audio.
- `fadeOutLevel` (integer, optional) — Level of fade-out effect (in seconds) at the end of the imposed audio.

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

### VideoInputSegmentsItems0

- `url` (string, required) — URL of the segment to be added.
- `insertAt` (integer, required) — The timestamp at which the segment should be inserted.

### VideoInputSegmentsItems1

- `url` (string, required) — URL of the segment to be added.
- `insertAtEnd` (boolean, required) — Flag indicating the segment should be inserted at the end.

### 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
{
  "corsOrigin": "*",
  "pushMediaSettings": {
    "accessPolicy": "public",
    "metadata": {
      "key1": "value1"
    },
    "maxResolution": "1080p",
    "mediaQuality": "standard"
  }
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "uploadId": "beff5537-de85-42e1-a673-2a405cd94177",
    "trial": false,
    "status": "waiting",
    "url": "https://storage.googleapis.com/fastpix-uploads-us/8a5ab157-c586-458a-bb2e-caa8a8b76a19/4190bbde-4c34-41e4-b70e-90ba2aa0b79e?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=dev-staging-pub-sub%40fastpix-vms.iam.gserviceaccount.com%2F20250708%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20250708T071545Z&X-Goog-Expires=14400&X-Goog-SignedHeaders=host%3Bx-goog-resumable&X-Goog-Signature=7be4a17c181b222f5f70e5156843585dc2a9769d61126d77c7b83413a97256cbb8214aa09a8977ce09c1023148ef0f1f42265ddc436df29e66e00e76fbbed13b01e01bc95d15aa65aef695ef7556a306fad5cdc8bf81049ac17e8e95dd95dc80bac3ca684c584dc7a23494f3b29c2dfe9c039a5152d66dddb603c20409d0fda685981b3dfe0f8e0f34fc983d444fce9bbe0dda750a3eb756d1e2887ffa1aef242f208b157988c5fc5f68aa574dd1ef401162f150bc8d5218156d9655c368b359ad5b12c96d2e69654d4da87f34c4df9f22613cdd88357c448aa1f340e11e482e53156bc18a256e4dcf2b37a0ee875c9c941f978ab660637acfc3ccddb37628e8",
    "timeout": 14400,
    "corsOrigin": "*",
    "pushMediaSettings": {
      "playbackIds": [
        {
          "accessPolicy": "public",
          "accessRestrictions": {
            "domains": {
              "defaultPolicy": "allow",
              "allow": [],
              "deny": []
            },
            "userAgents": {
              "defaultPolicy": "allow",
              "allow": [],
              "deny": []
            }
          }
        }
      ],
      "metadata": {
        "key1": "value1"
      },
      "mediaQuality": "standard",
      "sourceAccess": false,
      "optimizeAudio": false
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.fastpix.com/v1/on-demand/upload"

payload = {
    "corsOrigin": "*",
    "pushMediaSettings": {
        "accessPolicy": "public",
        "metadata": { "key1": "value1" },
        "maxResolution": "1080p",
        "mediaQuality": "standard"
    }
}
headers = {
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.fastpix.com/v1/on-demand/upload';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"corsOrigin":"*","pushMediaSettings":{"accessPolicy":"public","metadata":{"key1":"value1"},"maxResolution":"1080p","mediaQuality":"standard"}}'
};

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/upload"

	payload := strings.NewReader("{\n  \"corsOrigin\": \"*\",\n  \"pushMediaSettings\": {\n    \"accessPolicy\": \"public\",\n    \"metadata\": {\n      \"key1\": \"value1\"\n    },\n    \"maxResolution\": \"1080p\",\n    \"mediaQuality\": \"standard\"\n  }\n}")

	req, _ := http.NewRequest("POST", 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/upload")

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

request = Net::HTTP::Post.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"corsOrigin\": \"*\",\n  \"pushMediaSettings\": {\n    \"accessPolicy\": \"public\",\n    \"metadata\": {\n      \"key1\": \"value1\"\n    },\n    \"maxResolution\": \"1080p\",\n    \"mediaQuality\": \"standard\"\n  }\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.post("https://api.fastpix.com/v1/on-demand/upload")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{\n  \"corsOrigin\": \"*\",\n  \"pushMediaSettings\": {\n    \"accessPolicy\": \"public\",\n    \"metadata\": {\n      \"key1\": \"value1\"\n    },\n    \"maxResolution\": \"1080p\",\n    \"mediaQuality\": \"standard\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fastpix.com/v1/on-demand/upload', [
  'body' => '{
  "corsOrigin": "*",
  "pushMediaSettings": {
    "accessPolicy": "public",
    "metadata": {
      "key1": "value1"
    },
    "maxResolution": "1080p",
    "mediaQuality": "standard"
  }
}',
  '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/upload");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"corsOrigin\": \"*\",\n  \"pushMediaSettings\": {\n    \"accessPolicy\": \"public\",\n    \"metadata\": {\n      \"key1\": \"value1\"\n    },\n    \"maxResolution\": \"1080p\",\n    \"mediaQuality\": \"standard\"\n  }\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 = [
  "corsOrigin": "*",
  "pushMediaSettings": [
    "accessPolicy": "public",
    "metadata": ["key1": "value1"],
    "maxResolution": "1080p",
    "mediaQuality": "standard"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fastpix.com/v1/on-demand/upload")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```