From 860b2da3194293258ab2fa92ff3f6b48edd3f881 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sun, 1 Mar 2026 09:58:51 -0600 Subject: [PATCH] store: Pattern: N8N REST API workflow activation sequence --- ...api-workflow-activation-sequence-de4a3c.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 graph/code-patterns/pattern-n8n-rest-api-workflow-activation-sequence-de4a3c.md diff --git a/graph/code-patterns/pattern-n8n-rest-api-workflow-activation-sequence-de4a3c.md b/graph/code-patterns/pattern-n8n-rest-api-workflow-activation-sequence-de4a3c.md new file mode 100644 index 00000000000..56a7783a4df --- /dev/null +++ b/graph/code-patterns/pattern-n8n-rest-api-workflow-activation-sequence-de4a3c.md @@ -0,0 +1,52 @@ +--- +id: de4a3c65-6eb5-4f73-ad69-685dba0a7847 +type: code_pattern +title: "Pattern: N8N REST API workflow activation sequence" +tags: [n8n, api, workflow-activation, rest-api, code_pattern] +importance: 0.65 +confidence: 0.8 +created: "2026-03-01T15:58:51.499347+00:00" +updated: "2026-03-01T15:58:51.499347+00:00" +--- + +# N8N REST API Workflow Activation Pattern + +## Use Case +When you need to update and activate an n8n workflow programmatically (e.g., after MCP corruption recovery, or scripted deployments). + +## Steps + +### 1. Fetch current workflow +``` +GET /api/v1/workflows/{id} +``` + +### 2. PUT with clean body +``` +PUT /api/v1/workflows/{id} +Body: { name, nodes, connections, settings } +``` + +**`settings` must only include standard fields:** +- `executionOrder` +- `timezone` +- `callerPolicy` + +Custom/non-standard settings (e.g., `timeSavedMode`) cause "additional properties" validation errors. + +**Omit all read-only fields from the PUT body:** +- `id`, `active`, `createdAt`, `updatedAt`, `shared`, `meta` + +### 3. Activate separately +``` +POST /api/v1/workflows/{id}/activate +``` + +The `active` field is read-only on PUT — activation must be done via the dedicated `/activate` endpoint. + +## Notes +- This pattern is the recovery path when MCP partial updates corrupt a workflow +- Always GET first to ensure node definitions match what's installed + +## Tags +n8n, api, workflow-activation, rest-api