Introduction
The WeVideo Embedded Editor API provides a solution for integrating a fully featured HTML5 video editor into your workflow. Combined with CSS customization, you can fully white-label the WeVideo editor for a variety of use cases that require online video editing. One example is prepopulating a user’s session with media and tasking them with a remix, in the case of a movie trailer contest. Another example could be taking user generated content and providing them with a powerful tool to create edits to the assets and have an edited video feed back into your system.
This API is intended for partners and customers who want to integrate the WeVideo editor as a part of the functionality on their site. To start developing with the WeVideo APIs please contact us and we will provide you with the necessary information to get started, which consists of:
- An API key and secret
- An instance ID
Your API keys are mapped to a WeVideo multi-user account, what we call an instance, and you will need the ID of this instance in a number of the supported API calls.
Authentication
Server to server
All server to server requests should be signed in one of two ways:
Basic
The easiest way to authenticate server to server API calls is to set the Authorization HTTP header like this:
Authorization: WEVSIMPLE YOUR API SECRET
This API key is provided to you when you have contacted a member of our API solutions team.
Advanced
/* Basic implementation of the request signing in Java using the Apache HTTP libraries */
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.DefaultHttpClient;
public class Main {
public static void main(String[] args) throws Exception {
String API_KEY = "xxxxxxxxxxxxxxxxxxxx";
String SECRET_KEY = "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY";
String url = "https://wevideo.com/api/3/media/84429933/folders";
/*
* Date format pattern used to parse HTTP date headers in RFC
* 1123format.
*/
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
String date = format.format(new Date());
HttpGet request = new HttpGet(url);
request.setHeader("Date", date);
signRequest(request, "", date, url, API_KEY, SECRET_KEY);
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpResponse res = httpClient.execute(request);
String result = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
System.out.println("Server responsed:\n" + result);
}
public static void signRequest(HttpRequestBase req, String body, String date, String path, String apiKey, String secretKey) throws Exception {
/* Build the string we should sign */
MessageDigest md = MessageDigest.getInstance("MD5");
String toSign = req.getMethod() + "\n" + new String(Hex.encodeHex(md.digest(body.getBytes()))) + "\n" + date + "\n" + path;
/* Now we can calculate our signature */
SecretKeySpec keySpec = new SecretKeySpec(secretKey.getBytes(), "HmacSHA256");
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(keySpec);
byte[] result = mac.doFinal(toSign.getBytes());
/* And finally set the header */
req.setHeader("Authorization", "WEV " + apiKey + ":" + new String(Base64.encodeBase64(result)));
}
}
#Basic implementation of the request signing in PHP
<?php
/*
* This function does the signing of http request, required parameters are
* @param method - denotes http method e.g. GET,POST,PUT,DELETE etc.
* @param url -denotes the end point url you want to hit
* @param email - Will be used as data
* @appId - App key Provided by weVideo
* @secret - Secret Key Provided by weVideo
* */
function signRequest($method,$url, $email,$appId,$secret) {
$data = array("email" => $email);
$str_data = json_encode($data);
$date = date("D, d M Y H:i:s T"); //Wed, 16 Jul 2014 16:50:40 MDT
echo $date."<br>";
$stringToSign = $method."\n".md5($str_data)."\n".$date."\n".$url;
$signature = base64_encode(hash_hmac('sha256', $stringToSign,$secret,true));
$authorization = "WEV"." ".$appId.":".$signature;
echo $authorization;
$options = array(
'http' => array(
'method' => $method,
'content' => json_encode( $data ),
'header'=> "Authorization: ".$authorization."\r\n".
"Date: ".$date."\r\n".
"Content-Type: application/json\r\n" .
"Accept: application/json\r\n"
)
);
$context = stream_context_create( $options );
$result = file_get_contents( $url, false, $context );
echo "<br>";
$response = json_decode( $result );
echo "<pre>";
$response = get_object_vars($response);
print_r( $response);
echo "</pre>";
}
?>
public class Program
{
public static void Main()
{
// Your keys and API endpoint
string API_KEY = "";
string SECRET_KEY = "";
string url = "";
// Want to log in with the user something@mydomain.com
var data = "{}";
// Create the string we have to sign
var date = DateTime.Now;
var hash = System.Security.Cryptography.MD5CryptoServiceProvider.Create().ComputeHash(System.Text.Encoding.UTF8.GetBytes(data));
var hex = BitConverter.ToString(hash).Replace("-", "").ToLower();
var toSign = "POST\n" + hex + "\n" + date.ToString("R") + "\n" + url; //date - RFC1123 -> Wed, 16 Jul 2014 16:50:40 MDT
// Create the hash
var hmacsha256 = new System.Security.Cryptography.HMACSHA256(System.Text.Encoding.UTF8.GetBytes(SECRET_KEY));
var sigbytes = hmacsha256.ComputeHash(System.Text.Encoding.UTF8.GetBytes(toSign));
var authheadval = System.Convert.ToBase64String(sigbytes);
// Make the call
var client = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url);
client.Headers.Add("Authorization", "WEV " + API_KEY + ":" + authheadval);
client.Date = date;
client.ContentType = "application/json";
client.Method = "POST";
// And read the response
var stream = client.GetRequestStream();
var stuff = System.Text.Encoding.UTF8.GetBytes(data);
stream.Write(stuff, 0, stuff.Length);
stream.Close();
var resp = client.GetResponse();
var stat = ((System.Net.HttpWebResponse)resp).StatusDescription;
var respStream = resp.GetResponseStream();
var reader = new System.IO.StreamReader(respStream);
string responseFromServer = reader.ReadToEnd();
Console.WriteLine(responseFromServer);
}
}
#Sample code for signing the request requires Python3 and requests modules
import base64
import datetime
import hashlib
import hmac
import json
import requests
# Basic prep
app_id = "<Your app id provided by WeVideo>"
secret = "<Your secret key provided by WeVideo>"
values = {"email": "<Your registered email with WeVideo>"}
method = "GET"
url = "https://www.wevideo.com/api/3/me"
date = datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S") + " UTC"
# Prepare the string which needs to be signed
# string_to_sign = Method + MD5-Content + Date(e.g. Fri, 30 Dec 2015 16:50:40 UTC) + Url
encoded_values = json.dumps(values).encode("utf-8")
string_to_sign = method + "\n" + (hashlib.md5(encoded_values).hexdigest()) + "\n" + date + "\n" + url
# Do signing and prepare headers
signature = base64.b64encode(hmac.new(str.encode(secret),
string_to_sign.encode("utf-8"), hashlib.sha256).digest())
authorization = "WEV" + " " + app_id + ":" + signature.decode("utf-8")
headers = {
"Date": date,
"Content-Type": "application/json",
"Authorization": authorization,
"Accept": "application/json"
}
# Make the request
response = requests.get(url, headers=headers, data=encoded_values)
print(response.content.decode("utf-8"))
A more complex, but also more secure, alternative is to use a HMAC based protocol to sign requests The Authorization HTTP header should be set based on your API key and a signature generated from your secret API key, the HTTP method, the request body (for GET requests this should be an empty string), the date and the full request path as described below.
StringToSign = HTTP-Verb + "\n" + Content-MD5 + "\n" + Date + "\n" + Full Request Path (including query parameters);
Signature = Base64( HMAC-SHA256( YourSecretKey, UTF-8-Encoding-Of(StringToSign)));
Authorization = "WEV" + " " + YourAPIKey + ":" + Signature;
Implementing Server-Server authentication will allow your server to make API calls as well as retrieve the necessary login token to allow a user to login.
API endpoints
Users
Creating a user
Example request
curl https://www.wevideo.com/api/3/users \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
-d '{
"firstName": "Jonathon",
"lastName": "Harrington",
"email": "jonathon.harrington@example.com"
}'
Response (200)
{
"firstName": "Jonathon",
"lastName": "Harrington",
"email": "jonathon.harrington@example.com",
"userId": 87280657
}
Response (400) in the case of a non unique email
{
"success": false,
"message": "A user already exists with the given e-mail",
"error_code": "bad_request"
}
Creates a new WeVideo user. The email has to be unique on the WeVideo platform.
HTTP REQUEST
POST https://www.wevideo.com/api/3/users
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
string | Yes | The email that will be tied to the connected WeVideo user | |
firstName | string | Optional | The first name of the created user. Defaults to an empty string |
lastName | string | Optional | The last name of the created user. Defaults to an empty string |
role | string | Optional | The role to grant the new user. user, lead or admin. Defaults to user |
instanceId | integer | Optional | The instance the user will be added to (only relevant if you have multiple instances) |
Modify a user
Example request
curl https://www.wevideo.com/api/3/users/2237766684 \
-X PUT \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
-d '{
"firstName": "Jonathan",
"lastName": "Harrington"
}'
Response (200)
{
"success": true
}
Modifies an existing WeVideo user.
HTTP REQUEST
PUT https://www.wevideo.com/api/3/users/<USER_ID>
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
string | Optional | Modify the user’s email | |
firstName | string | Optional | Modify the user’s first name |
lastName | string | Optional | Modify the user’s last name |
role | string | Optional | Updates the user’s role. user, lead or admin. Defaults to user |
Remove a user
Example request
curl https://www.wevideo.com/api/3/users/2237766684 \
-X DELETE \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"success": true
}
Removes a user from your instance.
HTTP REQUEST
DELETE https://www.wevideo.com/api/3/users/<USER_ID>
List all users
Example request
curl https://www.wevideo.com/api/3/instances/266/users?pageSize=1&page=1 \
-X GET \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"data": [ {
... user data ...
}],
"metadata": {
"noResults": 42,
"page": 1,
"pageSize": 1
}
}
Returns all the users in your instance. The result is paginated, and you can use the URL parameters page and pageSize to control the results. The returned object will contain a metadata field with the total number of results, the current page and the current pageSize
HTTP REQUEST
GET https://www.wevideo.com/api/3/instances/<INSTANCE_ID>/users
User content
You can list various content (timelines, exports and media files) belonging to a specific user by using the following calls:
GET https://www.wevideo.com/api/3/users/<USER_ID>/timelines
GET https://www.wevideo.com/api/3/users/<USER_ID>/exports
GET https://www.wevideo.com/api/3/users/<USER_ID>/media
The results are paginated, and you can use the URL parameters page and pageSize to control the results.
SSO
Getting a login token
Example request
curl https://www.wevideo.com/api/3/sso/auth \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
-d '{
"email": "jonathon.harrington@example.com"
}'
Response (200)
{
"loginToken": "9b4dc5f4-f36c-4a0d-b1eb-06dd58483c6b",
"userId": 87280657
}
This call generates a unique, one time use, login token that can be used to initiate a WeVideo session.
HTTP REQUEST
POST https://www.wevideo.com/api/3/sso/auth
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
string | Either email or userId | The email tied to the WeVideo user that should be logged in | |
userId | integer | Either email or userId | The WeVideo user ID that should be logged in |
Logging in
This should be called by the end user’s browser, with the token being the returned loginToken from /api/3/sso/auth.
If you call this through an AJAX request you need to set the withCredentials parameter to true. Using jquery that would look something like this:
$.ajax({
type : 'GET',
url : "https://www.wevideo.com/api/3/sso/login/9b4dc5f4-f36c-4a0d-b1eb-06dd58483c6b",
success : function() {
/* The user is now logged in to WeVideo */
},
xhrFields: { withCredentials: true }
});
HTTP REQUEST
GET https://www.wevideo.com/api/3/sso/login/<token>
Parameter | Type | Required | Description |
---|---|---|---|
target | string | Optional | Set to editor to redirect the request to the editor itself. |
Uploads
Through the API you can upload media files directly to any user account that is a member of any of your instances. There’s two main categories of uploads:
* File imports where you just import a file from a URL
* File uploads where you upload a file from a local disk.
File imports
Importing an image from a URL
curl https://www.wevideo.com/api/4/files/import \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
-d '{
"urls":[
"https://s3.amazonaws.com/wevideo-static/assets/apidemo/images/goldenGate.jpg"
]
}'
Response (200)
{
"success": true,
"tickets": ["2018_06_11_4b6ac080-7c07-4fbf-9e45-dfbb3e36d9af"]
}
If you have a publicly accessible URL to the file then this is the fastest and easiest way to get a file into your WeVideo account. The basic version of this call is just sending a list of URLs to import.
Importing an image from a URL with a custom file name
curl https://www.wevideo.com/api/4/files/import \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
-d '{
"urls":[
{
"url":"https://s3.amazonaws.com/wevideo-static/assets/apidemo/images/goldenGate.jpg",
"title":"My image"
}
]
}'
Response (200)
{
"success": true,
"tickets": ["2018_06_11_18dfd10f-7c07-4fbf-9e45-dfbb3e36d9af"]
}
By default WeVideo will attempt to parse the file title from the URL, but you also send custom title by replacing the URL string with an object that contains both url and title values.
HTTP REQUEST
POST https://www.wevideo.com/api/4/files/import
Parameter | Type | Required | Description |
---|---|---|---|
urls | array | yes | Either a list of strings (URLs) or a list of objects containing the fields title and url |
File uploads
File uploads are useful when you want to upload a file from a local hard drive.
Generating upload IDs
Getting upload IDs and URLs
curl https://www.wevideo.com/api/4/files/upload \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
-d '{"
fileData":[
{
"size":164672,
"title":"My image"
}
]
}'
Response (200)
{
"success": true,
"expires": 1529532714968,
"tickets": [ {
"id": "2018_06_20_f13bec90-3a9f-49ba-a428-5a2dd63dbf0a",
"url": "https://wevideo-uploads.s3.amazonaws.com/presignedupload/test/2018_06_20_f13bec90-3a9f-49ba-a428-5a2dd63dbf0a?AWSAccessKeyId=AKIAIOGIUU66MO6WWMRQ&Expires=1530094314&Signature=GLn15oLhSwxGUp6TVw%2B6IW00kOM%3D",
"size": 164672
}]
}
To upload a file you first need to make an API call to generate an upload ID and an upload URL for each file you want to upload. The call will return an array of tickets, one for each file you want to upload. Each ticket object will contain an id and a url parameter.
POST https://www.wevideo.com/api/4/files/upload
Parameter | Type | Required | Description |
---|---|---|---|
fileData | array | yes | A list of objects containing the fields size (required) and title (optional) |
Uploading the file
Uploading a file
curl -v --upload-file "/path/to/my/file/file.jpg" "https://wevideo-uploads.s3.amazonaws.com/presignedupload/test/2018_06_20_f13bec90-3a9f-49ba-a428-5a2dd63dbf0a?AWSAccessKeyId=AKIAIOGIUU66MO6WWMRQ&Expires=1530094314&Signature=GLn15oLhSwxGUp6TVw%2B6IW00kOM%3D"
To actually upload the file you should make a PUT request to the returned URL.
By default WeVideo will use the upload ID as the file name, but you can provide a title parameter for each file if you want to override this behavior.
File ownership and location
Example request with custom file name, userId and folderId
curl https://www.wevideo.com/api/4/files/import \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
-d '{
"urls":[
{
"url":"https://s3.amazonaws.com/wevideo-static/assets/apidemo/images/goldenGate.jpg",
"title":"My image"
}
],
"userId":88046112,
"folderId": 90076876
}'
Response (200)
{
"success": true,
"tickets": ["2018_06_11_264c0144-7c07-4fbf-9e45-dfbb3e36d9af"]
}
If no userId is provided the uploaded file will be mapped to the API user itself, which means that only the API user will be able to modify or delete the file on WeVideo. You can add a userId parameter to both the import and upload calls to set a different user as the file owner.
If no folderId is provided then the selected user’s root media folder will be used.
Getting the status of an importing file
Example request with custom file name, userId and folderId
curl https://www.wevideo.com/api/4/files/status/2018_06_21_8d64751e-62f2-40e4-8ace-8990d1fbf45d,2018_06_21_4e551252-2c15-422f-931d-a37327618a02\
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"2018_06_21_8d64751e-62f2-40e4-8ace-8990d1fbf45d":{
"status":"COMPLETED",
"fileId":90091642
},
"2018_06_21_4e551252-2c15-422f-931d-a37327618a02":{
"status":"TICKET_REGISTERED"
}
}
Every upload/import has to be preprocessed (metadata extraction, format conversions for certain file types) before it’s ready to be used in the app. You can get the status of this process by using the following API call:
GET https://www.wevideo.com/api/4/files/status/<ticketIds>
ticketIds can be one or multiple, comma separated, IDs. The call will return a JSON object with an entry for each ticket, with each entry having the following fields.
Field | Description |
---|---|
status | The status of the import. The relevant values are TICKET_REGISTERED (the file is not yet ready for processing), COMPLETED (the file has been successfully imported and is ready for use in the app) and FAILED (the file could not be imported). |
fileId | If the status is COMPLETED then a fileId field will be returned as well. This is the ID of the file itself in WeVideo. |
Pregenerated proxy files
Importing a video with a pregenerated proxy file
curl https://www.wevideo.com/api/4/files/import\
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"urls":[
{
url:"https://s3.amazonaws.com/wevideo-static/assets/apidemo/videos/frameCounter.mp4",
title:"Import through API with pregenerated proxy",
proxyUrl: "https://s3.amazonaws.com/wevideo-static/assets/apidemo/videos/frameCounterProxy.mp4"
}
]
}'
Response (200)
{
"success": true,
"tickets": ["2018_09_27_b9f4d7d6-563c-42e5-9a1c-08a13f26e4d9"]
}
When a video file is imported to WeVideo we first create a low resolution proxy file. This file is used for the timeline preview in the editor, while the original video file is used in the publishing process. Creating this proxy file is the most time consuming part of the video import process, so we also have an option to provide a pregenerated version of this file when importing a video file through the file import call by adding a proxyUrl property to each of the imported videos.
The proxy video should be an MP4 file with a relatively low bitrate and resolution. The proxy videos generated on our end are scaled down to fit inside a 480x272 frame, using an FFMPEG command similar to this:
ffmpeg -i 'inputFile' -s 480x272 -vf [in]scale=480:272[out] -bf 0 -keyint_min 10 -g 10 -f mp4 -vcodec libx264 -r 25.0 -b 600000 -g 10 -pix_fmt yuv420p -preset medium -profile:v high -level 4.0 -map_metadata -1 -acodec libfdk_aac -ar 44100 -ab 96000 -ac 2 'outputFile'
There’s not really any hard limits on the parameters, as long as the resulting file can be played directly in a browser, so you can for example increase the bitrate to improve the visual quality of the timeline preview (while also increasing the file size and loading time).
The time saved in the import process depends on a number of factors, such as the original file size, the encoding, the video duration etc, so we recommend running some tests to see how much time you save with the type of files you want to import.
As an example we’ve seen the processing time for importing a ~300MB, 150seconds long 1080p MP4 file go from ~55 seconds to ~18 seconds when providing a pregenerated proxy file.
Folders
The users, files and other content in an instance is organized in an hierarchical folder structure. Each user has a root media folder where all new uploads are placed by default. A specific user’s root folder ID (the folder that contains the content the user sees at /hub#media) can be found by getting the rootFolderId property from the API endpoint /api/3/users/
Each instance also has a shared folder that can be seen by all members. You can get the ID of that folder by getting the sharedRootFolder property from the API endpoint /api/3/instances/
Listing subfolders
Getting subfolders
curl https://www.wevideo.com/api/3/media/1177038539/folders \
-X GET \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"data": [
{
"title": "Folder B",
"id": 1177038550
},
{
"title": "Folder A",
"id": 1177038543
}
],
"metadata": {
"noResults": 2,
"page": 1,
"pageSize": 20
}
}
Use this call to list the subfolders of a specific folder.
HTTP REQUEST
GET https://www.wevideo.com/api/3/media/<folderId>/folders
Creating a new folder
Creating a new folder under the parent 117703853
curl https://www.wevideo.com/api/3/media/117703853/folder \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"name": "My new folder"
}'
Response (200)
{
"id": 117703854
}
Use this call to create a new folder under a specific parent folder.
HTTP REQUEST
POST https://www.wevideo.com/api/3/media/<parentId>/folder
Parameter | Type | Required | Description |
---|---|---|---|
name | string | yes | The name of the new folder. |
Webhooks
The webhooks API endpoints allows you to configure HTTP callbacks to be sent back to your server when certain events are triggered. The callbacks are HTTP POST requests with a JSON payload (Content-Type: application/json) and a custom HTTP header, “Wev-Event-Type”, with the name of the event. Your server should respond with a 2xx status code to acknowledge that the payload got delivered. Please see the webhook events section for a list of available webhook events.
Registering a webhook
Registering a webhook
curl https://www.wevideo.com/api/4/webhooks \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"url":"https://example.com/wevideoevents",
"event": "exportStarting"
}'
Response (200)
{
"success": true
}
Registers a new webhook for a specific instance/event combination.
HTTP REQUEST
POST https://www.wevideo.com/api/4/webhooks
Parameter | Type | Required | Description |
---|---|---|---|
event | string | yes | The event you want to receive notifications for. See below for a list of available events |
url | string | yes | The URL we’ll post the notification to when an event is triggered. |
instanceId | integer | no | Use this to specify the instance if you manage multiple instances. |
Listing your webhooks
Listing your webhooks
curl https://www.wevideo.com/api/4/webhooks/<INSTANCE ID> \
-X GET \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"success": true,
"webhooks": [ {
"event": "exportStarting",
"url": "https://example.com/wevideoevents",
"created": 1532066082000,
"id": 1682
}]
}
Returns the webhooks you’ve created for a specific instance.
HTTP REQUEST
GET https://www.wevideo.com/api/4/webhooks/instance/<INSTANCE ID>
Delete a webhook
Delete a webhook
curl https://www.wevideo.com/api/4/webhooks/<WEBHOOK ID> \
-X DELETE \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"success": true
}
Deletes a registered webhook
HTTP REQUEST
DELETE https://www.wevideo.com/api/4/webhooks/<WEBHOOK ID>
Webhook events
uploadCompleted
uploadCompleted payload
{
"uploadId":"2018_07_19_047db8d8-8ab5-4c6e-b995-bd25580df9f1",
"instanceId":293,
"id":90140173,
"description":"",
"type":"image",
"file":{
"title":"outdoors-railroad-railway-163598",
"mimetype":"image/jpeg",
"size":1024987
}
}
The uploadCompleted event is triggered when a media file has been successfully uploaded to your instance.
timelineCreated/templateCreated
timelineCreated payload
{
"id":"2548539b-6ad0-40bf-9890-687d01f20f17",
"userId":84429901,
"groupId":84282049,
"instanceId":293,
"created":1405388153287,
"type":"timelineCreated",
"payload":
{
"id": 86527663,
"instanceId": 293,
"title": "My video",
"duration": 5040
}
}
templateCreated payload
{
"id":"2548539b-6ad0-40bf-9890-687d01f20f19",
"userId":84429901,
"groupId":84282049,
"instanceId":293,
"created":1405388153287,
"type":"templateCreated",
"payload":
{
"id": 86527664,
"instanceId": 293,
"title": "My template",
"duration": 5040
}
}
The timelineCreated and templateCreated events are triggered when a new timeline/template is saved.
timelineDeleted/templateDeleted
timelineDeleted payload
{
"id":"2548539b-6ad0-40bf-9890-687d01f20f27",
"userId":84429901,
"groupId":84282049,
"instanceId":293,
"created":1405388153287,
"type":"timelineDeleted",
"payload":
{
"id": 86527663,
"instanceId": 293,
"title": "My video"
}
}
templateDeleted payload
{
"id":"2548539b-6ad0-40bf-9890-687d01f20f37",
"userId":84429901,
"groupId":84282049,
"instanceId":293,
"created":1405388153287,
"type":"templateDeleted",
"payload":
{
"id": 86527664,
"instanceId": 293,
"title": "My template"
}
}
The timelineDeleted and templateDeleted events are triggered when a timeline or a template is deleted.
timelineOpened
timelineOpened payload
{
"id":"280e6a20-363b-487b-9f6d-8c261932f55f",
"userId":20687931,
"groupId":84282049,
"instanceId":266,
"created":1534159097355,
"type":"timelineOpened",
"payload":{
"instanceId":266,
"id":90100148
},
"user":"Gaute Nordhaug"
}
The timelineOpened event is triggered when an existing timeline is opened.
exportStarting
exportStarting payload
{
"id":"2548539b-6ad0-40bf-9890-687d01f10f17",
"userId":84429901,
"groupId":84429898,
"instanceId":292,
"created":1404388153287,
"type":"exportStarting",
"payload":
{
"exportId":"2014_07_03_45662d39-047e-4363-8085-2953cff2ae2d",
"userId":84429901,
"instanceId":292,
"duration":7600,
"title":"My Project",
"timelineId": 84423901
}
}
The exportStarting event is triggered when a user starts the publishing process of a timeline.
exportEnding
exportEnding payload
{
"id":"2548539b-6ad0-40bf-9890-687d01f10f17",
"userId":84429901,
"groupId":84429898,
"instanceId":292,
"created":1404388153287,
"type":"exportEnding",
"payload":
{
"exportId":"2014_07_03_45662d39-047e-4363-8085-2953cff2ae2d",
"userId":84429901,
"instanceId":292,
"duration":7600,
"title":"My Project",
"description":"My amazing video",
"status":"COMPLETED",
"timelineId": 84423901,
"urls":{
"WeVideo":"http://awstest.wevideo.com/view/85201042",
"file":"https://wevideo-test-export-videos.s3.amazonaws.com/2014_12_15_8781f711-8fd9-4826-aaac-a3f5c97ee048?AWSAccessKeyId=AKIAJP327GFY6P7TD42A&Expires=1734245817&Signature=3w3mCZI79F7tjIDaEaEQbM21o7k%3D"
},
"fileId":85554442,
"fileSize": 1235
}
}
The exportEnding event is triggered when a the rendering process of a video has completed.
Roles and settings
By default 3 different roles will be created for your instances. admin, lead and user. Your instance owner will have the admin role, while newly created users will have the user role. An admin user will in general have more permissions than a lead user, which in general will have more permissions than a user role user, but a lot of these permissions can be configured through the API. These permissions maps to the permission you find under the different role tabs at https://www.wevideo.com/hub#admin/settings when logged in as an administrator for your instance.
Listing your roles
Listing your roles
curl https://www.wevideo.com/api/4/roles/instance/<INSTANCE ID> \
-X GET \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"success": true,
"roles": [
{
"PROJECT_INVITES": "all",
"ORIGINALNAME": "User",
"DOWNLOAD_EXPORT": 1,
"IMPORTBOX": 1,
"IMPORTDRIVE": 1,
"PUBLISH_YOUTUBE": 1,
"PUBLISH_ONEDRIVE": 1,
"ID": 53,
"NAME": "User",
/* More permissions and roles */
}
HTTP REQUEST
GET https://www.wevideo.com/api/4/roles/instance/<INSTANCE ID>
Updating roles
Updating a role
curl https://www.wevideo.com/api/4/roles/<ROLE ID> \
-X PUT \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"properties":[
{
"key":"NAME",
"value": "My role name"
},
{
"key":"DOWNLOAD_EXPORT",
"value": 0
}
]}'
Response (200)
{
"success": true
}
HTTP REQUEST
PUT https://www.wevideo.com/api/4/roles/<ROLE ID>
Assigning roles
Assigning a role to one or multiple users
curl https://www.wevideo.com/api/4/roles/<ROLE ID> \
-X PUT \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"userId":123,
"userIds":[1234, 12345]
}'
Response (200)
{
"success": true
}
This call allows you to assign a role to one (by using the userId field) or more (by using the userIds field) users.
HTTP REQUEST
POST https://www.wevideo.com/api/4/roles/<ROLE ID>/users
Global settings
Updating global settings
curl https://www.wevideo.com/api/4/instance/<INSTANCE ID>/settings \
-X GET \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"properties":[
{
"key":"ALLOW_ADMIN_CHANGE_PASSWORD",
"value":1
}
]
}'
Response (200)
{
"success": true
}
Some settings are not configured on a role level, but for the entire instance.
Key | Values | Description |
---|---|---|
ALLOW_ADMIN_CHANGE_PASSWORD | 0/1 | Allow admin level roles to change passwords for users and leads. |
DEFAULT_BLUR | 0/1 | Automatically apply blurred backgrounds to clips smaller than the frame |
HTTP REQUEST
POST https://www.wevideo.com/api/4/instance/<INSTANCE ID>/settings
Reports
Usage reports
Example request
curl https://www.wevideo.com/api/4/instance/report/293/usage/uploads/1516293713825/1526293713825 \
-X GET \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"property": "uploads",
"from": 1516293713825,
"fromString": "20180118164153",
"to": 1526293713825,
"toString": "20180514102833",
"description": "Total number of files uploaded in the given interval",
"result": 20
}
This call allows you to fetch some basic usage information for the given instance
HTTP REQUEST
GET https://www.wevideo.com/api/4/instance/report/<instanceId>/usage/<metric>/<fromTime>/<toTime>
Path parameters
Parameter | Description |
---|---|
instanceId | The instance to get usage numbers for |
metric | The metric to look at. One of uploads, edits, exports or exportedEdits. |
fromTime | The timstamp of the start of the interval, in milliseconds. |
toTime | The timstamp of the end of the interval, in milliseconds. |
Editor
There’s a couple of special API endpoints that can be used to open the editor in special ways
Prepopulated with media file
This call will generate a new timeline with the provided file ID and redirect the request to the editor with the timeline open.
HTTP REQUEST
GET https://www.wevideo.com/api/4/editor/withfile/<file ID>
Fonts and text configuration
You can also add custom fonts to your instance.
Adding a new font
Example request
curl https://www.wevideo.com/api/4/instance/<INSTANCE ID>/fonts \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"url":"https://example.com/MyFont.ttf",
"name": "My cool font"
}'
Response (200)
{
"success": true
}
This call will add a new font to your instance. The url should point to a valid .ttf font file, and the name defines the name the font will have in the font dropdown in the editor.
HTTP REQUEST
POST https://www.wevideo.com/api/4/instance/<instanceId>/fonts
Listing custom fonts
Example request
curl https://www.wevideo.com/api/4/instance/<INSTANCE ID>/fonts \
-X GET \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"success": true,
"fonts": [
"Montserrat-Regular",
"NotoNaskhArabic-Regular",
"NotoSans-Bold",
"NotoSans-BoldItalic",
"NotoSans-Italic",
"NotoSans-Regular",
"OpenSans-Regular",
"YOYO Sansation"
]
}
Returns a list of your custom fonts.
HTTP REQUEST
GET https://www.wevideo.com/api/4/instance/<instanceId>/fonts
Deleting a custom font
Example request
curl https://www.wevideo.com/api/4/instance/<INSTANCE ID>/fonts \
-X DELETE \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"name": "MyFont1"
}'
Response (200)
{
"success": true,
}
Removes a custom font from your account. This will just remove the font from the list of available fonts in the editor, existing timelines using the font will still work with the font.
HTTP REQUEST
DELETE https://www.wevideo.com/api/4/instance/<instanceId>/fonts
Font settings
Example request
curl https://www.wevideo.com/api/4/instance/<INSTANCE ID>/fonts/settings \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
}'
Response (200)
{
"success": true,
}
Allows you to configure certain font settings for your instance. The JSON payload supports the following fields:
Field | Value | Description |
---|---|---|
disableDefaultFonts | true/false | Setting this to true will remove all the default WeVideo fonts from your instance, leaving only your custom fonts. |
standardFont | A font name | Sets the standard font to be used for new text elements. |
textColors | A list of hex color values | Defines the default color values available for text elements. Value should be a comma separated list of hex colors, for example “#028BFF,#ffffff,#000000,#f9d713” |
allColors | true/false | If textColors is set then you need to set this to true in order to keep the color picker in addition to the default color values. |
HTTP REQUEST
POST https://www.wevideo.com/api/4/instance/<instanceId>/fonts/settings
Instance
Creating instances
The instance creation functionality needs to be enabled for your account before you can use it. Please get in touch with us if you need this functionality
Example request
curl https://www.wevideo.com/api/4/partners/instance \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"instanceName":"My new instance",
"licenses": 100
}'
Response (200)
{
"success": true,
"instanceId": 10685,
"ownerId": 2238011836
}
This call creates a new instance and a new user that will be the owner of the instance.
Parameter | Type | Required | Description |
---|---|---|---|
instanceName | string | Yes | The name of the new instance |
licenses | integer | Optional | The maximum number of users in the instance. Defaults to 5. |
string | Optional | The email of the owner user that will be created | |
firstName | string | Optional | The firstName of the owner user that will be created |
lastName | string | Optional | The lastName of the owner user that will be created |
password | string | Optional | The password of the owner user that will be created |
HTTP REQUEST
POST https://www.wevideo.com/api/4/partners/instance
List your instances
Example request
curl https://www.wevideo.com/api/4/partners/instances \
-X GET \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"success": true,
"instances": [
{
"instanceId": 4744,
"name": "Test 1",
"fullName": "Test 1_by_87952325",
"ownerId": 87952325
},
{
"instanceId": 4745,
"name": "Test 2",
"fullName": "Test 2_by_87952425",
"ownerId": 87952425
}
]
}
Returns all the instances you have created.
HTTP REQUEST
GET https://www.wevideo.com/api/4/partners/instances
Updating instance settings
Example request
curl https://www.wevideo.com/api/3/instance/266/setting \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"key":"hubHeaderInIFrame",
"name": true
}'
Response (200)
{
"success": true
}
This call will update settings that are used to configure the behavior of your instance. The payload should have the fields key and value. Only a limited number of settings are configurable through the API, and these are:
Field | Value | Description |
---|---|---|
hubHeaderInIFrame | true/false | Setting this to true will enable the hub header/menu when embedding the hub in an iframe. |
HUB_HEADER_TABS_IN_IFRAME | media,exports | Limits the number of visible hub tabs when the hub is loaded in an iframe. Possible values are “dashboard”, “projects”, “media”, “exports” and “admin”. |
HTTP REQUEST
POST https://www.wevideo.com/api/4/instance/<instanceId>/fonts
Timelines
Copy a timeline to a user
Example request
curl https://www.wevideo.com/api/4/timelines/4235532/copy/565563345 \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"success": true,
"timelineId": 87786345
}
Copy a timeline to a user. The timeline will be placed in the user’s default project.
HTTP REQUEST
POST https://www.wevideo.com/api/4/timelines/<source timeline ID>/copy/<receiving user ID>
Templates
Templates are generally created from within the editor by end users, but they can also be created through the API by converting an existing timeline to a template. The API also supports operations for modifying template metadata (name, status) as well as for deleting templates. There’s also a couple of webhook events for templates.
Converting a timeline to a template
Example request
curl https://www.wevideo.com/api/4/templates/fromtimeline/546564 \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"status":"published"
}'
Response (200)
{
"success": true,
"templateId": 23543345
}
This call will create a template from a timeline. The template will be created in the same project as the timeline already exists in.
Parameter | Type | Required | Description |
---|---|---|---|
status | string | no | The status of the template, draft or published. Defaults to draft. |
HTTP REQUEST
POST https://www.wevideo.com/api/4/templates/fromtimeline/<timelineId>
Modifying a template
Example request
curl https://www.wevideo.com/api/4/templates/52345345 \
-X PUT \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"status":"published",
"title":"My new template title"
}'
Response (200)
{
"success": true
}
This call will update the template metadata. The following parameters are supported in the JSON payload:
Parameter | Type | Required | Description |
---|---|---|---|
status | string | no | The status of the template, draft or published. |
title | string | no | The new title of the template |
HTTP REQUEST
PUT https://www.wevideo.com/api/4/templates/<templateId>
Deleting a template
Example request
curl https://www.wevideo.com/api/4/templates/52345345 \
-X DELETE \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"success": true
}
Deletes a template.
HTTP REQUEST
DELETE https://www.wevideo.com/api/4/templates/<templateId>
Searching for templates
Example request
curl https://www.wevideo.com/api/4/templates/search?ids= \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>'
Response (200)
{
"data": [ {
... template data ...
}],
"metadata": {
"noResults": 42,
"page": 1,
"pageSize": 1
}
}
You can search for and retrieve metadata for a set of templates. The result is paginated, and you can use the URL parameters page and pageSize to control the results. The returned object will contain a metadata field with the total number of results, the current page and the current pageSize.
You can use the following URL query parameters to search:
Parameter | Description | Example |
---|---|---|
ids | A comma separated list of template IDs | /api/4/templates/search?ids=123,1234 |
userId | All templates created by a specific user | /api/4/templates/search?userId=1000 |
instanceId | All templates created in a specific instance | /api/4/templates/search?instanceId=999 |
global | Limit the results to templates global to the instance (as opposed to project specific templates) | /api/4/templates/search?instanceId=999&global=true |
HTTP REQUEST
POST https://www.wevideo.com/api/4/templates/search
Create a timeline from a template
Example request
curl https://www.wevideo.com/api/4/templates/542431342/timeline \
-X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: WEVSIMPLE <YOUR API SECRET>' \
-d '{
"title":"My new timeline title"
}'
Response (200)
{
"success": true,
"timelineId": 2237887322
}
Use this call to create a new timeline based on a template.
Parameter | Description |
---|---|
userId | The user the timeline should belong to |
projectId | The project the timeline will be stored in |
title | The title of the new timeline |
HTTP REQUEST
POST https://www.wevideo.com/api/4/templates/<templateId>/timeline
Embedding WeVideo
If you’re integarting WeVideo in your page you’ll typically have an iframe that either contains just the WeVideo editor or the entire hub, which also includes media/project/user management as well as various other functionality.
You’ll probably also want to set the allow attribute of the iframe to microphone; camera in order for video/audio recording to work. As well as fullscreen to allow the user to work in fullscreen mode.
<iframe src="https://www.wevideo.com/hub" allow="microphone; camera; fullscreen" />
See this link for more information.
Embedding the editor
If you just want to embed the editor you can set the iframe src to https://www.wevideo.com/api/3/editor, or to https://www.wevideo.com/api/3/editor/{timelineId} if you want to open a specific timeline.
Embedding the hub
If you just want to embed the entire hub you can set the iframe src to https://www.wevideo.com/hub, or to https://www.wevideo.com/hub#editor/{timelineId} if you want to open a specific timeline. The hub header/menu will by default be hidden when loaded in an iframe, but you can configure that by updating your instance settings.
Listening for messages
The WeVideo iframe will post messages to the parent frame for certain events and actions. You can listen for these events by adding a simple event listener to your page:
window.addEventListener("message", function(event){
console.log(event.data);
});
The format of these messages are a bit inconsistent; event.data will in most cases be a JSON object, but there are also some messages where event.data just is a keyword.
Navigation
Whenever the user navigates within the application, and the internal path of the application changes this message will be triggered.
{"event":"navigate","data":{"path":"admin/settings"}}
Save state
When the user is in the editor itself the messages have_unsaved_work and work_is_saved will trigger whenever the timeline state changes from not having any unsaved content to having unsaved content and vice versa.
Export starting
Triggered when the user triggers a new export.
{"event":"exportStarting","data":{"exportId":"2020_01_23_93e02e80-857e-4495-a488-96bfb0f498c5"}}
Examples
Embedded editor
Step 1 - Landing page
This page serves as a demo to a typical implementation of how you can use the WeVideo embedded editor API with your website. The following is a mock/dummy design of a login page, much like what you would have for your endusers.
This step doesn’t include any API interaction with WeVideo, it’s just serves as part of an example user flow
Step 2 - Portal page
This page is where your end users go after a successful login on your website. Depending on your use case, some companies choose to redirect the user immediately into the embedded editor at this point. Others have the user invoke the embedded editor by clicking on a button/link in your portal.
This step doesn’t include any API interaction with WeVideo, it’s just serves as part of an example user flow
Step 3 - Launching the editor
//Getting a login token from your server
$.ajax({
type : 'GET',
url : "https://www.example.com/wevideologintoken",
headers : {
'Accept' : 'application/json'
},
success : function(resp) {
var loginToken = resp.token;
}
});
//Initiating a session using a login token
$.ajax({
type : 'GET',
url : "https://www.wevideo.com/api/3/sso/login/" + loginToken,
success : function(resp) {
/* The user is now logged in to WeVideo */
},
//We need this in order to not
//ignore the session cookie set by WeVideo
xhrFields: {
withCredentials: true
}
});
To launch the WeVideo editor itself the browser first needs an authenticated session with WeVideo’s server. This is done by first making a request to an API endpoint on your servers, that in turn will make an API call to WeVideo’s server to generate a login token. The token should be returned to the browser, which will use it to make a request directly to WeVideo’s server in order to initiate a session. See Logging in
Once the browser is authenticated with WeVideo the editor can be opened either in an iframe or in a popup by simply pointing the iframe/popup to:
https://www.wevideo.com/api/3/editor
Notes on the server side flow
For this flow you would need to implement an API call on your end that would do something like this:
- Get the ID of the authenticated user in your system.
- If this is the first time the user will be using WeVideo then you should probably create a WeVideo through the /api/3/users call and save a mapping between your internal user ID and the WeVideo user ID.
- Make a call to /api/3/sso/auth to generate a one time login token
- Return the token to the client.