Templates / Automated execution cleanup system with n8n API and custom retention rules

Automated execution cleanup system with n8n API and custom retention rules

Ready for 3.0

by Arlin Perez ✓ · 1,507 views · created 2025-08-02 · 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-10-19.

What this workflow does

This workflow has 5 nodes and runs on a schedule (every day at 02:00). It uses only n8n's built-in nodes.

How it runs

Trigger: On a schedule (every day at 02:00).

  1. Get many executions (n8n): work with execution
  2. Set Executions to Keep (Edit Fields (Set)): sets 1 field: executionsToKeep
  3. Code: runs custom JavaScript code
  4. Delete an execution (n8n): delete (execution)

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.

Nodes used (4)

From the author

Make your n8n instance faster, cleaner, and more efficient by deleting old workflow executions — while keeping only the most recent ones you actually need. Whether you're using n8n Cloud or self-hosted, this lightweight workflow helps reduce database/storage…

Excerpt from Arlin Perez'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.