Render API

API for creating video content using templates. Now in beta. Please email developer-support@capsule.video with any questions.

The Capsule Render API is a full-featured video editing API that supports all of the features you’d expect from a professional video editing tool, and more. Here is a list of video template features.

Here are two API endpoints you'll use when creating a video with a template:

POST https://api.capsule.video/job

Creates a video render job. The request payload is a JSON object that specifies the template id and the asset and data inputs to pass to the template, among other things. See example below.

Different templates can have different sets of inputs.

GET https://api.capsule.video/job/<JOB_ID>

Get the status of a job by ID. The response includes percentage complete. As soon as the preview stream is ready, the HLS playlist URL is included in the response. When the render is complete, the mp4 URL is also included. See examples below.

These API endpoints require an API Key. Your organization's API Key can be found in Settings -> Developer in your Capsule dashboard.

Example

Here’s an example JSON object for the POST request:

{
    "template": "game-announcement",
    "payload": {
        "canvasWidth": 1080,
        "canvasHeight": 1080,
        "assets": [
            {
                "name": "broadcastLogo",
                "url": "https://static.capsule.video/demo/nba.png",
                "cache": true
            },
            {
                "name": "sponsorLogo",
                "url": "https://static.capsule.video/demo/axp.png",
                "cache": true
            },
            {
                "name": "camera",
                "url": "https://static.capsule.video/demo/suns_jazz_6s.mp4",
                "cache": true
            }
        ],
        "cameraScale": "fill",
        "accentColor": "#E03A3E",
        "team1": "Utah Jazz",
        "team2": "Phoenix Suns",
        "gameDate": "April 21",
        "gameTime": "8:00",
        "gameTimeInfo": "PM ET"
    }
}

Here’s an example API call to create a video job using the payload above:

curl -X POST "https://api.capsule.video/job" \
  -H "Authorization: Bearer <YOUR_CAPSULE_API_KEY>" \
  -H "content-type: application/json" \
  --data-raw '{"script":"game-announcement","payload":{"canvasWidth":1080,"canvasHeight":1080,"assets":[{"name":"broadcastLogo","url":"https://static.capsule.video/demo/nba.png","cache":true},{"name":"sponsorLogo","url":"https://static.capsule.video/demo/axp.png","cache":true},{"name":"camera","url":"https://static.capsule.video/demo/suns_jazz_6s.mp4","cache":true}],"cameraScale":"fill","accentColor":"#E03A3E","team1":"Utah Jazz","team2":"Phoenix Suns","gameDate":"April 21","gameTime":"8:00","gameTimeInfo":"PM ET"}}'

Response:

{
    "jobId": "59700ed74n7679780c55a02f",
    "message": "ok",
    "success": true
}

Now checking the status of that job with a GET using the job ID returned above:

curl -X GET "https://api.capsule.video/job/59700ed74n7679780c55a02f" \
  -H "Authorization: Bearer <YOUR_CAPSULE_API_KEY>"

Reponse:

{
    "jobId": "59700ed74n7679780c55a02f",
    "status": "started",
    "progress": 0,
    "runtime": 0,
    "endtime": 0,
    "compDuration": 0,
    "string": "",
    "streaming": false,
    "url": "",
    "streamUrl": ""
}

This means the job is still initializing. During this phase it’s downloading the assets if they’re not already cached.

Making the same status call again a few moments later:

curl -X GET "https://api.capsule.video/job/59700ed74n7679780c55a02f" \
  -H "Authorization: Bearer <YOUR_CAPSULE_API_KEY>"

Response:

{
    "jobId": "59700ed74n7679780c55a02f",
    "status": "exporting",
    "progress": 0.267734557390213,
    "runtime": 0,
    "endtime": 0,
    "compDuration": 7.5,
    "string": "",
    "streaming": true,
    "url": "",
    "streamUrl": "https://render.capsule.video/media/59700ed74n7679780c55a02f/index.m3u8"
}

In this case you can see the render is in progress, about 27% complete. This response also indicates that the HLS stream is available and the stream URL is provided so you can stream the preview while the video is rendering.

Making the same status call again a few moments later:

curl -X GET "https://api.capsule.video/job/59700ed74n7679780c55a02f" \
  -H "Authorization: Bearer <YOUR_CAPSULE_API_KEY>"

Response:

{
    "jobId": "59700ed74n7679780c55a02f",
    "status": "completed",
    "progress": 1,
    "runtime": 1837,
    "endtime": 1652398852674,
    "compDuration": 7.5,
    "streaming": true,
    "url": "https://render.capsule.video/media/59700ed74n7679780c55a02f",
    "streamUrl": "https://render.capsule.video/media/59700ed74n7679780c55a02f/index.m3u8"
}

This time you can see that the render job is complete and the finished video url is provided. In this case, the render time was 2.7 seconds for a 7.5 second video.

Here's the rendered video:

Last updated