Skip to main content

Direct Video Upload

  • An upload session provides a secure, direct-to-storage mechanism for uploading video files from your server to TP Streams. This method allows you to generate a temporary upload link and credentials to securely upload your videos.

1. Create an Upload Session​

To create an upload session, send an HTTP POST request to the API Endpoint, with the authentication Header.

https://app.tpstreams.com/api/v1/<organization_id>/assets/upload-sessions/

Fields

NameTypeDescriptionRequired
content_protection_typestringTo ensure the security of your video content, you can choose from available protection types: 'drm', 'aes' encryption, or indicate 'disable' for no specific protection. Each option offers varying levels of security for your content.No
titlestringSpecify a text string or identifier which can be used for filtering or searching the asset.Yes
resolutionsarrayRequired resolutions of the transformed asset in case of HLS or MPEG-DASH delivery format. Must be an array of strings containing any of the following values: 240p, 360p, 480p, 540p, 720p, and 1080p. Re-sized rendition will retain the input aspect ratio.Yes
folderstringThe UUID of the folder, if you want to upload the video into that specific folderNo
generate_subtitlebooleanEnable automatic generation of subtitles for the video after upload. Defaults to false if not specified.No

Sample request body

{
"title": "Big Buck Bunny Video",
"resolutions": ["240p", "360p", "480p", "720p"],
"content_protection_type": "drm",
"folder": "32seYYHeNxE",
"generate_subtitle": true
}

For valid requests the API server returns a JSON response containing the asset information, session details, and a client_payload object:

{
"asset": {
"id": "9328558d-e0a5-4093-b3b9-8f15ad1550d8",
"title": "Big Buck Bunny Video",
"bytes": null,
"type": "video",
"parent_id": "32seYYHeNxE",
"video": {
"status": "Not Started"
}
},
"upload_session": {
"uuid": "e98df89a-1122-4a01-9876-1234abcd5678",
"max_file_size_bytes": 5368709120,
"expires_at": "2026-07-21T18:03:16.000000Z",
"status": "Created"
},
"client_payload": {
"upload_link": "https://s3.amazonaws.com/tpstreams-bucket",
"key": "private/server-uploads/9328558d-e0a5-4093-b3b9-8f15ad1550d8",
"x-amz-algorithm": "AWS4-HMAC-SHA256",
"x-amz-credential": "AKIAIOSFODNN7EXAMPLE/20260721/us-east-1/s3/aws4_request",
"x-amz-date": "20260721T000000Z",
"policy": "eyJleHBpcmF0aW9uIjoiMjAy...",
"x-amz-signature": "vSdt2134k..."
}
}

2. Upload the Video File​

Using the client_payload from the previous step, upload your video via a multipart form-data POST request to the upload_link.

Include all client_payload fields in your request, and ensure the actual video file is added last.

important

The file parameter must be the last field in your multipart request.

Complete Example:

# 1. Create the Upload Session
curl -X POST https://app.tpstreams.com/api/v1/<organization_id>/assets/upload-sessions/ \
-H "Authorization: token <your_token>" \
-H "Content-Type: application/json" \
-d '{"title": "Big Buck Bunny Video", "resolutions": ["240p", "720p"]}'

# 2. Extract the payload from the response above and upload the file
curl -X POST https://s3.amazonaws.com/tpstreams-bucket \
-F "key=private/server-uploads/9328558d-e0a5-4093-b3b9-8f15ad1550d8" \
-F "x-amz-algorithm=AWS4-HMAC-SHA256" \
-F "x-amz-credential=AKIAIOSFODNN7EXAMPLE/20260721/us-east-1/s3/aws4_request" \
-F "x-amz-date=20260721T000000Z" \
-F "policy=eyJleHBpcmF0aW9uIjoiMjAy..." \
-F "x-amz-signature=vSdt2134k..." \
-F "file=@/path/to/your/video.mp4"