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

# Create media from URL

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

This endpoint allows developers or users to create a new video or audio media in FastPix using a publicly accessible URL. FastPix fetches the media from the provided URL, processes it, and stores it on the platform for use.

#### Public URL requirement:

The provided URL must be publicly accessible and must point to a video stored in one of the following supported formats: .m4v, .ogv, .mpeg, .mov, .3gp, .f4v, .rm, .ts, .wtv, .avi, .mp4, .wmv, .webm, .mts, .vob, .mxf, asf, m2ts

#### Supported storage types:

The URL can originate from various cloud storage services or content delivery networks (CDNs) such as:

* **Amazon S3:** URLs from Amazon's Simple Storage Service.

* **Google Cloud Storage:** URLs from Google Cloud's storage solution.

* **Azure Blob Storage:** URLs from Microsoft's Azure storage.

* **Public CDNs:** URLs from public content delivery networks that host video files.

Upon successful creation, the API returns an `id` that must be retained for future operations related to this media.

#### How it works

1. Send a POST request to this endpoint with the media URL (typically a video or audio file) and optional media settings.

2. FastPix uploads the video from the provided URL to its storage.

3. Receive a response containing the unique id for the newly created media item.

4. Use the id in subsequent API calls, such as checking the status of the media with the Get Media by ID endpoint to determine when the media is ready for playback.

FastPix uses webhooks to tell your application about things that happen in the background, outside of the API regular request flow. For instance, after the media file is created (but not yet processed or encoded), FastPix sends a `POST` request to your specified webhook URL with the event video.media.created.

After processing completes, monitor the events video.media.ready and video.media.failed to track the status of the media file.

Related guide: Upload videos from URL

Reference: https://fastpix.com/docs/video-on-demand-api/input-video/create-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 a CreateMediaRequest.

- `inputs` (list of CreateMediaRequestInputsItems, required) — Add one input object at a time. For example, first add a **VideoInput** object. If you also need a watermark, click **Add item** again and select **WatermarkInput**. Repeat this process for **AudioInput** or **SubtitleInput** as needed. For a complete explanation of how media uploads from URL and processing work, refer to the\ FastPix Video on Demand Overview.
- `accessPolicy` (enum, required, default: public) — Determines whether access to the streamed content is kept private or available to all.
  - Allowed values: `public`, `private`, `drm`
- `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.
- `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` (CreateMediaRequestSubtitles, optional) — Generates subtitle files for audio/video files.
- `mp4Support` (enum, optional) — "capped_4k": Generates an mp4 video file up to 4k resolution "audioOnly": Generates an m4a audio file of the media file "audioOnly,capped_4k": Generates both video and audio media files for offline viewing
  - Allowed values: `capped_4k`, `audioOnly`, `audioOnly,capped_4k`
- `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) — normalize volume of the audio track. This is available for pre-recorded content only.
- `maxResolution` (enum, optional, default: 1080p) — The maximum resolution tier defines the highest quality at which your media is 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`
- `summary` (CreateMediaRequestSummary, 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` (CreateMediaRequestModeration, optional)
- `accessRestrictions` (CreateMediaRequestAccessRestrictions, optional)

## Response

### 201

Media is created successfully

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

## Types

### CreateMediaRequestInputsItems

- PULLVIDEOINPUT: PullVideoInput
- WATERMARKINPUT: WatermarkInput
- AUDIOINPUT: AudioInput
- SUBTITLEINPUT: SubtitleInput

### CreateMediaRequestSubtitles

Generates subtitle files for audio/video files.

- `languageName` (string, optional) — Name of the language in which the subtitles will be generated.
- `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.
- `languageCode` (enum, 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).
  - Allowed values: `en`, `it`, `pl`, `es`, `fr`, `ru`, `nl`

### CreateMediaRequestSummary

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

### CreateMediaRequestModeration

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

### CreateMediaRequestAccessRestrictions

- `domains` (CreateMediaRequestAccessRestrictionsDomains, optional)
- `userAgents` (CreateMediaRequestAccessRestrictionsUserAgents, optional)

### CreateMediaResponse

- `id` (string, optional) — The Media is assigned a universal unique identifier, which can contain a maximum of 255 characters.
- `trial` (boolean, optional, default: true) — FastPix allows for a free trial. Create as many media files as you like during the trial period. Remember, each clip can only be 10 seconds long and will be deleted after 24 hours. Also, all trial content will have the FastPix logo watermark.
- `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`
- `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).
- `playbackIds` (list of PlaybackId, optional) — A collection of Playback ID objects utilized for crafting HLS playback URLs.
- `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.
- `maxResolution` (enum, optional) — The maximum resolution tier defines the highest quality at which your media is available.
  - Allowed values: `2160p`, `1440p`, `1080p`, `720p`, `480p`
- `inputs` (list of CreateMediaResponseInputsItems, optional) — A list of media input sources to be processed.
- `optimizeAudio` (boolean, optional) — Enhance the quality and volume of the audio track. This is available for pre-recorded content only.

### PullVideoInput

- `type` (string, required, default: video) — Defines the type of input.
- `url` (string, required, default: https://static.fastpix.com/fp-sample-video.mp4) — The URL hosts the media file for FastPix, which needs to be downloaded to use further. It supports formats like MP3, MP4, MOV, MKV, or TS, and includes text tracks for subtitles or closed captions (SRT/VTT files). The URL must be valid, publicly accessible, and downloadable to ensure FastPix can fetch the file successfully. While FastPix can handle various audio and video formats and codecs, using standard and widely supported formats helps achieve optimal processing speed.
- `startTime` (integer, optional) — Start time indicates where encoding must begin within the video file. For example, if you want to encode a segment from 3 minutes (180 seconds) to 6 minutes (360 seconds) in a 10-minute (600 seconds) video, the start time is 3 minutes (180 seconds). Note: Start time is always mentioned in seconds.
- `endTime` (integer, optional) — End time indicates where encoding must end within the video file. For example, if you want to encode a segment from 3 minutes (180 seconds) to 6 minutes (360 seconds) in a 10-minute (600 seconds) video, the end time is 6 minutes (360 seconds). Note: End time is always mentioned in seconds.
- `introUrl` (string, optional) — The URL of the **intro video** to be added at the beginning of the media file. The URL must be **valid, publicly accessible, and downloadable** so that FastPix can fetch the file successfully. Supported video formats include **MP4, MOV, MKV, and TS** for optimal processing performance.
- `outroUrl` (string, optional) — The URL of the **outro video** to be added at the end of the media file. The URL must be **valid, publicly accessible, and downloadable** so that FastPix can retrieve the file successfully. Supported video formats include **MP4, MOV, MKV, and TS** for best compatibility and processing speed.
- `expungeSegments` (list of string, optional) — The list of start and end times (in seconds) of the segments to be removed from the actual video.
- `segments` (list of PullVideoInputSegmentsItems, 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 must 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`

### CreateMediaRequestAccessRestrictionsDomains

- `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` lists. If set to `deny`, all domains are denied access unless otherwise specified in the `allow` lists.
  - 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`.

### CreateMediaRequestAccessRestrictionsUserAgents

- `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` lists. If set to `deny`, all user agents are denied access unless otherwise specified in the `allow` lists.
  - 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.

### CreateMediaResponseInputsItems

- `type` (string, optional) — The type of input media. Commonly set to `video`.
- `url` (string, optional) — The publicly accessible URL of the input video file.

### PullVideoInputSegmentsItems

- PullVideoInputSegmentsItems0
- PullVideoInputSegmentsItems1

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

### PullVideoInputSegmentsItems0

- `url` (string, required) — The URL of the **video segment** to be added. The URL must be **valid, publicly accessible, and downloadable** so that FastPix can retrieve and process the segment successfully. Supported video formats include **MP4, MOV, MKV, and TS** for best compatibility and performance.
- `insertAt` (integer, required) — The timestamp(in seconds) at which the segment must be inserted.

### PullVideoInputSegmentsItems1

- `url` (string, required) — The URL of the **video segment** to be added. The URL must be **valid, publicly accessible, and downloadable** so that FastPix can retrieve and process the segment successfully. Supported video formats include **MP4, MOV, MKV, and TS** for best compatibility and performance.
- `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
{
  "inputs": [
    {
      "type": "video",
      "url": "https://static.fastpix.com/fp-sample-video.mp4"
    }
  ],
  "accessPolicy": "public",
  "metadata": {
    "key1": "value1"
  },
  "maxResolution": "1080p",
  "mediaQuality": "standard"
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "id": "a1d1acdd-8f4e-4add-b498-6b398cf349d9",
    "trial": true,
    "status": "Created",
    "createdAt": "2023-10-20T10:50:34.594302Z",
    "updatedAt": "2023-10-20T10:50:34.594302Z",
    "playbackIds": [
      {
        "id": "6ta85f64-5717-4562-b3fc-2c963f66afa6",
        "accessPolicy": "public",
        "accessRestrictions": {
          "domains": {
            "defaultPolicy": "allow",
            "allow": [
              "string"
            ],
            "deny": [
              "string"
            ]
          },
          "userAgents": {
            "defaultPolicy": "allow",
            "allow": [
              "string"
            ],
            "deny": [
              "string"
            ]
          }
        }
      }
    ],
    "metadata": {
      "key1": "value1"
    },
    "mediaQuality": "standard",
    "sourceAccess": false,
    "maxResolution": "1080p",
    "inputs": [
      {
        "type": "video",
        "url": "https://static.fastpix.com/fp-sample-video.mp4"
      }
    ],
    "optimizeAudio": false
  }
}
```

**SDK Code**

```python
import requests

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

payload = {
    "inputs": [
        {
            "type": "video",
            "url": "https://static.fastpix.com/fp-sample-video.mp4"
        }
    ],
    "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';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"inputs":[{"type":"video","url":"https://static.fastpix.com/fp-sample-video.mp4"}],"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"

	payload := strings.NewReader("{\n  \"inputs\": [\n    {\n      \"type\": \"video\",\n      \"url\": \"https://static.fastpix.com/fp-sample-video.mp4\"\n    }\n  ],\n  \"accessPolicy\": \"public\",\n  \"metadata\": {\n    \"key1\": \"value1\"\n  },\n  \"maxResolution\": \"1080p\",\n  \"mediaQuality\": \"standard\"\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")

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  \"inputs\": [\n    {\n      \"type\": \"video\",\n      \"url\": \"https://static.fastpix.com/fp-sample-video.mp4\"\n    }\n  ],\n  \"accessPolicy\": \"public\",\n  \"metadata\": {\n    \"key1\": \"value1\"\n  },\n  \"maxResolution\": \"1080p\",\n  \"mediaQuality\": \"standard\"\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")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{\n  \"inputs\": [\n    {\n      \"type\": \"video\",\n      \"url\": \"https://static.fastpix.com/fp-sample-video.mp4\"\n    }\n  ],\n  \"accessPolicy\": \"public\",\n  \"metadata\": {\n    \"key1\": \"value1\"\n  },\n  \"maxResolution\": \"1080p\",\n  \"mediaQuality\": \"standard\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fastpix.com/v1/on-demand', [
  'body' => '{
  "inputs": [
    {
      "type": "video",
      "url": "https://static.fastpix.com/fp-sample-video.mp4"
    }
  ],
  "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");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"inputs\": [\n    {\n      \"type\": \"video\",\n      \"url\": \"https://static.fastpix.com/fp-sample-video.mp4\"\n    }\n  ],\n  \"accessPolicy\": \"public\",\n  \"metadata\": {\n    \"key1\": \"value1\"\n  },\n  \"maxResolution\": \"1080p\",\n  \"mediaQuality\": \"standard\"\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 = [
  "inputs": [
    [
      "type": "video",
      "url": "https://static.fastpix.com/fp-sample-video.mp4"
    ]
  ],
  "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")! 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()
```