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

# Create an asset

POST https://api.twelvelabs.io/v1.3/assets
Content-Type: multipart/form-data

This method creates an asset by uploading a file to the platform. Assets are reusable files that you can use in different workflows.

The platform processes uploads asynchronously. This method returns immediately with the asset in the `processing` status, which then transitions to the `ready` status on success or to the `failed` status when the file is invalid, corrupt, or unreadable. Poll the [Retrieve an asset](/v1.3/api-reference/upload-content/direct-uploads/retrieve) endpoint until the status of the asset is `ready` before you use it. This applies to every upload, including small files.

**Supported content**:

* Video, audio, and images.
* PDF, text, and Markdown files.

Filename extension matching is case-insensitive; for example, `notes.MD` and `notes.md` are treated the same. The platform rejects unsupported formats. For documents, it also rejects files whose extensions don't match the detected content.

**Upload methods**:

* **Local file**: Set the `method` parameter to `direct` and use the `file` parameter to specify the file.
* **Publicly accessible URL**: Set the `method` parameter to `url` and use the `url` parameter to specify the URL of your file.

**Upload limits**:

* **Video and audio, local files**: Up to 200 MB
* **Video and audio, public URLs**: Up to 4 GB
* **Images**: Up to 32 MB
* **Documents, local files**: Up to 200 MB
* **Documents, public URLs**: Up to 512 MB

Asset creation does not enforce a maximum duration for video and audio files. Each model applies its own file size and duration limits. For details, see the requirements below.

**Additional requirements** depend on your workflow:

* **Search**: [Marengo requirements](/v1.3/docs/concepts/models/marengo/marengo-3-0#video-file-requirements)
* **Video analysis**: [Pegasus requirements](/v1.3/docs/concepts/models/pegasus#input-requirements)
* **Entity search**: [Marengo image requirements](/v1.3/docs/concepts/models/marengo/marengo-3-0#image-file-requirements)
* **Create embeddings**: [Marengo requirements](/v1.3/docs/concepts/models/marengo/marengo-3-5#input-requirements)

This endpoint is rate-limited. For details, see the [Rate limits](/v1.3/docs/get-started/rate-limits) page.

Reference: https://docs.twelvelabs.io/api-reference/upload-files/direct-uploads/create

## Authentication

- `x-api-key` header (required) — Your API key. You can find your API key on the API Keys page.

## Request

### Body (multipart/form-data)

This endpoint expects a multipart form containing an optional file.

- `method` (enum, required) — Specifies the upload method for the asset. Use `direct` to upload a local file or `url` for a publicly accessible URL.
- `file` (file, optional) — Specify this parameter to upload a file from your local file system. This parameter is required when `method` is set to `direct`. Local video, audio, and documents support up to 200 MB. Images support up to 32 MB.
- `url` (string, optional) — Specify this parameter to upload a file from a publicly accessible URL. This parameter is required when `method` is set to `url`. Public video and audio URLs support up to 4 GB. Image URLs support up to 32 MB. Document URLs support up to 512 MB. The parameter also accepts the URL of an HLS manifest (`.m3u8`) in VOD format. Live video streams are rejected with a `400` error. If the duration cannot be determined from the media, the platform calculates it from the manifest.
- `filename` (string, optional) — The filename of the asset. If you provide a filename, the platform preserves it. If you omit it, the platform determines one from the file or URL.
- `enable_hls` (boolean, optional) — The platform generates an HLS playlist and segments for streaming. Set to `false` to disable HLS generation. Applicable to video and audio assets only. The platform ignores this flag for other asset types. **Default**: `true`.
- `enable_thumbnail` (boolean, optional) — The platform generates thumbnail images from the uploaded content. Set to `false` to disable thumbnail generation. For PDF files, the platform generates a representative thumbnail from the first page. Text and Markdown files do not produce thumbnails; the platform ignores this flag for them. **Default**: `true`.
- `user_metadata` (string, optional) — Metadata that helps you categorize your assets. You can specify a list of keys and values. Keys are strings, and values can be a string, a number, a boolean, or an array of strings. Send an integer wider than 53 bits (-9007199254740991 to 9007199254740991), and any identifier you want preserved verbatim, as a string. Send this value as a JSON-encoded string.

## Response

### 201

The asset has been successfully created.

- `_id` (string, optional) — The unique identifier of the asset.
- `method` (enum, optional) — Indicates how the asset was uploaded or imported. **Values**: - `direct`: Uploaded from your local file system - `url`: Uploaded from a publicly accessible URL - `multipart`: Uploaded using the multipart upload flow - `connector`: Imported through a data connector
  - Allowed values: `direct`, `url`, `multipart`, `connector`
- `status` (enum, optional) — Indicates the current processing status of the asset. A newly uploaded asset starts in the `processing` status and transitions asynchronously to `ready` on success or to `failed` on error, typically within a few seconds to a few minutes. Poll the [Retrieve an asset](/v1.3/api-reference/upload-content/direct-uploads/retrieve) endpoint until the status is `ready` before you use the asset in different workflows. **Values**: - `processing`: The asset is not yet usable. This can mean the upload is still in progress (for example, the platform is still fetching the file from a URL, or a multipart upload has not completed), or the upload has finished and the platform is validating the file. The `technical_metadata` field is omitted from the response. - `ready`: The platform validated the asset successfully, and the asset is ready to use. - `failed`: The platform could not process the file. The `error` field describes the reason, and the `technical_metadata` field may be partially populated.
  - Allowed values: `failed`, `processing`, `ready`
- `filename` (string, optional) — The name of the file used to create the asset.
- `file_type` (string, optional) — The MIME type of the asset file. For documents, this is `application/pdf`, `text/plain`, or `text/markdown`.
- `created_at` (string, optional) — The date and time, in RFC 3339 format ("YYYY-MM-DDTHH:mm:ssZ"), when the asset was created.
- `user_metadata` (map from string to UserMetadataValue, optional) — User-defined metadata for this asset. This field is absent when no metadata has been set.
- `source` (AssetSource, optional) — Describes where the asset came from. Present only for assets imported through a connector; absent for assets uploaded directly to the `/assets` endpoint.

## Errors

### 400 Bad Request Error

The request has failed.

- `code` (string, optional) — A string representing the code associated with the error. See the [Error codes](/v1.3/api-reference/error-codes) page for details.
- `message` (string, optional) — A human-readable string describing the error, intended to be suitable for display in a user interface.

## Types

### UserMetadataValue

A single metadata value: a string, a number, a boolean, or an array of strings. The platform stores the value with the type you send. It rejects a nested object and an array that contains anything but strings. Send an integer wider than 53 bits (-9007199254740991 to 9007199254740991) and any identifier you want preserved verbatim as a string.

### AssetSource

Describes where an asset came from. The platform sets this field for assets imported through a connector; it is absent for assets uploaded directly to the `/assets` endpoint.

- `type` (enum, optional) — The kind of source.
  - Allowed values: `connector`
- `details` (AssetSourceDetails, optional) — Provider-specific details about the origin of the file. The fields depend on the value of the `type` field.

### AssetSourceDetails

Provider-specific details about the origin of the file. The fields depend on the value of the `type` field.

- `provider` (enum, optional) — The data connector provider.
  - Allowed values: `google_drive`
- `source_id` (string, optional) — The identifier of the file at the provider. For Google Drive, this is the identifier Google Drive assigns to the file.
- `original_filename` (string, optional) — The name of the file at the provider when it was imported.
- `source_link` (string, optional) — A link to the file at the provider.

## Examples

### Video file

**Request**

```json
{
  "method": "direct",
  "file": "<file: <file1>>"
}
```

**Response**

```json
{
  "_id": "6298d673f1090f1100476d4c",
  "method": "direct",
  "status": "processing",
  "filename": "my-video.mp4",
  "file_type": "video/mp4",
  "created_at": "2022-06-02T10:30:00Z"
}
```

**SDK Code**

```python Video file
import requests

url = "https://api.twelvelabs.io/v1.3/assets"

files = { "file": "open('<file1>', 'rb')" }
payload = {
    "method": "direct",
    "url": ,
    "filename": ,
    "enable_hls": ,
    "enable_thumbnail": ,
    "user_metadata": 
}
headers = {"x-api-key": "<apiKey>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.json())
```

```javascript Video file
const url = 'https://api.twelvelabs.io/v1.3/assets';
const form = new FormData();
form.append('method', 'direct');
form.append('file', '<file1>');
form.append('url', '');
form.append('filename', '');
form.append('enable_hls', '');
form.append('enable_thumbnail', '');
form.append('user_metadata', '');

const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

options.body = form;

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

```go Video file
package main

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

func main() {

	url := "https://api.twelvelabs.io/v1.3/assets"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"method\"\r\n\r\ndirect\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_hls\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_thumbnail\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_metadata\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")

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

	req.Header.Add("x-api-key", "<apiKey>")

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

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

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

}
```

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

url = URI("https://api.twelvelabs.io/v1.3/assets")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"method\"\r\n\r\ndirect\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_hls\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_thumbnail\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_metadata\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"

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

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

HttpResponse<String> response = Unirest.post("https://api.twelvelabs.io/v1.3/assets")
  .header("x-api-key", "<apiKey>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"method\"\r\n\r\ndirect\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_hls\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_thumbnail\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_metadata\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.twelvelabs.io/v1.3/assets', [
  'multipart' => [
    [
        'name' => 'method',
        'contents' => 'direct'
    ],
    [
        'name' => 'file',
        'filename' => '<file1>',
        'contents' => null
    ]
  ]
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Video file
using RestSharp;

var client = new RestClient("https://api.twelvelabs.io/v1.3/assets");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"method\"\r\n\r\ndirect\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_hls\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_thumbnail\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_metadata\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Video file
import Foundation

let headers = ["x-api-key": "<apiKey>"]
let parameters = [
  [
    "name": "method",
    "value": "direct"
  ],
  [
    "name": "file",
    "fileName": "<file1>"
  ],
  [
    "name": "url",
    "value": 
  ],
  [
    "name": "filename",
    "value": 
  ],
  [
    "name": "enable_hls",
    "value": 
  ],
  [
    "name": "enable_thumbnail",
    "value": 
  ],
  [
    "name": "user_metadata",
    "value": 
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/assets")! 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()
```

### PDF file

**Request**

```json
{
  "method": "direct",
  "file": "<file: <file1>>"
}
```

**Response**

```json
{
  "_id": "6298d673f1090f1100476d4e",
  "method": "direct",
  "status": "processing",
  "filename": "report.pdf",
  "file_type": "application/pdf",
  "created_at": "2026-08-12T10:30:00Z"
}
```

**SDK Code**

```python PDF file
import requests

url = "https://api.twelvelabs.io/v1.3/assets"

files = { "file": "open('<file1>', 'rb')" }
payload = {
    "method": "direct",
    "url": ,
    "filename": ,
    "enable_hls": ,
    "enable_thumbnail": ,
    "user_metadata": 
}
headers = {"x-api-key": "<apiKey>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.json())
```

```javascript PDF file
const url = 'https://api.twelvelabs.io/v1.3/assets';
const form = new FormData();
form.append('method', 'direct');
form.append('file', '<file1>');
form.append('url', '');
form.append('filename', '');
form.append('enable_hls', '');
form.append('enable_thumbnail', '');
form.append('user_metadata', '');

const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

options.body = form;

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

```go PDF file
package main

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

func main() {

	url := "https://api.twelvelabs.io/v1.3/assets"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"method\"\r\n\r\ndirect\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_hls\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_thumbnail\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_metadata\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")

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

	req.Header.Add("x-api-key", "<apiKey>")

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

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

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

}
```

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

url = URI("https://api.twelvelabs.io/v1.3/assets")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"method\"\r\n\r\ndirect\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_hls\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_thumbnail\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_metadata\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"

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

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

HttpResponse<String> response = Unirest.post("https://api.twelvelabs.io/v1.3/assets")
  .header("x-api-key", "<apiKey>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"method\"\r\n\r\ndirect\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_hls\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_thumbnail\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_metadata\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.twelvelabs.io/v1.3/assets', [
  'multipart' => [
    [
        'name' => 'method',
        'contents' => 'direct'
    ],
    [
        'name' => 'file',
        'filename' => '<file1>',
        'contents' => null
    ]
  ]
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp PDF file
using RestSharp;

var client = new RestClient("https://api.twelvelabs.io/v1.3/assets");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"method\"\r\n\r\ndirect\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"filename\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_hls\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"enable_thumbnail\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_metadata\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift PDF file
import Foundation

let headers = ["x-api-key": "<apiKey>"]
let parameters = [
  [
    "name": "method",
    "value": "direct"
  ],
  [
    "name": "file",
    "fileName": "<file1>"
  ],
  [
    "name": "url",
    "value": 
  ],
  [
    "name": "filename",
    "value": 
  ],
  [
    "name": "enable_hls",
    "value": 
  ],
  [
    "name": "enable_thumbnail",
    "value": 
  ],
  [
    "name": "user_metadata",
    "value": 
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.twelvelabs.io/v1.3/assets")! 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()
```