claude-memory/graph/code-patterns/pattern-n8n-rest-api-workflow-activation-sequence-de4a3c.md

1.4 KiB

id type title tags importance confidence created updated
de4a3c65-6eb5-4f73-ad69-685dba0a7847 code_pattern Pattern: N8N REST API workflow activation sequence
n8n
api
workflow-activation
rest-api
code_pattern
0.65 0.8 2026-03-01T15:58:51.499347+00:00 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