Templates / Clean up archived workflows with the n8n API on a schedule

Clean up archived workflows with the n8n API on a schedule

Ready for 3.0

by Alvaro Pérez ✓ · 3 views · created 2026-07-27 · DevOps

Ready 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.

📬 Weekly n8n 3.0 breakage alerts, free

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).

  1. config (Edit Fields (Set)): sets 6 fields: retention_days, dry_run, project_id…
  2. get_workflows (n8n): uses n8n
  3. Filter: keeps only the items that match a condition
  4. select_candidates (Code): runs custom JavaScript code
  5. has_candidates (If): checks a condition and branches into true / false
  6. validation_error (Stop and Error): stops the run with an error
  7. dry_run (If): checks a condition and branches into true / false
  8. cleanup_summary (Code): runs custom JavaScript code
  9. split_candidates (Split Out): splits a list into separate items
  10. 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.
Informational: a static scan can't see the data, so test these on your own instance. Status above is unchanged.

Nodes used (8)

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…

Excerpt from Alvaro Pérez's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.