# Workflow backup solution

**URL:** <https://community.n8n.io/t/workflow-backup-solution/9527>\
**Category:** Questions\
**Created:** [November 30, 2021, 12:40pm UTC](https://community.n8n.io/t/workflow-backup-solution/9527 "2021-11-30T12:40:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronykris](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ronykris/32/4777_2.png) [@ronykris](https://community.n8n.io/u/ronykris)\
**Post date:** [November 30, 2021, 12:40pm UTC](https://community.n8n.io/t/workflow-backup-solution/9527/1 "2021-11-30T12:40:36Z")

</div>

Hi,

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.

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [November 30, 2021, 12:45pm UTC](https://community.n8n.io/t/workflow-backup-solution/9527/2 "2021-11-30T12:45:20Z")

</div>

Hey @ronykris,

I use a modified version of this workflow: [https://n8n.io/workflows/817](https://n8n.io/workflows/817) 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](https://docs.n8n.io/reference/start-workflows-via-cli.html) which has export options so you can write a script (or a workflow) to run the tool, export the workflows then commit to git.

---

<div class="post-metadata">

**Author:** ![ronykris](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ronykris/32/4777_2.png) [@ronykris](https://community.n8n.io/u/ronykris)\
**Post date:** [November 30, 2021, 2:57pm UTC](https://community.n8n.io/t/workflow-backup-solution/9527/3 "2021-11-30T14:57:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![maxT](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/maxt/32/31233_2.png) [@maxT](https://community.n8n.io/u/maxT)\
**Post date:** [November 30, 2021, 4:27pm UTC](https://community.n8n.io/t/workflow-backup-solution/9527/4 "2021-11-30T16:27:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![richardjlo](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/richardjlo/32/2382_2.png) [@richardjlo](https://community.n8n.io/u/richardjlo)\
**Post date:** [January 5, 2022, 10:08pm UTC](https://community.n8n.io/t/workflow-backup-solution/9527/5 "2022-01-05T22:08:26Z")

</div>

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)?

Thanks!

---

<div class="post-metadata">

**Author:** ![bartv](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/bartv/32/156374_2.png) [@bartv](https://community.n8n.io/u/bartv)\
**Post date:** [January 29, 2022, 8:27am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/6 "2022-01-29T08:27:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [January 29, 2022, 10:24am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/7 "2022-01-29T10:24:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![David\_Go](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/david_go/32/8158_2.png) [@David\_Go](https://community.n8n.io/u/David_Go)\
**Post date:** [February 2, 2022, 9:09am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/8 "2022-02-02T09:09:39Z")

</div>

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)

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/8/8b79b2321604e2716e08333f54faaeb80ba429f0.png)

Note:  
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!

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [February 2, 2022, 9:36am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/9 "2022-02-02T09:36:06Z")

</div>

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.

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/b/b9a300d20e7c363f3c8f469c600e6abdabab7b17.png)

---

<div class="post-metadata">

**Author:** ![David\_Go](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/david_go/32/8158_2.png) [@David\_Go](https://community.n8n.io/u/David_Go)\
**Post date:** [February 2, 2022, 9:57am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/10 "2022-02-02T09:57:16Z")

</div>

Works like magic 🙂  
Thank you @Jon

---

<div class="post-metadata">

**Author:** ![RedPacketSec](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/redpacketsec/32/17523_2.png) [@RedPacketSec](https://community.n8n.io/u/RedPacketSec)\
**Post date:** [May 19, 2022, 7:55am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/11 "2022-05-19T07:55:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RedPacketSec](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/redpacketsec/32/17523_2.png) [@RedPacketSec](https://community.n8n.io/u/RedPacketSec)\
**Post date:** [May 19, 2022, 8:41am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/12 "2022-05-19T08:41:44Z")

</div>

is this because of the new user management working differently?

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [May 19, 2022, 8:57am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/13 "2022-05-19T08:57:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RedPacketSec](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/redpacketsec/32/17523_2.png) [@RedPacketSec](https://community.n8n.io/u/RedPacketSec)\
**Post date:** [May 20, 2022, 8:56am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/14 "2022-05-20T08:56:29Z")

</div>

how does it work so we can utilise the API?

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [May 20, 2022, 9:14am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/15 "2022-05-20T09:14:52Z")

</div>

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?](http://community.n8n.io/t/how-to-authenticate-for-rest-api-with-users-management-activated/12245)

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.

---

<div class="post-metadata">

**Author:** ![djangelic](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/djangelic/32/9237_2.png) [@djangelic](https://community.n8n.io/u/djangelic)\
**Post date:** [June 13, 2022, 11:40pm UTC](https://community.n8n.io/t/workflow-backup-solution/9527/16 "2022-06-13T23:40:36Z")

</div>

Hi @Jon, I’ve got the AUTH portion working [on this workflow](https://n8n.io/workflows/817), 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 😆

---

<div class="post-metadata">

**Author:** ![pemontto](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pemontto/32/2684_2.png) [@pemontto](https://community.n8n.io/u/pemontto)\
**Post date:** [June 14, 2022, 10:31am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/17 "2022-06-14T10:31:41Z")

</div>

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].json.data);`  
to this  
` var n8nWorkflow = (items[1].json);`

---

<div class="post-metadata">

**Author:** ![djangelic](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/djangelic/32/9237_2.png) [@djangelic](https://community.n8n.io/u/djangelic)\
**Post date:** [July 22, 2022, 10:21pm UTC](https://community.n8n.io/t/workflow-backup-solution/9527/18 "2022-07-22T22:21:07Z")

</div>

> [@pemontto](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![pb84](https://avatars.discourse-cdn.com/v4/letter/p/5fc32e/32.png) [@pb84](https://community.n8n.io/u/pb84)\
**Post date:** [September 21, 2022, 3:57am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/19 "2022-09-21T03:57:22Z")

</div>

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

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/5/c/5ce55c53ee8238b7c2b343a1e405d10214445e8c.png)

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).

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [September 21, 2022, 6:43am UTC](https://community.n8n.io/t/workflow-backup-solution/9527/20 "2022-09-21T06:43:31Z")

</div>

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](https://n8n.io/workflows/1534-back-up-your-n8n-workflows-to-github/)

[Next page](https://community.n8n.io/t/workflow-backup-solution/9527.md?page=2)
