Skip to main content

Upload new captions file for a video

Request​

  • Method: POST
  • URL: https://dev.vdocipher.com/api/videos/{videoId}/files/
  • Content-type: multipart/form-data
  • Input params:
typenamedescription
querylanguageISO 639-1 representation of the language
http-formfilevtt file packaged as a multipart-formdata
const fs = require('fs');
const rp = require('request-promise-native');

// replace with your values
const videoId = '_______';
const filePath = './path/to/file.vtt';

const authHeader = {
authorization: `Apisecret ${process.env.apisecret}`,
};

const uploadSubtitle = (videoId, filePath, language) => {
return rp({
url: `https://dev.vdocipher.com/api/videos/${videoId}/files/`,
method: 'POST',
qs: {language: language},
headers: {
'Content-type': 'multipart/form-data',
...authHeader,
},
formData: {
file: {
value: fs.createReadStream(filePath),
options: {},
},
},
json: true,
});
};

uploadSubtitle(videoId, filePath, 'en')
.then(console.log)
.catch((e) => {
if (!e.statusCode) {
throw e;
}
console.error(e.message);
});

Response​

Success​

Content-type: application/json

keytypedescription
idintegerunique id of this uploaded file
timestringISO8601 representation of upload time in UTC
sizestringhuman readable format of size
langstringISO-639-1 representation of language
{
"id": 12090067,
"time": "2021-04-04T09:06:26.925Z",
"size": "5 kB",
"lang": "en"
}