Skip to main content

Templates

Scene templates are pre-built scene and block structures that can be applied to new episodes to speed up episode creation. They are separate from the assignment template (which deals with creator roles and workflow stages).

Endpoints overview

MethodEndpointPermissionDescription
GET/api/templatesauthenticatedList active templates
GET/api/templates/allauthenticatedList all templates
GET/api/templates/:idauthenticatedGet template by ID
POST/api/templatestemplate:createCreate a template
PUT/api/templates/:idtemplate:editUpdate a template
DELETE/api/templates/:idtemplate:deleteDelete a template
POST/api/templates/:id/scenestemplate:editAdd scene to template
PUT/api/templates/:id/scenes/:sceneIdtemplate:editUpdate template scene
DELETE/api/templates/:id/scenes/:sceneIdtemplate:editDelete template scene
POST/api/templates/:id/scenes/:sceneId/blockstemplate:editAdd block to template scene
PUT/api/templates/:id/scenes/:sceneId/blocks/:blockIdtemplate:editUpdate template block
DELETE/api/templates/:id/scenes/:sceneId/blocks/:blockIdtemplate:editDelete template block

Template Endpoints

List active templates

GET /api/templates — Auth required

Returns only templates with isActive: true — used to populate the episode creation picker.

Response200

[
{
"id": "tpl-uuid-001",
"name": "Standard 3-Act Episode",
"nameI18n": { "uk": "Стандартний 3-актний епізод", "en": "Standard 3-Act Episode", "es": "Episodio estándar de 3 actos" },
"description": "Setup, confrontation, and resolution scenes.",
"descriptionI18n": { "uk": "Вступ, конфлікт та розв'язка.", "en": "Setup, confrontation, and resolution scenes.", "es": "Configuración, confrontación y resolución." },
"category": "Drama",
"categoryI18n": { "uk": "Драма", "en": "Drama", "es": "Drama" },
"icon": "🎭",
"isActive": true,
"createdAt": "2025-01-05T09:00:00.000Z",
"scenes": [
{
"id": "ts-uuid-001",
"templateId": "tpl-uuid-001",
"title": "Setup",
"titleI18n": { "uk": "Вступ", "en": "Setup", "es": "Configuración" },
"mood": "neutral",
"index": 0,
"blocks": [
{
"id": "tb-uuid-001",
"templateSceneId": "ts-uuid-001",
"type": "action",
"placeholderTextI18n": { "uk": "Опишіть вступну дію", "en": "Describe the opening action", "es": "Describe la acción inicial" },
"hintI18n": { "uk": "Де відбувається дія?", "en": "Where does the action take place?", "es": "¿Dónde ocurre la acción?" },
"index": 0
}
]
}
]
}
]

List all templates

GET /api/templates/all — Auth required

Returns all templates including archived ones (isActive: false).

Response200 — same array shape as active list


Get template by ID

GET /api/templates/:id — Auth required

Response200 — single template object (same shape as list item)

Returns 404 if not found.


Create template

POST /api/templates — Auth required, Permission: template:create

Request body

{
"name": "Standard 3-Act Episode",
"description": "Setup, confrontation, and resolution scenes.",
"icon": "🎭",
"category": "Drama",
"isActive": true
}
FieldRequiredNotes
nameyesAuto-translated
descriptionnoAuto-translated if provided
iconnoDefaults to 📄
categorynoAuto-translated if provided
isActivenoDefaults to true

Response201 — created template object


Update template

PUT /api/templates/:id — Auth required, Permission: template:edit

Request body (all fields optional)

{
"name": "Updated Template Name",
"description": "Updated description.",
"icon": "🎬",
"category": "Comedy",
"isActive": false
}

Response200 — updated template object


Delete template

DELETE /api/templates/:id — Auth required, Permission: template:delete

Response204


Template Scene Endpoints

Add scene to template

POST /api/templates/:id/scenes — Auth required, Permission: template:edit

Request body

{
"title": "Setup",
"mood": "neutral",
"index": 0
}
FieldRequiredNotes
titleyesAuto-translated
moodnoDefaults to ""
indexnoDisplay order; defaults to 0

Response201

{
"id": "ts-uuid-002",
"templateId": "tpl-uuid-001",
"title": "Setup",
"titleI18n": { "uk": "Вступ", "en": "Setup", "es": "Configuración" },
"mood": "neutral",
"index": 0,
"blocks": []
}

Update template scene

PUT /api/templates/:id/scenes/:sceneId — Auth required, Permission: template:edit

Request body (all fields optional)

{
"title": "Introduction",
"mood": "cheerful",
"index": 1
}

Response200 — updated template scene object


Delete template scene

DELETE /api/templates/:id/scenes/:sceneId — Auth required, Permission: template:edit

Response204


Template Block Endpoints

Add block to template scene

POST /api/templates/:id/scenes/:sceneId/blocks — Auth required, Permission: template:edit

Request body

{
"type": "dialog",
"placeholderText": "Opening line from protagonist",
"hint": "Keep it short and punchy",
"index": 0
}
FieldRequiredNotes
typenodialog | action; defaults to "action"
placeholderTextyesAuto-translated
hintnoAuto-translated if provided
indexnoDisplay order; defaults to 0

Response201

{
"id": "tb-uuid-002",
"templateSceneId": "ts-uuid-002",
"type": "dialog",
"placeholderTextI18n": { "uk": "Перша репліка протагоніста", "en": "Opening line from protagonist", "es": "Línea inicial del protagonista" },
"hintI18n": { "uk": "Коротко і чітко", "en": "Keep it short and punchy", "es": "Breve y contundente" },
"index": 0
}

Update template block

PUT /api/templates/:id/scenes/:sceneId/blocks/:blockId — Auth required, Permission: template:edit

Request body (all fields optional)

{
"type": "action",
"placeholderText": "Describe what happens",
"hint": null,
"index": 1
}

Response200 — updated template block object


Delete template block

DELETE /api/templates/:id/scenes/:sceneId/blocks/:blockId — Auth required, Permission: template:edit

Response204