Videos

Upload with an upload token

When given a token, anyone can upload a file to the URI https://ws.api.video/upload?token=<tokenId>.

Example with cURL:

$ curl  --request POST --url 'https://ws.api.video/upload?token=toXXX'
 --header 'content-type: multipart/form-data'
 -F file=@video.mp4

Or in an HTML form, with a little JavaScript to convert the form into JSON:

<!--form for user interaction-->
<form name="videoUploadForm" >
  <label for=video>Video:</label>
  <input type=file name=source/><br/>
  <input value="Submit" type="submit">
</form>
<div></div>
<!--JS takes the form data 
    uses FormData to turn the response into JSON.
    then uses POST to upload the video file.
    Update the token parameter in the url to your upload token.
    -->
<script>
   var form = document.forms.namedItem("videoUploadForm");	
   form.addEventListener('submit', function(ev) {
	 ev.preventDefault();
     var oOutput = document.querySelector("div"),
         oData = new FormData(form);
     var oReq = new XMLHttpRequest();
	 
     oReq.open("POST", "https://ws.api.video/upload?token=toXXX", true);
     oReq.send(oData);
	 oReq.onload = function(oEvent) {
       if (oReq.status ==201) {
         oOutput.innerHTML = "Your video is uploaded!<br/>"  + oReq.response;
       } else {
         oOutput.innerHTML = "Error " + oReq.status + " occurred when trying to upload your file.<br \/>";
       }
     };
   }, false);	
</script>

Dealing with large files

You can upload large files on api.video with <a href='https://docs.api.video/reference/post_videos-videoid-source'>Progressive Upload</a>. Alternatively, if you want to use regular upload, we have created a <a href='https://api.video/blog/tutorials/uploading-large-files-with-javascript'>tutorial</a> to walk through the steps required.

post/upload

Query parameters

tokenstring required

The unique identifier for the token you want to use to upload a video.

Headers

Content-Rangestring

Content-Range represents the range of bytes that will be returned as a result of the request. Byte ranges are inclusive, meaning that bytes 0-999 represents the first 1000 bytes in a file or object.

Response

Created

videoIdstring required

The unique identifier of the video object.

createdAtstring date-time

When a video was created, presented in ISO-8601 format.

titlestring

The title of the video content.

descriptionstring

A description for the video content.

publishedAtstring

The date and time the API created the video. Date and time are provided using ISO-8601 UTC format.

updatedAtstring date-time

The date and time the video was updated. Date and time are provided using ISO-8601 UTC format.

tagsstring[]

One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces.

playerIdstring

The id of the player that will be applied on the video.

publicboolean

Defines if the content is publicly reachable or if a unique token is needed for each play session. Default is true. Tutorials on private videos.

panoramicboolean

Defines if video is panoramic.

mp4Supportboolean

This lets you know whether mp4 is supported. If enabled, an mp4 URL will be provided in the response for the video.

Example response

{
  "videoId": "vi4k0jvEUuaTdRAEjQ4Jfrgz",
  "title": "Maths video",
  "description": "An amazing video explaining the string theory",
  "tags": [
    "maths",
    "string theory",
    "video"
  ],
  "metadata": [
    {
      "key": "Author",
      "value": "John Doe"
    },
    {
      "key": "Format",
      "value": "Tutorial"
    }
  ],
  "createdAt": "4251-03-03T12:52:03.085Z",
  "publishedAt": "4665-07-14T23:36:18.598Z",
  "actions": [
    "video_delete",
    "video_download",
    "video_update"
  ]
}

Changes