---
title: "Update a template (a new version)"
method: PUT
path: "/v1/templates/{id}"
tags: ["Templates"]
---

# Update a template (a new version)

`PUT /v1/templates/{id}`

## Request

- Base URL: `https://api.castpdf.com`
- URL: `https://api.castpdf.com/v1/templates/{id}`
- Auth: HTTP bearer

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `name` string
  - `html` string
  - `css` string, nullable
  - `sample_data` object
  - `settings` object
    - `mode` 'fast' | 'print'
    - `format` union
      - 'A4' | 'A5' | 'Letter' | 'Legal'
      - object
        - `width` string, required
        - `height` string, required
    - `orientation` 'portrait' | 'landscape'
    - `margin` string

## Response `200`

OK

- Template
  - `id` string, uuid
  - `name` string
  - `current_version` integer
  - `pinned_version` integer, nullable
  - `updated_at` string, date-time
  - `thumbnail_url` string, uri: Signed PNG of the current version first page (480 px wide, rendered with its sample data); made on first request, the url changes with each version.
  - `version` integer
  - `html` string
  - `css` string, nullable
  - `sample_data` object, nullable
  - `settings` object

## Other responses

- `default`: Error

---

[API](https://skmtc.dev/castpdf/apis/castpdf-api.md) · [All operations](https://skmtc.dev/castpdf/apis/castpdf-api/llms.txt) · [OpenAPI document](https://skmtc.dev/castpdf/apis/castpdf-api/revisions/4ec737ba2ba6?raw)
