Authentication to download workflows from n8n cloud

We’re migrating from self-hosted n8n to n8n cloud :slightly_smiling_face:

On the self-hosted n8n, we currently use this workflow to backup our workflows to Github, it works great:

It makes a GET request to a URL like this to download all the workflows:
and the authentication is using Basic Auth.

Now that I want to use the same workflow on n8n cloud, what authentication method should I use?

Basic Auth doesn’t seem to work, I get the error:

“N8N Workflows: Response body is not valid JSON. Change “Response Format” to “String””

Hi @ChrisTrunk, welcome to the community!

The API used by this workflow is unfortunately not publicly accessible in instances I am fraid :frowning: . This has come up before and I have already added this as a possible improvement:

Hi @MutedJam,

Thanks for the reply.

That’s a real shame, as this isn’t only about backups but also version control, which is very important.

I guess it would be fairly simple to allow n8n workflows to access the JSON, whilst keeping it locked down to the rest of the world. Or adding an authentication method supported by the n8n workflows.

Until then, is there any other method to version the n8n workflows at all?

The API is not accessible from outside of your instance but your instance can still access it by using localhost. So for example: http://localhost:5678/rest/workflows

And even if you want to access the internal API from outside your instance you can still build your own API proxy with n8n. That would be just a two-node workflow.

  • Webhook Node: Entry point to your custom API, make sure to protect it with basic auth. Set up to return the data of the last node.
  • HTTP Request Node: This node calls the internal n8n API and returns its data.

You can then access all the instance data from anywhere.

Hope that is helpful.


Hi Jan, that did the trick. Thank you! :grin::sunglasses:


My backup workflow has been working fine since my last post here, but recently stopped working when connecting to the above URL. The response is:

{"status":"rejected","reason":{"message":"401 - \"Unauthorized\"","name":"Error","stack":"Error: Request failed with status code 401\n    at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n    at IncomingMessage.emit (node:events:538:35)\n    at IncomingMessage.emit (node:domain:475:12)\n    at endReadableNT (node:internal/streams/readable:1345:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"}}

Has something changed at n8n cloud to prevent localhost access? :thinking: