# Use public templates

JSON2Video ships a **public library** of ready-made templates. Each template is a reusable Movie JSON blueprint with `{{variable}}` placeholders, so you only supply the values that change.

There are two ways to work with a public template from the API:

- **Render it directly** — pass your own values to its variables and get a one-off video. Nothing is saved to your account. See [Guide 1](#guide-1--render-a-video-from-a-public-template).
- **Duplicate it into your account** — get your own editable copy that you can customize and manage. See [Guide 2](#guide-2--duplicate-a-public-template-into-your-account).

Both start the same way: browse the library and pick a template ID.

Every request needs the `x-api-key` header. Reading templates and rendering need at least the `render` role; duplicating writes to your account and needs `editor` or above. Get a key from the [dashboard](https://json2video.com/dashboard/apikeys).

## Browse the library and pick a template

Call [`GET /v2/templates/library`](@/reference/api-endpoints/templates-library) to list the public gallery. Add `?tags=intro,social` to filter.

```bash
curl -X GET "https://api.json2video.com/v2/templates/library" \
  -H "x-api-key: YOUR_API_KEY"
```

Response (trimmed):

```json
{
  "success": true,
  "count": 19,
  "templates": [
    {
      "id": "ky4nEongQp9dqHlb1GIA",
      "name": "Real Estate 01",
      "tags": ["published", "real estate"],
      "width": 1080,
      "height": 1920,
      "aspect_ratio": 0.56,
      "video_url": "https://json2video-cdn2.s3.amazonaws.com/templates/ky4nEongQp9dqHlb1GIA/example.mp4",
      "thumbnail_url": "https://json2video-cdn2.s3.amazonaws.com/templates/ky4nEongQp9dqHlb1GIA/thumbnail.jpg"
    }
  ]
}
```

Preview candidates with `video_url` / `thumbnail_url`, then copy the `id` of the one you want (here `ky4nEongQp9dqHlb1GIA`). You'll use it in both guides below.

## Guide 1 — Render a video from a public template

You don't need to own a template to render from it. Pass its `id` plus your values, and JSON2Video renders the video. Nothing is stored in your account.

### 1. Discover the variables it exposes

Read the template by ID with `scopes=variables` to see the variables it declares and their default values:

```bash
curl -X GET "https://api.json2video.com/v2/templates?id=ky4nEongQp9dqHlb1GIA&scopes=variables" \
  -H "x-api-key: YOUR_API_KEY"
```

```json
{
  "success": true,
  "template": {
    "id": "ky4nEongQp9dqHlb1GIA",
    "name": "Real Estate 01",
    "owner": false,
    "variables": {
      "intro": {
        "title": "Find your perfect home",
        "subtitle": "House of the week, premium residence for living",
        "image1": { "url": "https://json2video-cdn2.s3.amazonaws.com/templates/ky4nEongQp9dqHlb1GIA/placeholder/intro-01-cozy-living-room.jpg" },
        "image2": { "url": "https://json2video-cdn2.s3.amazonaws.com/templates/ky4nEongQp9dqHlb1GIA/placeholder/intro-02-room-interior.jpg" },
        "image3": { "url": "https://json2video-cdn2.s3.amazonaws.com/templates/ky4nEongQp9dqHlb1GIA/placeholder/intro-03-room-interior.jpg" },
        "icon": { "url": "https://json2video-cdn2.s3.amazonaws.com/library/icons/png/black-location_pin_filled.png" },
        "locationTitle": "Current Location",
        "locationName": "Sant Cugat, Spain",
        "duration": "4.5"
      },
      "slides": { "...": "..." },
      "outro": { "...": "..." },
      "design": { "...": "..." },
      "music": { "...": "..." }
    }
  }
}
```

(Trimmed: the real response also carries editor hints next to each value, such as `"?title"` help texts and `"&"` widget settings. They are ignored at render time.)

You can read any public template this way even though you don't own it — `owner` simply comes back `false`. If you're building a form or need types, request [`GET /v2/templates?id=...&format=jsonschema`](@/reference/api-endpoints/templates-list) to get a JSON Schema of the variables instead.

### 2. Render, overriding the variables you want

Submit a movie that references the template and supplies your values. Any variable you omit keeps the template's default.

Overrides apply to **top-level** variables only. If you pass `intro`, your object replaces the template's whole `intro`, so send every field it needs, not just the ones you change:

```bash
curl -X POST "https://api.json2video.com/v2/movies" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "template": "ky4nEongQp9dqHlb1GIA",
    "variables": {
      "intro": {
        "title": "47 Cedar Avenue",
        "subtitle": "4 bedrooms, open kitchen and a large backyard",
        "image1": { "url": "https://cdn.json2video.com/assets/images/sample-house-front.jpg" },
        "image2": { "url": "https://cdn.json2video.com/assets/images/sample-house-kitchen.jpg" },
        "image3": { "url": "https://cdn.json2video.com/assets/images/sample-house-living.jpg" },
        "icon": { "url": "https://json2video-cdn2.s3.amazonaws.com/library/icons/png/black-location_pin_filled.png" },
        "locationTitle": "Now selling",
        "locationName": "Seattle, WA",
        "duration": "4.5"
      }
    }
  }'
```

Response:

```json
{
  "success": true,
  "project": "JkGxEoPRF9EgRb32",
  "timestamp": "2026-07-08T10:49:52.924Z"
}
```

You can also override `resolution`, `quality` or `exports` at the top level of the body alongside `template` and `variables`. Save the `project` value to check status.

### 3. Poll until it's done

Poll [`GET /v2/movies?project=...`](@/reference/api-endpoints/movies-status) until `movie.status` is `done` (or `error` / `timeout`). When it's `done`, `movie.url` holds the rendered video.

```bash
curl -X GET "https://api.json2video.com/v2/movies?project=JkGxEoPRF9EgRb32" \
  -H "x-api-key: YOUR_API_KEY"
```

## Guide 2 — Duplicate a public template into your account

Rendering directly is ideal for one-off videos. If instead you want to **customize the template itself** — edit its scenes, change the default values, or manage it from the dashboard — duplicate it into your account first. You get a brand-new template ID that you own.

### 1. Duplicate it

Call [`POST /v2/templates`](@/reference/api-endpoints/templates-create) with `action=duplicate` and the public template's `id`. Optionally set a `name` (and `variables` to pre-fill) in the body. This needs the `editor` role or above.

```bash
curl -X POST "https://api.json2video.com/v2/templates?id=ky4nEongQp9dqHlb1GIA&action=duplicate" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "name": "My real estate listing"
  }'
```

Response — note the **new** `templateId`, which now belongs to your account:

```json
{
  "success": true,
  "templateId": "xyz987uvw654rst321qp",
  "name": "My real estate listing",
  "timestamp": "2026-07-08T10:49:52.924Z"
}
```

### 2. Use your copy

The duplicate is a fully independent template you own — later changes to the public original don't affect it. With your new ID you can:

- **Render it** the same way as Guide 1 (`POST /v2/movies` with `"template": "xyz987uvw654rst321qp"` and your `variables`).
- **Edit it** with [`POST /v2/templates?id=xyz987uvw654rst321qp`](@/reference/api-endpoints/templates-create), or from the dashboard — see [Dashboard — Templates](@/guides/dashboard/templates).

## Which approach should I use?

| Render directly (Guide 1) | Duplicate first (Guide 2) |
|---------------------------|---------------------------|
| Quick, one-off videos | You want to customize the template |
| Nothing saved to your account | Editable copy you own |
| Needs the `render` role | Needs the `editor` role |

## See also

- [Template library (GET /v2/templates/library)](@/reference/api-endpoints/templates-library) — the public gallery endpoint.
- [List templates (GET /v2/templates)](@/reference/api-endpoints/templates-list) — read a template and its variables.
- [Create / update template (POST /v2/templates)](@/reference/api-endpoints/templates-create) — duplicate, edit and save templates.
- [Create movie (POST /v2/movies)](@/reference/api-endpoints/movies-create) — render from a template.
- [Dashboard — Templates](@/guides/dashboard/templates) — manage templates in the UI.
- [Tutorial 10 — Variables](@/tutorials/10-variables) and [Tutorial 11 — Templates](@/tutorials/11-templates).
