Because it’s my first post, I use a line to say thank you. I love your tool. You are doing an amazing job.
I would like to find a way to backup my workflows.
I try to take inspiration by the template “Backs up n8n Workflows to GitHub” by hikerspath.
In this template, the list of workflows is taken from the unofficial REST API.
I saw in this message that it is an API without official documentation, neither a guarantee of continuation in the future.
I understood. But I try my question… just in case
I activated user management. So basic authentication, neither the workaround by pemontto seem to work.
Is there a way to call this API with the user credentials ?
Thank you so much for your help.
Information on your n8n setup
n8n version: 0.168.1
Database you’re using (default: SQLite): The one in the official Docker image
Running n8n with the execution process [own(default), main]: Don’t know
- Running n8n via [Docker, npm, n8n.cloud, desktop app]:
Welcome to the community
There are a couple of options, the quickest would be something like this: Credential unauthorized - #3 by pemontto
If you are on our Discord sever I posted another possible solution earlier today that would also do the job.
So here the explanation.
First step : login
Create a REQUEST Node.
- Authentication : None
- Request Method : POST
- URL : YOUR_URL/rest/login
- Add Option “Full Response” (do not forget to put it at true)
- Add 2 body parameters :
- Name : email, value : the email of the account
- Name : password, value : the password of the account
Next steps : authenticate your requests
In the next steps requesting your n8n server, add a header parameter :
- Name : Cookie (with upper C)
- Value : From the node Authentication, Output Data, JSON, header, set-cookie as Raw value (click on the grey circle next to set-cookie)
To finish, here the JSON to export your workflows in an array.
Please, note you should modify CHANGE_WITH_YOUR_URL, CHANGE_WITH_YOUR_EMAIL and CHANGE_WITH_YOUR_PASSWORD
Hi @JulienDelRio I know your question has already been answered, but maybe you might be interested in a variation on this workflow that I use to backup my workflows and credentials from my (macOS) Desktop App. This workflow runs every day at midnight, creating a new folder with date/timestamp in my n8n backups folder in my iCloud and copying all workflows and credentials … without the passwords …
As I’m using the Desktop App, my port number is 5679. So you might want to change that to 5678 in the http nodes. You will also need to specify your backup folder in the execute command node.
And the code:
Just to be complete, This is my new backup solution
It uses the CLI tool to export the worklfows to a folder then reads the files and saves to Github using the nodes, It mostly works the same as the old popular workflow backup it is just fetching the data that is different
I should change the title to “How to backup my workflows”
I suspect this post is going to be linked to a lot over the next couple of weeks
Here is the update dropbox version that someone else posted before.
When I try above, I get:
There was a problem executing the workflow:
"Error initializing workflow: credential ID not present. Please open the workflow and save it to fix this error."
Thank you so much. I got it working smoothly. Actually this Cookie part is very important if you have multiple HTTP Request node and it can only be set after I ran the Authentication node once, in order to get the correct Output data.