Regular video upload
api.video provides different ways to upload your videos. There are two ways to upload with tokens, and then there are two ways to upload depending on whether your video is over 200MiB or under. This guide walks through how to do regular video upload for a video under 200MiB in size.
Check out the guide on Progressive upload to understand how to upload videos larger than 200MiB in size.
Megabyte (MB) and Mebibyte (MiB) are both used to measure units of information on computer storage. 1 MB is 1000Kb (kilobytes), and 1 MiB is 1048.576Kb. api.video uses MiB.
API documentation
Video upload overview
This section gives you an overview of your upload options. This guide walks through regular uploads but describes all the available choices here.
If you want to learn about delegated uploads, which are useful for creating private videos, or allowing your viewers to upload content themselves, or even just making it easier for you to do uploads, check out the Delegated upload tokens guide.
The two token-based upload methods are:
- Regular upload - you use an access token you retrieved when you authenticate to do a two-step process where you create a video object with metadata, retrieve the video ID, and use that to upload your video into the object.
- Delegated upload - you create a token and use the token to upload your video in one step. You can change the metadata later on.
There are two types of upload depending on whether your video is over 200MiB or under. You can use either a regular or delegated upload for a video under 200MiB. If your video is over 200MiB, you can do a progressive upload, where you break a video into chunks and then upload the pieces using parts in the header. You can also use bytes in the header, which is a bit more complicated. If you use one of the clients, big uploads are handled for you using the bytes method. You can also use the progressive upload method if you wish, though the steps require a bit more effort.
Create an account
Before you can start uploading your first video, you need to create an api.video account.
Once you are logged in to the Dashboard, select the environment of your choice (sandbox or production) and copy your API key.
Choose an API client
The clients offered by api.video include:
Install
To install your selected client, do the following:
Upload a video file
Create the video object
The first step to uploading a video is to create a video object. Once you create the object, you can use it to upload a video. Here is the basic minimal code to create the object:
Replace your_api_key
by the key you have already copied from dashboard.api.video
The response to your API request will return the following, along with other params:
Remember the videoId
: you will need it to upload your video, in the next step. Also, save the value of assets.player
for video playback.
If you are using one of our API clients, you will find the above information in the returned response's Video
object.
Upload your file into the video object
In the first step, you created the video object. Next, you need to upload the video file into the video object using this API request:
API response
Watch and share your video
The easiest way to play your video is to use the api.video player URL that you received in the API response:
"player": "https://embed.api.video/vod/{videoId}"
To watch your video, just paste the link into your favorite browser. Use the same link to share your video.
Conclusion
If you're just getting started, this two-part upload process is ideal for you. If you choose to use one of our clients, handling large files is done for you by the client. If you want to try a progressive upload, these are best when you're working with huge files and you want to send the parts of them concurrently.
Resources
Check out api.video's blog content on video upload:
-
Video upload with cURL - cURL
-
Upload many files at once with HTML and JavaScript - JavaScript Upload many files at once using an HTML form and JavaScript without the api.video client.
-
Upload a video with Laravel - PHP Create a form that uploads a video to api.video using Laravel.
-
Upload a video with the api.video PHP client - PHP A tutorial about how to upload a video with the PHP API client, this will work for large or small files and uses the Content-Range header method.
-
Progressively upload large video files without compromising speed - Python A tutorial that walks you through using progressive uploads without using an API client.
-
Upload a big video file using Python - Python Learn how to break a large video file into chunks and upload each chunk using Python.
-
Upload a video from your computer with the api.video API - Python Upload a video from your computer using Python.
-
Upload a video to api.video using a public URL - Python Learn how to upload a video from a public mp4 link.
-
Upload a video with the api.video Python Client - Python Upload a video of any size using api.video's Python client.
-
Use Flask with Dropzone.js to upload videos under 200 MiB (no client) - Python Learn how to do an upload for files under 200 MiB without using an api.video client.
Was this page helpful?