> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://next.developer.frame.io/platform/v2/api-reference/assets/create-asset/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://next.developer.frame.io/_mcp/server. # Create an Asset POST https://api.frame.io/v2/assets/{asset_id}/children Content-Type: application/json Create a new asset. Reference: https://next.developer.frame.io/platform/v2/api-reference/assets/create-asset ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `asset_id` (string, required) ### Body (application/json) This endpoint expects an object. - `type` (enum, required) — Must be `file` if `is_realtime_upload` is `true`. - Allowed values: `file`, `folder` - `name` (string, optional) — The name the asset should have in Frame.io. This value does not have to match the name of the file on disk; it can be whatever you want it to be in Frame.io. Required if `is_realtime_upload` is `false`. If `is_realtime_upload` is `true`, must containa valid extension in the form of `".[ext]"`, unless `extension` is provided, in which case this field may be `null` or omitted. - `extension` (string, optional) — Required when `is_realtime_upload` is `true`, when `name` is not known at time of asset creation. If `name` is provided, must match extension of that value. Ignored when `is_realtime_upload` is `false`. When supplied, asset will be creted with `name` value of `"[new file].extension"`. - `filetype` (string, optional) — MIME type like `video/quicktime`. Many languages have built in utilities for detecting file mimetype (see Go and Python for examples). Required if `is_realtime_upload` is `true`. - `is_realtime_upload` (boolean, optional, default: false) — If `true`, File data for this asset is to be uploaded through the Real-time Uploads API. If `false`, File data for this asset will be uploaded through the default API. Must be `false` if `filetype` is not `file`. - `description` (string, optional) — Brief description of the Asset - `filesize` (integer, optional) — File size in bytes. Required if `is_realtime_upload` is not `true`. - `properties` (V2AssetsAssetIdChildrenPostRequestBodyContentApplicationJsonSchema, optional) — Custom key-value data - `source` (AssetSource, optional) ## Response ### 200 Asset create success response. When `is_realtime_asset` was set to `true` in the request, a simplified payload will be returned. - `Assets_createAsset_Response_200` ## Errors ### 400 Bad Request Error Bad Request - `code` (integer, optional) - `errors` (list of HttpErrorErrorsItems, optional) - `message` (string, optional) ### 401 Unauthorized Error Unauthorized response - `code` (integer, optional) - `errors` (list of HttpErrorErrorsItems, optional) - `message` (string, optional) ### 404 Not Found Error Not Found response - `code` (integer, optional) - `errors` (list of HttpErrorErrorsItems, optional) - `message` (string, optional) ### 429 Too Many Requests Error Standard frame.io API error response. - `code` (integer, optional) - `errors` (list of HttpErrorErrorsItems, optional) - `message` (string, optional) ## Types ### V2AssetsAssetIdChildrenPostRequestBodyContentApplicationJsonSchema Custom key-value data ### AssetSource - `url` (string, optional) ### RealtimeAssetResponse - `id` (string, required) — The ID for this asset, can be used in places like `https://app.frame.io/player/:id` to go directly to an asset. - `name` (string, required) — Represents the name of the asset (filename). ### HttpErrorErrorsItems - `code` (integer, optional) - `detail` (string, optional) - `status` (integer, optional) - `title` (string, optional) ## Examples ### BasicAsset **Request** ```json { "type": "file", "name": "my_movie", "filetype": "video/mp4", "filesize": 80000000, "auto_version_id": "4386e276-6317-4d8d-b82c-8a16df9b66d2" } ``` **Response** ```json { "account_id": "string", "archive_from": "2024-01-15T09:30:00Z", "archive_scheduled_at": "2024-01-15T09:30:00Z", "archive_status": "string", "archived_at": "2024-01-15T09:30:00Z", "asset_type": "document", "bundle": true, "bundle_view": "string", "cover_asset_id": "string", "creator": { "_type": "string", "account_id": "string", "avatar_color": "string", "digest_frequency": "string", "email": "string", "first_login_at": "string", "from_adobe": true, "from_google": true, "highest_account_role": "string", "id": "string", "image_128": "string", "image_256": "string", "image_32": "string", "image_64": "string", "inserted_at": "string", "integrations": [ "string" ], "joined_via": "string", "last_seen": "string", "mfa_enforced_at": "string", "name": "string", "next_digest_date": "string", "profile_image": "string", "roles": { "admin": true, "id": "string", "sales": true, "service_desk": true, "support": true }, "timezone_value": "string", "updated_at": "string", "upload_url": "string", "user_default_color": "string", "user_hash": "string" }, "frames": 1, "hard_deleted_at": "2024-01-15T09:30:00Z", "id": "string", "index": 1.1, "is_bundle_child": true, "is_hls_required": true, "is_session_watermarked": true, "item_count": 1, "label": "string", "metadata": {}, "metadata_flags": { "id": "string", "is_360": true, "is_hdr": true, "is_original_player_compatible": true }, "name": "string", "original": "string", "parent_asset_id": "string", "project_id": "string", "properties": { "": "string" }, "required_transcodes": { "cover": true, "finalized": [ "thumb" ], "h264_1080_best": true, "h264_2160": true, "h264_360": true, "h264_540": true, "h264_720": true, "image_full": true, "image_high": true, "page_proxy": true, "thumb": true, "thumb_540": true, "thumb_orig_ar_540": true, "thumb_scrub": true }, "team_id": "string", "type": "file", "user_permissions": { "can_download": true, "can_modify_template": true, "can_public_share_presentation": true, "can_public_share_review_link": true, "can_share_downloadable_presentation": true, "can_share_downloadable_review_link": true, "can_share_unwatermarked_presentation": true, "can_share_unwatermarked_review_link": true }, "view_count": 1 } ``` **SDK Code** ```python sdk Python SDK from frameioclient import FrameioClient import os def main(): client = FrameioClient("TOKEN") filesize = os.path.getsize('demo.mov') asset = client.create_asset( parent_asset_id="PARENT_ASSET_ID", name="Test123.mov", type="file", filetype="video/quicktime", filesize=filesize ) file = open("demo.mov", "rb") client.upload(asset, file) if __name__ == "__main__": main() ``` ```python BasicAsset import requests url = "https://api.frame.io/v2/assets/asset_id/children" payload = { "type": "file", "name": "my_movie", "filetype": "video/mp4", "filesize": 80000000, "auto_version_id": "4386e276-6317-4d8d-b82c-8a16df9b66d2" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript BasicAsset const url = 'https://api.frame.io/v2/assets/asset_id/children'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"type":"file","name":"my_movie","filetype":"video/mp4","filesize":80000000,"auto_version_id":"4386e276-6317-4d8d-b82c-8a16df9b66d2"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go BasicAsset package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.frame.io/v2/assets/asset_id/children" payload := strings.NewReader("{\n \"type\": \"file\",\n \"name\": \"my_movie\",\n \"filetype\": \"video/mp4\",\n \"filesize\": 80000000,\n \"auto_version_id\": \"4386e276-6317-4d8d-b82c-8a16df9b66d2\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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 BasicAsset require 'uri' require 'net/http' url = URI("https://api.frame.io/v2/assets/asset_id/children") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"type\": \"file\",\n \"name\": \"my_movie\",\n \"filetype\": \"video/mp4\",\n \"filesize\": 80000000,\n \"auto_version_id\": \"4386e276-6317-4d8d-b82c-8a16df9b66d2\"\n}" response = http.request(request) puts response.read_body ``` ```java BasicAsset import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.frame.io/v2/assets/asset_id/children") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"type\": \"file\",\n \"name\": \"my_movie\",\n \"filetype\": \"video/mp4\",\n \"filesize\": 80000000,\n \"auto_version_id\": \"4386e276-6317-4d8d-b82c-8a16df9b66d2\"\n}") .asString(); ``` ```php BasicAsset request('POST', 'https://api.frame.io/v2/assets/asset_id/children', [ 'body' => '{ "type": "file", "name": "my_movie", "filetype": "video/mp4", "filesize": 80000000, "auto_version_id": "4386e276-6317-4d8d-b82c-8a16df9b66d2" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp BasicAsset using RestSharp; var client = new RestClient("https://api.frame.io/v2/assets/asset_id/children"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"type\": \"file\",\n \"name\": \"my_movie\",\n \"filetype\": \"video/mp4\",\n \"filesize\": 80000000,\n \"auto_version_id\": \"4386e276-6317-4d8d-b82c-8a16df9b66d2\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift BasicAsset import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "type": "file", "name": "my_movie", "filetype": "video/mp4", "filesize": 80000000, "auto_version_id": "4386e276-6317-4d8d-b82c-8a16df9b66d2" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.frame.io/v2/assets/asset_id/children")! 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() ``` ### RealtimeAsset **Request** ```json { "type": "file", "name": "my_video.mp4", "filetype": "video/mp4", "is_realtime_upload": true } ``` **Response** ```json { "account_id": "string", "archive_from": "2024-01-15T09:30:00Z", "archive_scheduled_at": "2024-01-15T09:30:00Z", "archive_status": "string", "archived_at": "2024-01-15T09:30:00Z", "asset_type": "document", "bundle": true, "bundle_view": "string", "cover_asset_id": "string", "creator": { "_type": "string", "account_id": "string", "avatar_color": "string", "digest_frequency": "string", "email": "string", "first_login_at": "string", "from_adobe": true, "from_google": true, "highest_account_role": "string", "id": "string", "image_128": "string", "image_256": "string", "image_32": "string", "image_64": "string", "inserted_at": "string", "integrations": [ "string" ], "joined_via": "string", "last_seen": "string", "mfa_enforced_at": "string", "name": "string", "next_digest_date": "string", "profile_image": "string", "roles": { "admin": true, "id": "string", "sales": true, "service_desk": true, "support": true }, "timezone_value": "string", "updated_at": "string", "upload_url": "string", "user_default_color": "string", "user_hash": "string" }, "frames": 1, "hard_deleted_at": "2024-01-15T09:30:00Z", "id": "string", "index": 1.1, "is_bundle_child": true, "is_hls_required": true, "is_session_watermarked": true, "item_count": 1, "label": "string", "metadata": {}, "metadata_flags": { "id": "string", "is_360": true, "is_hdr": true, "is_original_player_compatible": true }, "name": "string", "original": "string", "parent_asset_id": "string", "project_id": "string", "properties": { "": "string" }, "required_transcodes": { "cover": true, "finalized": [ "thumb" ], "h264_1080_best": true, "h264_2160": true, "h264_360": true, "h264_540": true, "h264_720": true, "image_full": true, "image_high": true, "page_proxy": true, "thumb": true, "thumb_540": true, "thumb_orig_ar_540": true, "thumb_scrub": true }, "team_id": "string", "type": "file", "user_permissions": { "can_download": true, "can_modify_template": true, "can_public_share_presentation": true, "can_public_share_review_link": true, "can_share_downloadable_presentation": true, "can_share_downloadable_review_link": true, "can_share_unwatermarked_presentation": true, "can_share_unwatermarked_review_link": true }, "view_count": 1 } ``` **SDK Code** ```python sdk Python SDK from frameioclient import FrameioClient import os def main(): client = FrameioClient("TOKEN") filesize = os.path.getsize('demo.mov') asset = client.create_asset( parent_asset_id="PARENT_ASSET_ID", name="Test123.mov", type="file", filetype="video/quicktime", filesize=filesize ) file = open("demo.mov", "rb") client.upload(asset, file) if __name__ == "__main__": main() ``` ```python RealtimeAsset import requests url = "https://api.frame.io/v2/assets/asset_id/children" payload = { "type": "file", "name": "my_video.mp4", "filetype": "video/mp4", "is_realtime_upload": True } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript RealtimeAsset const url = 'https://api.frame.io/v2/assets/asset_id/children'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"type":"file","name":"my_video.mp4","filetype":"video/mp4","is_realtime_upload":true}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go RealtimeAsset package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.frame.io/v2/assets/asset_id/children" payload := strings.NewReader("{\n \"type\": \"file\",\n \"name\": \"my_video.mp4\",\n \"filetype\": \"video/mp4\",\n \"is_realtime_upload\": true\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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 RealtimeAsset require 'uri' require 'net/http' url = URI("https://api.frame.io/v2/assets/asset_id/children") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"type\": \"file\",\n \"name\": \"my_video.mp4\",\n \"filetype\": \"video/mp4\",\n \"is_realtime_upload\": true\n}" response = http.request(request) puts response.read_body ``` ```java RealtimeAsset import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.frame.io/v2/assets/asset_id/children") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"type\": \"file\",\n \"name\": \"my_video.mp4\",\n \"filetype\": \"video/mp4\",\n \"is_realtime_upload\": true\n}") .asString(); ``` ```php RealtimeAsset request('POST', 'https://api.frame.io/v2/assets/asset_id/children', [ 'body' => '{ "type": "file", "name": "my_video.mp4", "filetype": "video/mp4", "is_realtime_upload": true }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp RealtimeAsset using RestSharp; var client = new RestClient("https://api.frame.io/v2/assets/asset_id/children"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"type\": \"file\",\n \"name\": \"my_video.mp4\",\n \"filetype\": \"video/mp4\",\n \"is_realtime_upload\": true\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift RealtimeAsset import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "type": "file", "name": "my_video.mp4", "filetype": "video/mp4", "is_realtime_upload": true ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.frame.io/v2/assets/asset_id/children")! 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() ``` ### RealtimeAsset_NameUnknown **Request** ```json { "type": "file", "extension": ".mp4", "filetype": "video/mp4", "is_realtime_upload": true } ``` **Response** ```json { "account_id": "string", "archive_from": "2024-01-15T09:30:00Z", "archive_scheduled_at": "2024-01-15T09:30:00Z", "archive_status": "string", "archived_at": "2024-01-15T09:30:00Z", "asset_type": "document", "bundle": true, "bundle_view": "string", "cover_asset_id": "string", "creator": { "_type": "string", "account_id": "string", "avatar_color": "string", "digest_frequency": "string", "email": "string", "first_login_at": "string", "from_adobe": true, "from_google": true, "highest_account_role": "string", "id": "string", "image_128": "string", "image_256": "string", "image_32": "string", "image_64": "string", "inserted_at": "string", "integrations": [ "string" ], "joined_via": "string", "last_seen": "string", "mfa_enforced_at": "string", "name": "string", "next_digest_date": "string", "profile_image": "string", "roles": { "admin": true, "id": "string", "sales": true, "service_desk": true, "support": true }, "timezone_value": "string", "updated_at": "string", "upload_url": "string", "user_default_color": "string", "user_hash": "string" }, "frames": 1, "hard_deleted_at": "2024-01-15T09:30:00Z", "id": "string", "index": 1.1, "is_bundle_child": true, "is_hls_required": true, "is_session_watermarked": true, "item_count": 1, "label": "string", "metadata": {}, "metadata_flags": { "id": "string", "is_360": true, "is_hdr": true, "is_original_player_compatible": true }, "name": "string", "original": "string", "parent_asset_id": "string", "project_id": "string", "properties": { "": "string" }, "required_transcodes": { "cover": true, "finalized": [ "thumb" ], "h264_1080_best": true, "h264_2160": true, "h264_360": true, "h264_540": true, "h264_720": true, "image_full": true, "image_high": true, "page_proxy": true, "thumb": true, "thumb_540": true, "thumb_orig_ar_540": true, "thumb_scrub": true }, "team_id": "string", "type": "file", "user_permissions": { "can_download": true, "can_modify_template": true, "can_public_share_presentation": true, "can_public_share_review_link": true, "can_share_downloadable_presentation": true, "can_share_downloadable_review_link": true, "can_share_unwatermarked_presentation": true, "can_share_unwatermarked_review_link": true }, "view_count": 1 } ``` **SDK Code** ```python sdk Python SDK from frameioclient import FrameioClient import os def main(): client = FrameioClient("TOKEN") filesize = os.path.getsize('demo.mov') asset = client.create_asset( parent_asset_id="PARENT_ASSET_ID", name="Test123.mov", type="file", filetype="video/quicktime", filesize=filesize ) file = open("demo.mov", "rb") client.upload(asset, file) if __name__ == "__main__": main() ``` ```python RealtimeAsset_NameUnknown import requests url = "https://api.frame.io/v2/assets/asset_id/children" payload = { "type": "file", "extension": ".mp4", "filetype": "video/mp4", "is_realtime_upload": True } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript RealtimeAsset_NameUnknown const url = 'https://api.frame.io/v2/assets/asset_id/children'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"type":"file","extension":".mp4","filetype":"video/mp4","is_realtime_upload":true}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go RealtimeAsset_NameUnknown package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.frame.io/v2/assets/asset_id/children" payload := strings.NewReader("{\n \"type\": \"file\",\n \"extension\": \".mp4\",\n \"filetype\": \"video/mp4\",\n \"is_realtime_upload\": true\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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 RealtimeAsset_NameUnknown require 'uri' require 'net/http' url = URI("https://api.frame.io/v2/assets/asset_id/children") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"type\": \"file\",\n \"extension\": \".mp4\",\n \"filetype\": \"video/mp4\",\n \"is_realtime_upload\": true\n}" response = http.request(request) puts response.read_body ``` ```java RealtimeAsset_NameUnknown import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.frame.io/v2/assets/asset_id/children") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"type\": \"file\",\n \"extension\": \".mp4\",\n \"filetype\": \"video/mp4\",\n \"is_realtime_upload\": true\n}") .asString(); ``` ```php RealtimeAsset_NameUnknown request('POST', 'https://api.frame.io/v2/assets/asset_id/children', [ 'body' => '{ "type": "file", "extension": ".mp4", "filetype": "video/mp4", "is_realtime_upload": true }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp RealtimeAsset_NameUnknown using RestSharp; var client = new RestClient("https://api.frame.io/v2/assets/asset_id/children"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"type\": \"file\",\n \"extension\": \".mp4\",\n \"filetype\": \"video/mp4\",\n \"is_realtime_upload\": true\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift RealtimeAsset_NameUnknown import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "type": "file", "extension": ".mp4", "filetype": "video/mp4", "is_realtime_upload": true ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.frame.io/v2/assets/asset_id/children")! 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() ```