store: Pattern: N8N REST API workflow activation sequence

This commit is contained in:
Cal Corum 2026-03-01 09:58:51 -06:00
parent 12c39a1021
commit 860b2da319

View File

@ -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