Single File Upload

Single file upload is slower than multipart file upload and also limited to 200MB.

To upload a file to a video object, on need 3 api calls:

  1. Iinitalize the upload to get a protected url (singedurl) where your are going to upload your video file,
  2. Upload the file (PUT) to this signedurl
  3. Finalize the upload by confirming the completion of the video file upload.
Video File Upload

Video File Upload

1 - Initialize

Initialize the upload to get the signed url: single file upload intialization.

curl -X GET '<<SBX_SERVER>>/videos/ZFJ3R0FYSlVTbDVYVG43aw%3D%3D/upload/init' \
-H 'x-api-key: <<SBX_DEMO_KEY>>'

This API returns a JSON with the upload URL where you need to perform a PUT request with the file:

{
  "signedUrl": "https://../ZFJ3R0FYSlVTbDVYVG43aw%3D%3D.mp4?AWSAccessKeyId=ASIAXDYZVN2LQAYI4GPY&Signature=Te6GEKAbiFgkE0fYcczbmV5oZsA%3D&x-amz-security-token=IQoJb3JpZ2....LwVEMip4UwMI6w%3D%3D&Expires=1687446752"
}

This URL is temporary and expires after 5 minutes.

2 - Upload your file

Upload your file to the signed url with a PUT request:

curl -X PUT -T "/path/to/thefile" "<signed url>"

❗️

PUT only the file to S3 URL signed, don't add header (ex : content-type)

API response code in case of success:
HTTP/1.1 200 OK

3 - Finalize

Once the upload is completed, you need to finalize the upload: single file upload finalization.

This step confirm the upload is completed and trigger the video ingestion (transcoding) flow:

curl -X PUT '<<SBX_SERVER>>/videos/ZFJ3R0FYSlVTbDVYVG43aw%3D%3D/upload/finalize' \
-H 'x-api-key: <<SBX_DEMO_KEY>>'

The file ingestion is not instantaneous. The API returns the following HTTP code upon success:
HTTP/1.1 202