Skip to main content

Instantiate Workflow Template

POST 

/api/automation/workflow-templates/:slug/instantiate

Creates a new draft workflow from the template. The server deep-copies the template's workflow_json, applies each parameters[key] value at its declared path (from the template's parameterPrompts), then persists via WorkflowManager::createDraft. The template row itself is never mutated.

Validation (InstantiateWorkflowTemplateRequest):

  • name — sometimes, string, max 128. If omitted, the template's name is used.
  • parameters — sometimes, array. Keys must match parameterPrompts[*].key from the template; any unknown keys are silently ignored (defense against arbitrary-path injection). Missing required prompts are NOT enforced here — the wizard is responsible for collecting them before publish. Values can be strings, booleans, integers, or credential UUIDs depending on the prompt type.

Behaviour notes:

  • The created workflow is a draft (status = draft). Publishing is a separate explicit step (POST /api/automation/workflows/{workflow}/publish).
  • The draft's settings.instantiated_from_template stores { slug, version } for drift tracking.
  • trigger_type is re-derived from the first trigger node by WorkflowManager::createDraft; do NOT pass it in.

Response: 201 Created with a WorkflowResource (same shape as POST /api/automation/workflows):

{
"data": {
"id": "42",
"uuid": "...",
"name": "My FTP Product Import",
"description": "Polls an FTP directory every hour...",
"status": "draft",
"version": 1,
"category": "imports",
"graph": {
"nodes": [ ... ],
"edges": [ ... ],
"viewport": { "x": 0, "y": 0, "zoom": 1 }
},
"settings": {
"instantiated_from_template": { "slug": "import-products-ftp-hourly", "version": 1 }
},
"triggerType": "webhook",
"triggerConfig": null,
"createdAt": "2026-04-16T12:34:56+00:00",
"updatedAt": "2026-04-16T12:34:56+00:00",
"publishedAt": null,
"createdBy": "Jane Doe",
"updatedBy": "Jane Doe"
}
}

Errors:

  • 404 Not Found — unknown slug.
  • 422 Unprocessable Entity — validation failure (e.g. name longer than 128 chars).
    \{ "message": "Workflow name must be 128 characters or fewer", "errors": \{ "name": ["Workflow name must be 128 characters or fewer"] \} \}

Route name: automation.templates.instantiate

Request

Responses

Successful response