Topvid API Documentation
Topvid’s API splits into two major categories.
-
Whitelabel API which is the API that allows an API client, to create users on his behalf, manage their credits and view their data.
-
Personalized Video API with which you can create videos with dynamic content at scale. Example use cases: Sale offer video based on past purchases, invoice walk-through video, thank video after purchase, order status report video.
Different access points for each category require different permissions, visit Getting Started for more information about permissions.
Before we start
Before accessing any of Topvid’s API endpoints you have to obtain an access token.
Currently Topvid does not provide a way to generate access tokens, if you want one please contact alex@topvid.io.
Permissions
Most of Topvid’s api endpoints are restricted by permission types–meaning your access token will need a specific permission to access certain endpoints. The permission needed for each endpoint is specified in its designated documentation.
You can always call validate to see the permissions available for your access token.
Base Endpoint
All of the API call paths mentioned in this documentation are relative to the base endpoint https://video-maker.topvid.com/
This section documents the public API endpoints (requires no permission).
Glossary
Client - The entity making the API calls, owner of the access token.
This endpoint is used to check if your access token is still valid.
Request parameters
The client access token
Responses
Body
Validity expiration timestamp.
Array containing all available permissions for this token.
GET https://video-maker.topvid.com/api/validate?access_token=<your_access_token> HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"valid_until": "2018-07-31T23:59:59.067",
"permissions": [
"manage_users"
]
}
This page documents the API endpoints for the tokens with the “manage_users” permission.
Glossary
Client - The entity making the API calls, owner of the access token.
User - The entities that are created and managed by the client.
Authentication
This endpoint is used to create new users, under the control of the API access token owner.
Request parameters
The client access token
Unique string to identify the user. You will use this identifier for other API calls.
Amount of credits the new user will start with, must be integer. If not supplied defaults to 0.
Responses
Body
The same UID that was supplied in the creation call.
Amount of credits of the created user.
POST https://video-maker.topvid.com/api/create_user?access_token=<your_access_token>&uid=2BaYeeT51qBMWH2o&credits=5 HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"new_user": "2BaYeeT51qBMWH2o",
"credits": "5"
}
Authentication
This endpoint is used the ADD credits to existing users.
Request parameters
The client access token.
Identifier of the user to add credits to.
Amount of credits to add to the existing user, must be an integer.
Responses
Body
UID of the user the action was applied to.
Updated amount of credits the user currently has.
POST https://video-maker.topvid.com/api/add_credits?access_token=<your_access_token>&uid=2BaYeeT51qBMWH2o&amount=7 HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"user": "2BaYeeT51qBMWH2o",
"credits": 12
}
Authentication
This endpoint generates a report for a given user, including the number of credit he currently has and the number of videos he already created.
Request parameters
The client access token.
Identifier of the user to generate report of.
Responses
Body
UID of the user the action was applied to.
Amount of videos this user has created.
Amount of credits this user currently has.
GET https://video-maker.topvid.com/api/user_report?access_token=<your_access_token>&uid=2BaYeeT51qBMWH2o HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"user": "2BaYeeT51qBMWH2o",
"created_videos": 3,
"available_credits": 9
}
The following code should be used in order to embed the video builder in the front-end of your app.
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://video-maker.topvid.io/static/assets/js/whiteLabel.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Karla">
<button type="button"
id="TOPVID"
class="btn btn-info btn-lg">
Open Builder
</button>
<script type="text/javascript">
$(function() {
var topvid = new TopvidFrame({
uid: '<==Replace This==>',
apiKey: '<==Replace This==>',
onReady: function onReady(videoUrl) {
//Add your code here
console.log('callback video url', videoUrl);
}
});
});
</script>
</body>
</html>
Identifier of the user this Video Builder is targetted to.
API key identifier of the client that owns the user this builder is targetted to.
Once the user generates a video and is ready to use it, he will click on the “Use Video” button inside the Video Builder.
Once the “Use Video” button is clicked the Video Builder will closed and a the onReady
function will be called.
The function will get the url of the video chosen by the user inside the videoUrl variable.
Use this function in order to embed the video created by the Video Builder in the flow of your app (for example post it to social network or create a video ad campaign).
This page documents the API endpoints for the tokens with the “create_videos” permission.
Glossary
Client - The entity making the API calls, owner of the access token.
Authentication
This endpoint is used to create videos.
Once the video is created (which takes about a minute) a POST
call will be made to the callback uri you supplied when you received your access token.
Request parameters
The client access token
JSON with all of the video related content
Template version must match the video_json, if not, an error will be returned
Unique id for this video, used to identify the video when the callback with the video url will be returned.
Responses
Body
An automatically generated video unique id, or the one you supplied on the creation call.
POST https://video-maker.topvid.com/api/create_video?access_token=<your_access_token>&video_json={<your_video_json>}&template_version=3&vid=first_user_video HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"vid": "first_user_video"
}
If the video has been created successfully, this JSON object will be sent to the callback uri you supplied.
Unique identifier of this video.
Downloadable mp4 url of this video.
Downloadable image url of this video.
Scaled version of the full thumbnail.
{
"vid": "first_user_video",
"video_url": "https://s3.amazonaws.com/<....>.mp4",
"full_thumbnail": "https://s3.amazonaws.com/<....>.jpg",
"scaled_thumbnail": "https://s3.amazonaws.com/<....>.jpg"
}
If the video you attempted to create failed for any reason, you will be returned the following JSON.
Indicating a failed video and will contain the vid (video identifier) associated with it.
{
"failed": "first_user_video"
}