Automated Execution Cleanup System with n8n API and Custom Retention Rules - n8n Workflow | Neura Market

    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 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 Base URL: your full n8n instance URL with the /api/v1 path, e.g. https://your-n8n-instance.com/api/v1 - Use this credential in both: The Get Many Executions node (to fetch recent executions) The Delete Many Executions node (to remove outdated executions) - In the "Set Executions to Keep" node: Edit the variable executionsToKeep and set the number of most recent executions to retain per workflow (e.g., 10) Tip: Set it to 0 to delete all executions - Note: The "Get Many Executions" node will retrieve up to 250 executions per run - this is the maximum allowed by the n8n API. No further setup is required - the filtering and grouping logic is handled inside the Code Node automatically. ## Included Nodes Overview - Schedule Trigger - Set to run daily, weekly, etc. - Get Many Executions - Fetches past executions via n8n API - Set Executions to Keep - Set how many recent ones to keep - Code Node - Filters out executions to delete per workflow - Delete Executions - Deletes outdated executions ## Why Use This? Reduce clutter and improve performance in your n8n instance Maintain execution logs only when they're useful Avoid bloating your storage or database with obsolete data Compatible with both n8n Cloud and self-hosted setups Uses only official, supported n8n nodes - no SQL, no extra setup **Note:** This workflow modifies and deletes execution data. Always review and test it first on a staging instance or on a limited set of workflows before using it in production.

    Platform
    n8n
    Category
    Business Operations & ERPs
    Price
    Free
    Creator
    Arlin Perez
    • n8n
    • set
    • code
    • stickyNote
    • scheduleTrigger
    Back to MarketplaceMore n8n Workflows

    How to import this workflow into n8n

    1. 1Purchase or download the workflow to get the n8n workflow JSON file.
    2. 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
    3. 3Open each node marked with a credential warning and connect your own accounts and API keys.
    4. 4Run the workflow once manually to verify the data flow, then toggle it to Active.

    Related Business Operations & ERPs workflows

    • Automate Job Applications and Track Status with LinkedIn, Indeed, and Google SheetsFree
    • Automated Stock Price Monitoring and Alerts for Indian & US Markets
    Free
  1. Build Custom Workflows Automatically with GP-4.0, RAG, and Web SearchFree
  2. AI Chat Agent Receptionist for Clinics$150
  3. Automatically Archive Zoom Recordings to Google Drive and Log in AirtableFree
  4. Automate Call Scheduling with Voice AI Receptionist Using Twilio, Google Calendar & AirtableFree
  5. More from Arlin Perez

    • Categorize and Label Incoming Gmail Emails Automatically with GP-40 Mini
    All Business Operations & ERPs workflows →All n8n workflows →

    Need help customizing this workflow?

    Our automation experts adapt it to your exact stack, data, and process — or build one from scratch.

    Get a Custom Build
    Neura Market
    Neura Market
    Marketplace
    Directories
    Resources

    Marketplace

    • Prompts
    • Workflows
    • Agents Store
    • Workflow Packs
    • Categories
    • Marketplace

    Directories

    • AI Tools Directory
    • ChatGPT
    • Claude
    • Gemini
    • Cursor
    • Grok
    • DeepSeek
    • Perplexity
    • CoPilot
    • Midjourney
    • Stable Diffusion
    • MCP Servers
    • .md Directory
    • All Directories

    Free Tools

    • AI Text Humanizer
    • AI Content Detector
    • Workflow Generator
    • Model Comparison
    • AI Pricing Calculator
    • AI Benchmarks
    • ROI Calculator
    • All Free Tools

    Resources

    • AI News
    • Blog
    • AI Models
    • Integrations
    • Alternatives
    • n8n vs Zapier
    • Make vs Zapier
    • n8n vs Make
    • Resource Library
    • Documentation

    Community

    • AI Jobs
    • AI Events
    • AI Companies
    • Start Selling
    • Sell n8n Workflows
    • Sell AI Agents
    • Sell Prompts
    • Creator Guide
    • Advertise
    • Affiliates

    Company

    • About
    • Contact
    • Help
    • Careers
    • Pricing
    • Terms
    • Privacy
    • License
    • DMCA

    Stay Updated

    Get the latest AI tools and insights delivered to your inbox.

    Neura Market Logoneuramarket

    © 2026 Neura Market. All rights reserved.