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:
https://[self-hosted-domain]/rest/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 n8n.cloud 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 n8n.cloud 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 n8n.cloud instance data from anywhere.

Hope that is helpful.

1 Like

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

2 Likes