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

# Restore Template Version

> Restore a template's schema and submitters from a previous version snapshot. Creates a pre-restore snapshot first so you can undo the restore if needed.

## Path parameters

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

## Body parameters

<ParamField body="version_id" type="integer" required>
  The version snapshot ID to restore from. Get this from the [List Versions](/api-reference/templates/list-template-versions) endpoint.
</ParamField>

## Response

Returns the restored template object with the full schema.

## Example

```bash theme={null}
# Step 1: List versions to find the right one
curl https://spitshake.io/api/templates/tpl_7VQhP2tM9xA1kR8bN/versions \
  -H "X-Auth-Token: YOUR_API_KEY"

# Step 2: Restore from version 12 (which had 42 fields)
curl -X POST https://spitshake.io/api/templates/tpl_7VQhP2tM9xA1kR8bN/restore_version \
  -H "X-Auth-Token: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"version_id": 12}'
```

<Warning>
  This replaces the template's current schema and submitters with the version snapshot. A pre-restore snapshot is created automatically so you can undo by restoring from it.
</Warning>

## Common use case: recovering from accidental PUT

If a `PUT /api/templates/:id` with a partial schema accidentally wiped fields:

1. Call `GET /api/templates/:id/versions` to find the version before the wipe (look for the highest `field_count`)
2. Call `POST /api/templates/:id/restore_version` with that version's `id`
3. Verify with `GET /api/templates/:id` that all fields are restored

<Note>
  `PUT /api/templates/:id` replaces the **entire** schema array. To update specific fields, always GET the full schema first, modify the fields you need, and PUT the complete array back. There is no PATCH endpoint for partial schema updates.
</Note>
