n8n

How to Automate n8n Execution Cleanup?

Keep your n8n instance tidy by removing old or failed runs on a set schedule. This helps admins and ops teams control storage, speed up maintenance, and avoid manual cleanups.

Two triggers start the flow. A schedule trigger runs at your chosen time, and a manual trigger lets you test safely. The n8n API node lists all executions and sends them to a filter. An If node checks each run against your rules, like status or age. Matches go to a delete action that removes each execution by its id. Items that do not match are sent to a no operation step, so nothing happens to them.

Setup is simple. Create an n8n credential for the n8n API nodes, set your schedule, and define your delete rules in the If node. Expect less clutter, fewer errors, and faster admin work. Great for auto clearing failed runs, purging old successes after backups, or keeping a lean history on shared instances.

What are the key features?

  • Schedule Trigger runs the cleanup at a set time each day
  • Manual Trigger lets you test the flow before turning it on
  • n8n API node lists all executions for review and filtering
  • If node filters runs by status, age, or other fields you choose
  • Delete node removes each matching execution using its id
  • No Operation node safely captures items you want to keep

What are the benefits?

  • Reduce manual cleanup from 30 minutes to 2 minutes per day
  • Automate 100 percent of deletions that match your rules
  • Cut storage used by old runs by up to 70 percent over time
  • Eliminate human delete mistakes by using one clear filter
  • Handle 5 to 10 times more daily runs before hitting limits

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. Open the n8n list execution node, click Credentials, select 'Create new credential', then follow the on screen steps to connect your n8n account. Name it clearly so you can reuse it.
  3. Open the delete execution node and choose the same n8n credential you created. This keeps both nodes using one secure connection.
  4. Set the Schedule Trigger to your preferred time and timezone. If your server time differs from local time, adjust the hour and minute to match your plan.
  5. Configure the If node to pick what to delete. Choose a field like status to target failed runs, or use a date field like startedAt to remove items older than a set number of days.
  6. Confirm the delete execution node uses the expression {{$json.id}} for the executionId so each matched run is removed correctly.
  7. Run a manual test. Check the If node outputs to see how many items match your rule. Make sure only the intended runs go to the true path.
  8. If you want a dry run, temporarily disable the delete execution node and review the true path items. Re enable it once your filters look right.
  9. Turn the workflow on. Let it run for a day and then review your execution list to confirm that old or failed runs are being removed as planned.
  10. Troubleshoot common issues: If you see 401 or 403 errors, recheck the n8n credential and user permissions. If nothing is deleted, adjust the If conditions. If timing feels off, verify the schedule timezone.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.