Workflow backup solution


I found couple of threads in the community explaining ways to backup workflows to google drive and/or airtables. But looks like these mechanisms use Rest APIs that are probably not public yet (please correct me if I am wrong).

Therefore, I am not sure what’s the best way to backup my workflows. I am looking for a reliable backup solution (periodic) either to github or anywhere else that’s known to work.

Any recommendations?

Thank you.

Hey @ronykris,

I use a modified version of this workflow: it uses the internal APIs to update the workflows in Github. I have it running every 2 hours, Another option you could use is to use the CLI tool which has export options so you can write a script (or a workflow) to run the tool, export the workflows then commit to git.


Awesome, thank you @Jon . Let me give it a try and revert.


If you go the CLI route, you can use the Execute Command node to run a script (or CLI commands directly) - so this way an n8n workflow can still power the backup process. Plus, since you have a workflow it’s then easy to add on things like a notification/ alert if the backup fails.


Hi, I’m trying to implement this in my self-hosted version of n8n, but in the “N8N Workflows” node, I’m getting the following error message: “Error: connect ECONNREFUSED”

I simply updated the URL to my n8n URL. Is there anything else that I need to do (e.g. set authentication)?


Confirmed, I’m getting the same error message. Some guidance would be great!

You have to change the workflow according to your need. So would you for example have to change the URL on the node “N8N Workflows”.
In the example it is set to http://localhost:8443/rest/workflows as the user who created the workflow is apparently running n8n on port 8443. In your case, it is more likely the n8n default port 5678 and the URL would so have to be changed to http://localhost:5678/rest/workflows.

I hope that resolves that problem.


I know this might sound like a simple question.

Do I need to provide Authorization to access the workflows on my own server?
(sounds a bit odd lol)

port 8443 - provided me with error message: “Error: connect ECONNREFUSED”
port “5678” - says: ERROR: UNKNOWN ERROR - check the detailed error for more information - Authorization is required!

Hey @David_Go,

You do indeed, So you will need to set Basic Auth and use the username / password you use to access your install. Image below shows how I have mine set up.



Works like magic :slight_smile:
Thank you @Jon


i’m doing the same as above, but getting unauthorised, using the same email and pwd that i use to login, any thoughts?

is this because of the new user management working differently?

Hey @RedPacketSec,

Yeah the new user management feature doesn’t use Basic auth, There is a version of the github backup solution that uses the CLI to export instead which you could use.

how does it work so we can utilise the API?

Hey @RedPacketSec,

If you want to use the internal API you would need to follow one of the approaches in this post: How to authenticate for REST API with Users management activated?

We are working on a supported public api at the moment though so it could be worth waiting a couple of weeks unless it is urgent.

Hi @Jon, I’ve got the AUTH portion working on this workflow, but having trouble getting the Function node to parse out the status (same, edit, new). I think the issue is that now the output contains new information (tags) and maybe new key names, so the function is not working correctly. Any chance someone could play with it? This is my favorite Workflow :laughing:

Are you using the new public API, or the old internal one? I’ve updated mine to the public API, but was using the old one without change.

The main change I needed to make for the public API was changing from this:
var n8nWorkflow = (items[1];
to this
var n8nWorkflow = (items[1].json);

That worked! Thank you so much! I also needed to edit the github actions to remove the [data] key from all the name and file variations.

1 Like

@Jon, does this work with self-hosted Digital Ocean droplets? I can’t seem to get the authorisation to work:

I have tried with the n8n username and password for the authentication (the same one you need when you log in via the n8n web app).

Hey @pb84,

It does work with self hosted but the authentication is different now, If you are looking at doing backups I have updated the CLI option so it uses the public API instead which may be easier. You can find it here: Back Up Your n8n Workflows To Github | n8n workflow template

1 Like