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
- Click the Download button on this page to get the workflow file.
- Inside your n8n editor, click “Import from File” and upload the downloaded workflow.
2. Set up credentials and IDs
- Add your valid n8n API credentials in the credentials manager.
- In the API nodes, select the added API credentials.
- Check if the workflow IDs or any other dynamic fields like emails or channels need updating, and update as needed.
3. Test the workflow
- Run the workflow manually using the Manual Trigger to check if old executions are deleted.
- Look at the execution list to confirm cleanup works as expected.
4. Activate the workflow
- Once tested, click Activate in n8n editor to run cleanup automatically on schedule.
- Make sure to keep API credentials active to avoid errors.
- 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
startedAtdate. - 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.

