Template Management

Survey template lifecycle including creation, publishing, versioning, permissions, and import/export

Overview

Survey templates provide reusable survey structures that can be used as starting points for new surveys. Templates include question structure, validation rules, calendar rules, and metadata.

Template Lifecycle

Draft ──► Published ──► Deprecated
  │                        │
  └── (editable)      Archived
StateDescription
DraftIn creation, only author/editors can see
PublishedAvailable for use when creating surveys
DeprecatedStill exists but hidden from new survey creation
ArchivedRemoved from active use, retained for history

Creating Templates

POST /templates
{
  "name": "Patient Follow-up Survey",
  "category_id": "cat-uuid",
  "schema": { /* full survey schema */ },
  "description": "Standard patient follow-up template",
  "is_public": true
}

Creating a Survey from a Template

POST /templates/{id}/create-survey
{
  "name": "Q1 2026 Patient Follow-up",
  "workspace_id": "ws-uuid"
}

# Copies schema, resets published state to draft

Template Categories

GET /template-categories
# Returns grouped templates for the UI

POST /template-categories
{
  "name": "Healthcare",
  "icon": "heart-pulse",
  "order": 1
}

Versioning

Templates support versioning, allowing users to update a template without breaking existing surveys created from it:

# When template is updated, existing surveys keep the old version
# New surveys use the new version

Permissions

RoleDraftPublishedDeprecatedArchive
Template AdminCreate/EditPublishDeprecateArchive
EditorCreate/Edit———
ViewerViewView——
User—Use——

Import/Export

# Export template as JSON
GET /templates/{id}/export

# Import template from JSON
POST /templates/import
Content-Type: application/json

{ "schema": { ... }, "name": "Imported Template" }