Update Template

Update a template owned by the caller's workspace. All fields are optional (omit to keep the stored value). When `definition` is supplied it is a full replace — send the complete graph, not a partial diff. Structural validation runs on write, same as `POST /templates`. Restrictions: - Only the owning workspace may update its templates (403 otherwise). - Platform starter templates (`is_starter=true`) are read-only via this endpoint regardless of workspace ownership (403). - Updates apply only to the draft/live definition; the published gallery snapshot is not updated until an admin republishes. Requires workspace `editor` role or higher.

Authentication

AuthorizationBearer
Clerk JWT token

Path parameters

template_idstringRequiredformat: "uuid"

Headers

X-Workspace-Idstring or nullOptional

Request

This endpoint expects an object.
namestring or nullOptional1-200 characters
descriptionstring or nullOptional<=2000 characters
categoryenum or nullOptional
definitionobject or nullOptional

Full-replace on PATCH. Omit to keep the stored value. Explicit null is rejected — there is no ‘empty graph’ use-case worth the ambiguity. The union with null here only makes omission easy for FE clients; see reject_null_definition for the runtime guard.

Response

Successful Response
dataobject

Response shape. workspace_id is intentionally omitted so the gallery endpoint (which returns rows from any workspace) does not leak tenant ownership IDs across tenants. created_by is retained as author provenance for public/starter rows.

definition is the serialized WorkflowDefinition JSONB (same shape as Workflow.definition) — a template is a reusable workflow snapshot.

metaobject

Errors

422
Unprocessable Entity Error