How to implement Version Control/Backups in the cloud version

Describe the issue/error/question

Currently I have about ~30 workflows set up in the cloud version and we’re a team of 2 people who are regularly working on these workflows, sometimes modifying existing ones and occasionally also creating new ones. Naturally we’ve already run into some issues regarding the lack of version control, that’s why I tried implementing a workflow which automatically saves all workflows into a github repo. Turns out, its not as easy as I thought. I based my workflow upon the already existing ones out there which I could find on the forum and on the templates page. I’ve gotten it to work for a few times, then it suddenly stopped working due to auth errors with the internal API. Below you can find what I’ve come up with so far.
I’ve tried to reverse engineer the auth stuff by copying the requests that the browser does when logging into the cloud version. What I dont quite understand is that it seems that sometimes the authentication is done by setting the cookie token=MYJWT, some other times it seems to be n8n-auth=anotherJWT. I’ve had it multiple times so far that the Get Workflow request worked for the first item to get, but all others didn’t get the workflow JSON as a response, but instead html for the login page.
Can someone explain me how the auth really works or if there is a better way to achieve my goal?
Switching to the selfhosted version is not possible

What is the error message (if any)?

The get workflow node returns the login page in html instead of the real workflow json. Funnily enough the get workflow list node works perfectly fine

Please share the workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.169.0
  • Database you’re using (default: SQLite): default
  • Running n8n with the execution process [own(default), main]: default
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: cloud

Hey @jodeldiplomant, your n8n.cloud instance would talk to the internal API via localhost:5678. So as for the authentication, could you check out this approach shared by @pemontto a while back:

I’ve used this for a few days now and the backup workflow on my n8n.cloud instance didn’t run into trouble since.

That said, this is not a supported or documented API and it can change without any notice. I know the team is working on building a fully supported REST API to make life easier and you might want to add your ideas and requirements to the existing feature request: