
# From draft to production

An agent is most useful while you design a video. Once the design is right, save it as a template, and your app can
render it for every product, listing or customer without calling a model. Each video follows the design you approved.

## 1. Draft with an agent

Ask your agent for the video and review it in Studio until it's right. See the
[quickstart](/getting-started/quickstart-agent).

## 2. Mark what changes per video

Ask your agent to replace the parts that change with merge fields, such as `{{ADDRESS}}` or `{{PHOTO}}`:

```json
{
    "asset": {
        "type": "rich-text",
        "text": "{{ADDRESS}}"
    },
    "start": 0,
    "length": 5
}
```

A merge field can go in any string: text, image and video URLs, colours, and the prompts of
[AI-generated assets](/generating-assets/generative-ai). See [Merging Data](/architecting-an-application/merging-data).

## 3. Save it as a template

| From          | How                                                         |
| :------------ | :---------------------------------------------------------- |
| An MCP client | Ask your agent. It uses the `create_template` tool.         |
| The CLI       | `shotstack template create edit.json --name "Listing video"` |
| Your code     | `POST /templates` with a `name` and the edit as `template`  |

Each returns the template's ID.

## 4. Render it for every record

Send one request per record to `POST /templates/render`, with the template ID and that record's values:

```json
{
    "id": "f5493c17-d01f-445c-bb49-535fae65f219",
    "merge": [
        { "find": "ADDRESS", "replace": "12 Harbour St" },
        { "find": "PHOTO", "replace": "https://example.com/photos/12-harbour-st.jpg" }
    ]
}
```

- **Send every field.** The `merge` array in the request replaces any default values saved in the template.
- **Get a webhook.** Save the template with a `callback` URL in its edit, and every render of it posts to that URL when
  it finishes. See [Webhooks](/architecting-an-application/webhooks).
- **Renders run in parallel**, so a batch doesn't wait on itself.

The n8n, Make and Zapier apps render templates the same way, with your data mapped to merge fields. See [Automation tools](/architecting-an-application/automation-tools).

## 5. Change the design without changing your code

Open the template in Studio, or ask your agent to change it: `shotstack template get <id>`, edit, then
`shotstack template update <id> edit.json`. Your app keeps sending the same request, and the next render uses the new
design. Updating replaces the template, so try changes on a copy first.

## When the agent stays in the loop

Some videos need a different story every time. Then your agent writes a new edit for each request and renders it
directly, with the MCP server's `render_video` tool or `shotstack render`. Use this when no single template fits, and
plan for a model call on every video.
