API Reference
Manage reusable templates and versioned template changes
This page is the source of truth for the template lifecycle: list, create, update, delete, inspect version history, and roll back to a prior snapshot for deterministic render output.
The machine readable contract for these customer account routes lives in /docs/account. This docs page stays more explanatory so template workflow, versioning rules, and render handoff remain easy to follow in one place.
Auth model
All template lifecycle routes
Authorization: Bearer ACCESS_TOKEN
Templates are account resources. Every route on this page requires signed in user bearer auth.
Render usage after create
templateId and optional templateVersionId
Use the returned template identifier on rendering routes. Use templateVersionId only when you need deterministic historical output.
Version history access
Professional and Business plans
Version history and rollback are plan-gated. Accounts without versioning access receive409 Conflict. Eligible plans retain the newest 25 versions per template.
Credential
All routes on this page use bearer auth because templates are account resources.
Render handoff
Use templateId in render requests, and add templateVersionId only when you need one historical snapshot.
Versioning rule
Version history and rollback are gated by plan and return conflict responses when versioning is unavailable.
Retention cap
Version history keeps the 25 most recent snapshots for each template on version-enabled plans.
List templates
List saved templates for the authenticated account
Use this route to inventory template IDs, names, and current snapshots. Results are returned newest first by createdAt.
GET/user/templates
200 OK401 Unauthorized
Request
Authorization
required bearer token
Lists templates for the signed in account only.
Response
templates
array<object>
Template records ordered newest first by create time.
templates[].id
UUID
Stable template identifier used in render requests.
templates[].name
string
Human-readable template name unique within the account.
templates[].content
string
Current HTML content saved for the template.
templates[].sampleData
string
Saved sample JSON string, if present.
templates[].createdAt
ISO 8601 datetime
Timestamp when the template was created.
templates[].updatedAt
ISO 8601 datetime
Timestamp of the latest mutation on the template.
Create template
Create a reusable template record
Create fails with 409 Conflict when the name already exists or the account template limit is reached.
POST/user/templates
200 OK400 Bad Request401 Unauthorized409 Conflict
Request
name
required string, max 100
Template display name, unique per account.
content
required string, max 200,000
HTML content used for render-time substitution. Must contain meaningful body content and safe template placeholders.
sampleData
optional JSON-object string, max 50,000
Serialized JSON object used by preview or test workflows.
Response
id
UUID
Template identifier to store for future renders.
name
string
Unique template name that was persisted for the account.
content
string
Saved HTML snapshot used by future render calls.
sampleData
string
Stored JSON string (or empty string when omitted).
createdAt
ISO 8601 datetime
Timestamp when the template record was first created.
updatedAt
ISO 8601 datetime
Timestamp of the latest template mutation.
Update template
Update name, content, or sample data for one template
Updating content may create a version snapshot on plans that include version history.
PATCH/user/templates/:id
200 OK400 Bad Request401 Unauthorized404 Not Found409 Conflict
Request
id
required path UUID
Template identifier owned by the signed in account.
name
optional string, max 100
Must remain unique when changed.
content
optional string, max 200,000
Updates the active HTML content snapshot and must still pass template placeholder safety checks.
sampleData
optional JSON-object string, max 50,000
Replaces the stored sample JSON string.
Response
id
UUID
Stable template identifier returned for follow up updates and renders.
name
string
Current unique template name after update processing.
content
string
Current active HTML snapshot for rendering.
sampleData
string
Current stored sample JSON string.
createdAt
ISO 8601 datetime
Original creation timestamp, unchanged by update.
updatedAt
ISO 8601 datetime
Mutation timestamp after the update is saved.
Delete template
Delete one template by identifier
Delete is permanent for the current template record and returns a success confirmation.
DELETE/user/templates/:id
200 OK401 Unauthorized404 Not Found
Request
id
required path UUID
Identifier for the account template to remove.
Response
success
boolean
Returns true when deletion succeeds.
Version history
List saved versions for a single template
Version history supports audits, deterministic rerenders, and rollback preparation.
GET/user/templates/:id/versions
200 OK401 Unauthorized404 Not Found409 Conflict
Request
id
required path UUID
Template identifier whose versions should be listed.
Response
versions
array<object>
Version snapshots ordered by versionNumber descending.
versions[].id
UUID
Version identifier used by rollback.
versions[].versionNumber
integer
Monotonic version counter for that template.
versions[].name
string
Template name captured at that historical snapshot.
versions[].content
string
HTML content captured for that version.
versions[].sampleData
string
Serialized sample JSON captured for that version.
versions[].createdAt
ISO 8601 datetime
Timestamp when this version snapshot was written.
Rollback
Restore a previous version as the current template
Rollback applies one historical snapshot, saves it as the current template, and returns the updated template state.
POST/user/templates/:id/versions/:versionId/rollback
200 OK401 Unauthorized404 Not Found409 Conflict
Request
id
required path UUID
Template identifier to modify.
versionId
required path UUID
Historical version snapshot to restore.
Response
id
UUID
Template identifier that was rolled back.
name
string
Name restored from the selected historical version.
content
string
Content restored from the selected historical version.
sampleData
string
Sample JSON restored from the selected historical version.
createdAt
ISO 8601 datetime
Original creation timestamp for the template record.
updatedAt
ISO 8601 datetime
Timestamp of the rollback mutation.
Next steps
Use template IDs in render flows
Need the render contract?
Open single render reference
Use the single render page for templateId, templateVersionId, data, and accepted-work behavior.
Need real examples?
Open render-from-template guide
Use the guide for template data examples, saved-template workflow, and version-pinned render requests.