Clean Up Old n8n Executions Automatically

This n8n workflow helps you automatically delete old workflow executions older than 10 days from your n8n instance, preventing clutter and improving performance. Scheduled and manual triggers ensure flexibility and efficiency.
n8n
if
manualTrigger
+2
Workflow Identifier: 2488
NODES in Use: Manual Trigger, n8n, If, Schedule Trigger, No Operation
Clean Up n8n Executions with n8n

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow automatically deletes workflow executions older than 10 days in an n8n instance.

It helps clear old execution logs, stopping the system from slowing down.

Users get a clean dashboard and better performance without manual cleanup.


Who should use this workflow

Anyone running many workflows in n8n with growing execution logs.

Especially useful for teams wanting to keep the system fast and clean.

This works on self-hosted n8n or n8n Cloud with API access.


Tools and services used

  • n8n manual trigger node: For testing the cleanup anytime.
  • n8n schedule trigger node: Runs cleanup daily at 04:44 AM.
  • n8n API node: Lists and deletes workflow executions using the API.
  • If node: Checks if executions are older than 10 days.
  • No Operation node: Handles cases with no executions to delete.

Beginner step-by-step: How to use this workflow in n8n

1. Import the workflow

  1. Click the Download button on this page to get the workflow file.
  2. Inside your n8n editor, click “Import from File” and upload the downloaded workflow.

2. Set up credentials and IDs

  1. Add your valid n8n API credentials in the credentials manager.
  2. In the API nodes, select the added API credentials.
  3. Check if the workflow IDs or any other dynamic fields like emails or channels need updating, and update as needed.

3. Test the workflow

  1. Run the workflow manually using the Manual Trigger to check if old executions are deleted.
  2. Look at the execution list to confirm cleanup works as expected.

4. Activate the workflow

  1. Once tested, click Activate in n8n editor to run cleanup automatically on schedule.
  2. Make sure to keep API credentials active to avoid errors.
  3. If you use self-host n8n, see self-host n8n for more setup help.

How the workflow works: Input → Process → Output

Inputs

  • User triggers from Manual Trigger or Schedule Trigger at 04:44 daily.

Processing steps

  • n8n API node requests all current workflow executions.
  • If node checks each execution’s startedAt date.
  • If date is before 10 days ago, node passes execution to delete.
  • n8n API node deletes each matching execution by its ID.
  • If no executions are older than 10 days, No Operation node runs to avoid errors.

Output

  • Old workflow executions deleted from n8n.
  • Execution list and dashboard cleaned.
  • System performance preserved.

Customization ideas

  • Change days threshold in the If node by editing the date comparison to any number of days.
  • Modify cleanup time in the Schedule Trigger to run at your preferred hour.
  • Add email or Slack notifications after deletion using communication nodes.
  • Filter executions by workflow ID or status by adjusting the API call parameters.
  • Log number of deleted executions with a Code or Set node for audit tracking.

Troubleshooting common issues

  • Issue: No executions deleted but workflow runs.
    Cause: No executions older than 10 days found.
    Fix: Double check date filter in If node. Use older test executions.
  • Issue: API node call fails.
    Cause: API credentials wrong or expired.
    Fix: Refresh API credentials in n8n credential manager.
  • Issue: Delete node executionId undefined.
    Cause: Wrong data mapping from previous node.
    Fix: Check dynamic value set as {{ $json.id }} in delete node.

Pre-production checklist

  • Verify n8n API Key has execution management rights.
  • Run workflow using Manual Trigger to confirm deletions.
  • Confirm scheduled runs trigger at set time.
  • Backup execution data before enabling automated cleanup.

Deployment guide

After testing successfully, activate the workflow in n8n editor.

The cleanup now runs daily at chosen time without manual action.

Keep API credentials fresh and monitor workflow run logs for issues.

Summary of results

✓ Deletes executions older than 10 days automatically.

✓ Keeps workflow dashboard clean and responsive.

✓ Saves time by removing manual cleanup steps.

✓ Can run on-demand or scheduled daily.

✓ Protects system performance for all users.

Clean Up n8n Executions with n8n

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Yes, update the date condition in the If node to check 30 days old executions instead.
Yes, deleted executions no longer appear in the history or audit trail.
Yes, adding an Email node after deleting executions can send notification emails.
Yes, it works well with valid API credentials and scheduled cleanup.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.