⚙️ Set default error workflows across all workflows via the n8n API
⚡ 18 views · ⚙️ DevOps & CI/CD
Description
Quick overview
This workflow runs nightly (or on demand) and uses the n8n public API to scan all workflows, then sets a shared default error workflow for eligible ones while preserving existing settings and skipping excluded, archived, or already-configured workflows.
How it works
- Runs every night at 01:00 or when you manually execute the workflow.
- Calls the n8n REST API to fetch all workflows, following cursor-based pagination to cover every page.
- Filters the list to workflows that are not archived, are not tagged with the configured exclusion tag, are not the error workflow itself, and (optionally) have no error workflow set yet.
- Iterates through the remaining workflows in batches.
- Updates each workflow via the n8n REST API to set
settings.errorWorkflowto the configured workflow ID while keeping the existing name, nodes, connections, and other settings intact. - Waits briefly between updates to throttle requests and then finishes after all workflows are processed.
Setup
- Create an n8n API key and add it as an HTTP Header Auth credential (for example using the X-N8N-API-KEY header), then select that credential in both HTTP Request nodes.
- In the Configuration step, set
n8n_base_urlto your instance URL anderror_workflow_idto the ID of the workflow you want as the default error handler. - Adjust
only_fill_emptyandexclusion_tagto control whether existing error handlers are overwritten and which workflows are skipped.
🔗 Nodes Used
HTTP Request, Schedule Trigger, Filter
📥 Import
Download workflow.json and import into n8n:
Workflow menu → Import from File