# Render API

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](/generating-videos/supported-features.md) 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](https://admin.capsule.video/#/settings/developer/) in your Capsule dashboard.

### Example

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

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "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"
    }
}
</code></pre>

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

```bash
curl -X POST "https://api.capsule.video/job" \
  -H "Authorization: Bearer <YOUR_CAPSULE_API_KEY>" \
  -H "content-type: application/json" \
  --data @<(cat <<EOF
{
    "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"
    }
}
EOF
)
```

Response:

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

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

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

Reponse:

```json
{
    "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:

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

Response:

```json
{
    "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:

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

Response:

```json
{
    "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:

{% embed url="<https://static.capsule.video/demo/suns_jazz_render_1080.mp4>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.capsule.video/generating-videos/render-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
