Clean up archived workflows with the n8n API on a schedule
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-12-01.
What this workflow does
This workflow has 11 nodes and runs on a schedule (every day at 09:00). It uses only n8n's built-in nodes.
How it runs
Trigger: On a schedule (every day at 09:00).
- config (Edit Fields (Set)): sets 6 fields: retention_days, dry_run, project_id…
- get_workflows (n8n): uses n8n
- Filter: keeps only the items that match a condition
- select_candidates (Code): runs custom JavaScript code
- has_candidates (If): checks a condition and branches into true / false
- validation_error (Stop and Error): stops the run with an error
- dry_run (If): checks a condition and branches into true / false
- cleanup_summary (Code): runs custom JavaScript code
- split_candidates (Split Out): splits a list into separate items
- delete_workflows_in_batches (n8n): delete
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Check at runtime on n8n 3.0
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (8)
- n8n
n8n-nodes-base.n8n - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Split Out
n8n-nodes-base.splitOut - Stop and Error
n8n-nodes-base.stopAndError - Filter
n8n-nodes-base.filter
From the author
Quick overview This workflow runs daily and uses the n8n API to find archived workflows older than a retention threshold, optionally deleting unprotected ones in batches while producing a detailed preview or deletion summary. How it works 1. Runs every day at…