Developers API


Uploading new file via our API is very easy. You simply have to send a valid POST request to the URL shown below. Please make sure you are sending the data as the UTF-8 charset!

https://webmshare.com/api/upload

Below is an example of how to upload a new file by using cURL:

curl -i -X POST \
-H "Content-Type:multipart/form-data" \
-F "file=@\"./some_file.webm\";type=video/webm;filename=\"some_file.webm\"" \
-F "expiration=1" \
-F "public=0" \
-F "title=Some title goes here ;)" \
-F "autoplay=1" \
-F "loop=1" \
-F "muted=1" \
'https://webmshare.com/api/upload'

Required parameters

"file" //path to file 10mb max, valid webm or gif.
"expiration" //Integer from 0 to 180 representing days till auto deletion. 0 represents infinity, such file will be deleted only if not opened for 2 months. 

Optional parameters

"title" //Text with max length of 255 characters.
"public" //Integer from 0 to 1. Boolean attribute to set the upload as public. 
"autoplay" //Integer from 0 to 1. Boolean attribute that starts playing the video automatically after the player has enough content buffered.
"loop" //Integer from 0 to 1. Boolean attribute that replays the video repeatedly until the pause button on the controls is pressed.
"muted" //Integer from 0 to 1. Boolean attribute that plays video with the audio track turned off. 

Successful API Response: (example)

{
"id": "g0mnb",
"deletion_id": "RJG7ozn5YP6X1vrDlEL91bjKg"
}

Possible Bad API Responses: (example)

Bad API request, reached the max upload quota (100 per IP) for 24h

Bad API request, invalid file

{
   "file":[
   "The file field is required."
   "The file must be a file of type: video/webm, image/gif."
   "The file may not be greater than 10240 kilobytes."
   ]

   "expiration":[
   "The expiration field is required."
   "The expiration must be an integer.",
   "The expiration must be between 0 and 180."
   ]

   "title":[
   "The title may not be greater than 255 characters."
   ]

   "public":[
   "The public must be an integer.",
   "The public must be between 0 and 1."
   ]

   "autoplay":[
   "The autoplay must be an integer.",
   "The autoplay must be between 0 and 1."
   ]

   "loop":[
   "The loop must be an integer.",
   "The loop must be between 0 and 1."
   ]

   "muted":[
   "The muted must be an integer.",
   "The muted must be between 0 and 1."
   ]
}

If you have questions, proposals or bug reports feel free to contact us.