> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.templated.io/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# "Multi-Page Renders: Specific Pages, Repeating Pages, Merge and ZIP"

A Templated template can have several pages (carousels, brochures, multi-page PDFs, several sizes of the same design). This article explains how to control which pages are rendered and how you receive the files.

## Option 1: Same content on all pages

Send `layers` without `pages`. Every page of the template is rendered and the same changes are applied to every layer with that name on every page.

```json
{
  "template": "TEMPLATE_ID",
  "layers": {
    "company-name": { "text": "ACME Corp" }
  }
}
```

The response is a list of renders, one per page.

## Option 2: Different content per page (the `pages` array)

```json
{
  "template": "TEMPLATE_ID",
  "pages": [
    { "page": "page-1", "layers": { "title": { "text": "Welcome" } } },
    { "page": "page-2", "layers": { "title": { "text": "Our Services" } } }
  ]
}
```

Important rules:

- **Only the pages you list are rendered.** To skip a page, leave it out of the array.
- **Pages are rendered in the order of the array.** You can change the order freely.
- **You can repeat the same page.** List `page-2` five times to get five slides from one design. This is the best way to build carousels with a variable number of slides.
- When you send `pages`, the top-level `layers` field is ignored.
- Each page object only changes layers that exist on that page. Use the real layer name on that page.
- You can also set `width` and `height` per page object to render pages at different sizes.

To see the page ids and the layers on each page, call `GET https://api.templated.io/v1/template/{templateId}/pages`. See https://templated.io/docs/templates/pages/

### Render only one page

Send a `pages` array with a single entry:

```json
{
  "template": "TEMPLATE_ID",
  "pages": [
    { "page": "page-3", "layers": { "title": { "text": "Only this page" } } }
  ]
}
```

### Hide empty slides

There is no automatic "remove empty slides" option. Build the `pages` array in your code or automation and only include the pages that have content.

## Option 3: One PDF with all pages (`merge`)

Add `"format": "pdf"` and `"merge": true`:

```json
{
  "template": "TEMPLATE_ID",
  "format": "pdf",
  "merge": true,
  "pages": [ ... ]
}
```

The response contains:

- `url`: the single merged PDF with all pages.
- `renders`: the individual page renders.

If you also use `"async": true`, you must send a `webhook_url`. The merged PDF URL is delivered to your webhook when all pages are done.

## Option 4: All files in a ZIP (`zip`)

Add `"zip": true`. Each page is added to a ZIP archive as a separate file in its original format (jpg, png, pdf, mp4...).

The response contains:

- `url`: the ZIP file.
- `download_page_url`: a hosted download page that shows each image. On phones it offers a "Save all to Photos" button, which is easier than opening a ZIP on mobile.
- `renders`: the individual renders.

Files are named after the `name` parameter, or after the template name, and numbered in page order. Example: `My Template - 01.png`, `My Template - 02.png`.

Notes:

- `merge` and `zip` cannot be used in the same request.
- With `"async": true`, `zip` requires a `webhook_url`.
- `zip` also works with the `templates` array (several templates in one request).

Full reference: https://templated.io/docs/renders/create/#download-all-pages-as-a-zip

## Merge existing renders or external PDFs

To combine renders you already created, use the merge endpoint:

`POST https://api.templated.io/v1/render/merge`

- `ids`: list of render ids (required).
- `urls`: optional list of external PDF URLs, added after the renders.
- `name`: optional file name.
- `host`: `true` to receive a URL. Without it, the PDF file is returned directly in the response.

Order: first the renders in the order of `ids`, then the external PDFs in the order of `urls`. Each merge uses 1 credit. See https://templated.io/docs/renders/merge/

## Credits

Each rendered page uses 1 credit. A 5-page template rendered fully uses 5 credits. A page repeated 3 times in `pages` uses 3 credits.

## FAQ

Q: How do I render only page 2 of my template?
A: Send a `pages` array with only `{ "page": "page-2", "layers": {...} }`. Only listed pages are rendered.

Q: How do I make a carousel with a different number of slides each time?
A: Design one page for each slide type, then repeat the same page id in the `pages` array as many times as you need.

Q: How do I get one PDF instead of separate files?
A: Use `"format": "pdf"` and `"merge": true`. The merged PDF is in the root `url` of the response.

Q: How do I download all pages at once?
A: Use `"zip": true`. The ZIP is in `url`, and `download_page_url` gives a mobile friendly download page.

Q: Can I remove empty pages automatically?
A: No. Leave the empty pages out of the `pages` array.

Q: My PDF is too big.
A: Add `"flatten": true` to the render request, and use images that are not much larger than the layer size.

Q: Can I merge my render with another PDF?
A: Yes, with `POST /v1/render/merge` using `ids` for your renders and `urls` for the external PDFs.