> ## Documentation Index
> Fetch the complete documentation index at: https://pdfbase.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a template

> Update a template's HTML, CSS, schema, or defaults. Increments the version number.

## Phase

**Phase 1 (Launch)**

## Path parameters

<ParamField path="id" type="string" required>
  Template ID, e.g., `tpl_abc123`.
</ParamField>

## Request

All fields are optional. Only include the fields you want to change.

<ParamField body="name" type="string">
  Updated name.
</ParamField>

<ParamField body="html" type="string">
  Updated HTML content.
</ParamField>

<ParamField body="css" type="string">
  Updated CSS.
</ParamField>

<ParamField body="schema" type="object">
  Updated schema. Existing PDFs generated with the old schema are unaffected.
</ParamField>

<ParamField body="defaults" type="object">
  Updated default rendering options.
</ParamField>

<ParamField body="sample_data" type="object">
  Updated sample data.
</ParamField>

<ParamField body="description" type="string">
  Updated description.
</ParamField>

## Response

Returns the full updated template. The `version` field is incremented.

```json theme={null}
{
  "id": "tpl_abc123",
  "object": "template",
  "name": "invoice",
  "version": 4,
  "updated_at": "2026-05-23T09:15:00Z",
  ...
}
```

<Note>
  Template updates are not retroactive. PDFs already generated from the old version are unaffected. The `template.version` field on each PDF records which version was used.
</Note>

## Example

```bash theme={null}
curl -X PATCH https://api.pdfbase.dev/v1/templates/tpl_abc123 \
  -H "Authorization: Bearer pk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<h1>Updated Invoice #{{number}}</h1>...",
    "defaults": { "compress": "high" }
  }'
```
