Backup n8n Workflows With Versioning
Backs up n8n workflows to a destination instance with date-prefixed versions and logs execution stats to Notion.
What it does
Copies n8n workflows from a source instance to a destination using the n8n API. It prefixes each workflow name with the current date to maintain version history and applies a rolling retention policy to delete old versions. The process logs execution details such as the date and number of processed workflows into a central Notion database.
Step by step
- Use the n8n GET /workflows endpoint to retrieve all workflow IDs and metadata.
- Construct a new payload by prepending the current ISO date string to the original workflow name field.
- Send the modified payload via POST /workflows to create the versioned copy in the destination instance.
- Append execution logs including timestamp and count to the designated Notion database using its API.
Where the LLM does the work
- Generate a robust date formatting string that ensures consistent sorting when listing workflow versions.
- Draft the logic for calculating which older versions exceed the retention window based on the prefix dates.
- Create clear error messages for failed API calls to aid in debugging connection issues between instances.
Watch out for
Tools that fit
The agent brief
You are helping me build the following AI agent workflow. ## Goal Backup n8n Workflows With Versioning: Backs up n8n workflows to a destination instance with date-prefixed versions and logs execution stats to Notion. ## Specification - What it does: Copies n8n workflows from a source instance to a destination using the n8n API. It prefixes each workflow name with the current date to maintain version history and applies a rolling retention policy to delete old versions. The process logs execution details such as the date and number of processed workflows into a central Notion database. - Trigger: On a schedule (Manual · on demand) - Autonomy: Fully hands-off - Expected setup effort: about an afternoon - Tools/services involved: - n8n API: Copy workflows between instances - Notion: Track execution date and workflow count ## Known pitfalls, handle each one explicitly in your implementation 1. Destination workflows might conflict with existing IDs if not handled carefully, so ensure the create endpoint is used rather than update to avoid overwriting active flows. 2. Notion database schema changes can break log entries, so validate column types before appending new data rows. 3. Date prefixing may cause sorting issues in Notion views, so format dates as YYYY-MM-DD to guarantee chronological order. ## Reference implementation https://n8n.io/workflows/6947 (workflow template) Fetch and inspect this before building. If it matches my stack, adapt it; if not, rebuild the pattern with my tools. ## Process requirements 1. Before building: ask me which of the listed tools I actually use and what my platform is (n8n / Make / code / other). Do not assume. 2. Adapt the pattern to my answers; do not force the reference stack. 3. Address every pitfall above; tell me how you handled each. 4. Provide a test plan I can run before letting this touch real data. 5. Ask before any step that sends messages, modifies data, or spends money. Source: https://usecasesforagents.com/use-case/backup-n8n-workflows-with-versioning/ via usecasesforagents.com
Frequently asked questions
Can I use a different Notes & Docs than Notion?
Yes. Notion is only the example notes & docs in this recipe. The same flow works with Figma, Google Docs, Google Slides and Microsoft SharePoint. Swap the notes & docs connection and keep the rest of the setup as written.
Want this running in your business?
Who it's for
Built for developers who want the busywork around code automated, not the code itself.