Log In

Upload video in two step

Tusd protocol to create the video and then upload the content

Please use this ONLY if you need to have a two step upload process, otherwise send the file directly in a single request (easier to implement). This way you can create a file draft and send the content of the file in the second request. This is useful if you need to build a frontend where users send files directly to us.

This should follow the tus protocol, which is a resumable protocol. This is useful because video files are very big and the possibility to retry or recover for network failure is a big advantage.

It's also possible to send parallel upload of multiple parts of the same file. In this case you must be connected to the same upload server (check hostname). Be careful to not send too many pieces at the same time (testing is required, it depends on your network throughput).

📘

Step 1

Create a video URL to upload content in the second step

Headers

Headers paramsTypeDescription
Tus-ResumableStringThe Tus-Resumable header MUST be included in every request and response with value 1.0.0
Upload-LengthNumberThe Upload-Length header indicates the size of the entire upload in bytes.
Upload-MetadataStringThe Upload-Metadata request and response header MUST consist of one or more comma-separated key-value pairs. The key and value MUST be separated by a space. The key MUST NOT contain spaces and commas and MUST NOT be empty.

The key SHOULD be ASCII encoded and the value MUST be Base64 encoded.

All keys MUST be unique. In these cases, the space, which would normally separate the key and the value, MAY be left out.

Possible values:

authorization (your api key, don't forget base64 encode all values)
folder_id (optional, only if you want to upload inside of the folder )
filename (file name)
video_id (uuid v4, optional)
curl -I --request POST 'https://uploader-us01.pandavideo.com.br/files' \
     --header 'Tus-Resumable: 1.0.0' \
     --header 'Upload-Length: 100 ' \
     --header 'Upload-Metadata: authorization cGFuZGEtYXBpX2tleQ==, filename bm9tZV90ZXN'
     
HTTP/1.1 201 Created
Location: https://uploader-us01.pandavideo.com.br/files/047486f42d874ba6a27a3e8c115e7db0
Tus-Resumable: 1.0.0
X-Content-Type-Options: nosniff
Date: Tue, 06 Dec 2022 14:25:54 GMT
Content-Length: 0

📘

Step 2

Send the video content in the URL received in the header of the first step

Headers

Headers paramsTypeDescription
Upload-OffsetNumberThe Upload-Offset header MUST be included in the request. The value 0 indicates that the entire content will be uploaded, if you are going to do it in parallel by sending pieces of the file, follow the documentation: https://tus.io/protocols/resumable-upload.html
Tus-ResumableStringThe Tus-Resumable header MUST be included in every request and response with value 1.0.0
Content-TypeStringapplication/offset+octet-stream
curl --request PATCH \
     --url https://uploader-us01.pandavideo.com.br/files/047486f42d874ba6a27a3e8c115e7db0 \
     --header 'Upload-Offset: 0' \
     --header 'Content-Type: application/offset+octet-stream' \
     --header 'Tus-Resumable: 1.0.0' \
     --data-binary '@teste.mp4'
     
 HTTP/1.1 204 No Content

Usage example available in our github

📘

Uploader URL

You must notify the endpoint URL here is different from the other ones. This is because you're interacting with the upload server. It's important to notice this because we have many servers across the globe. The list Uploader Servers must be verified.