How to authenticate for REST API with Users management activated?


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 :smiley:

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,, desktop app]:
1 Like

Hey @JulienDelRio,

Welcome to the community :tada:

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.


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 :slight_smile:

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

Backup workflows

I should change the title to “How to backup my workflows” :rofl:

I suspect this post is going to be linked to a lot over the next couple of weeks :smile:


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.

You sir, are a freaking genius.

1 Like

Since I am backing up the workflows to a git repo, I wish there was a better way to not include my email and password as post parameter and there was a way to provide authetncation via the credentials. right now this hack will expose my password in the workflow which then is pushed to repo.

Hey @roozbehk,

What about using the n8n node or the public API that would get around this issue.

Indeed the n8n node now officially supports this. I was able to use it below to save workflows to files on local disk

1 Like