workflows.fit
Back to n8n workflows
n8n templateFreeBy Arlin Perez

Automated execution cleanup system with n8n API and custom retention rules

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

DevelopmentCore NodesSchedule TriggerN8nCodeSticky Note
Loading interactive preview...

Template notes

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 usage and improves UI responsiveness, using only official n8n nodes.

🔍 Description Automatically clean up old executions in your n8n instance using only official nodes — no external database queries required. Whether you're on the Cloud version or running self-hosted, this workflow helps you optimize performance and keep your instance tidy by maintaining only the most recent executions per workflow.

Ideal for users managing dozens or hundreds of workflows, this solution reduces storage usage and improves the responsiveness of the n8n UI, especially in environments where execution logs can accumulate quickly.

✅ What It Does Retrieves up to 250 recent executions across all workflows Groups executions by workflow Keeps only the most recent N executions per workflow (value is configurable) Deletes all older executions (regardless of their status: success, error, etc.) Works entirely with native n8n nodes — no external database access required Optionally: set the number of executions to keep as 0 to delete all past executions from your instance in a single run

🛠️ How to Set Up 🔑 Create a Personal API Key in your n8n instance: Go to Settings → API Keys → Create a new key

🔧 Create a new n8n API Credential (used by both nodes): In your n8n credentials panel:

Name: anything you like (e.g., “Internal API Access”)

API Key: paste the Personal API Key you just created