Skip to main content
POST
/
api
/
templates
/
{id}
/
restore_version
Restore Template Version
curl --request POST \
  --url https://api.example.com/api/templates/{id}/restore_version \
  --header 'Content-Type: application/json' \
  --data '
{
  "version_id": 123
}
'

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.

Path parameters

id
string
required
Template ID (e.g., tpl_7VQhP2tM9xA1kR8bN).

Body parameters

version_id
integer
required
The version snapshot ID to restore from. Get this from the List Versions endpoint.

Response

Returns the restored template object with the full schema.

Example

# 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}'
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.

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
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.