Create Template

Create a new workflow template in the current workspace. The caller supplies a full `WorkflowDefinition` (graph + execution). Save-time validation (`validate_definition_save`) mirrors the `/api/v1/workflows` contract — duplicate node/edge IDs, port mismatches, and other structural errors fail at write time rather than surfacing when a caller later clones the template into a workflow.

Authentication

AuthorizationBearer
Clerk JWT token

Headers

X-Workspace-Idstring or nullOptional

Request

This endpoint expects an object.
namestringRequired1-200 characters
descriptionstring or nullOptional<=2000 characters
categoryenum or nullOptional
definitionobjectOptional

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