Easiest Way to Migrate n8n Workflows Between Accounts (cloud to self-hosted)

Migrate n8n workflows from Cloud to self-hosted using three API nodes: pull workflows from the source, log them to Google Sheets to track progress, then create them on the destination. Credentials and execution history don't transfer.
Chapters
Today I'm going to be showing you guys a really easy and safe way to migrate hundreds of workflows between two n8n instances. And in this example, I'll be going from n8n Cloud to my n8n self-hosted. I'm going to give you guys everything that you need for free to do this migration. So first, I'm just going to walk through exactly how this workflow works and what it's doing. And then at the end, I'll show you how you can set it up and how to download all this stuff for free. So let's get into it. All right. So this is the workflow. It's super simple. It's made up of a total of 3 different types of nodes. So let me just real quick walk through the actual system and how this works. So you can see we actually have two workflows. We have this one up here and this one, and they're both just going to be manually executed. So what we're doing up here on the top one is we're gonna pull in all of our current workflows from our old instance using the N8N node. We're gonna pull in all those workflows and then we're gonna push them into a Google Sheet. And the reason we're doing this is just so we have storage of workflows so that we can later check them off so we know which ones we've migrated and which ones we haven't. Because if you're not doing any sort of logging and tracking somewhere externally, you may end up accidentally moving over some of your workflows like 10 times. And then it becomes a whole mess in your new n8n. So after we've moved over all of our old workflows into a Google Sheet, all we have to do is hit that Google Sheet again, pull them back in, and then we just feed them into the new n8n. And we were able to use n8n's API to do this. So if that didn't make any sense yet, let me just plug in my n8n credentials and then we'll give it a run and I'll show you exactly what I mean. So there are two different n8n API keys that you're gonna need to get. The first one is in your old instance. So this is my old cloud instance right here. What I'm gonna do is I'm gonna go over here to the settings, and I'm going to come up here to Anodin API. And then all I have to do right here is click on Create API Key. I'll give it a name. So this is just going to be test. You can make it expire or you can make it not expire at all. So I'll just leave it as this and I'll go ahead and hit save. And now it gives me this API key, which all I have to do is go ahead and copy that right there. And now that I've copied that API key, all I have to do is come into this Anodin node, go ahead and create a new credential, and I just have to paste in the API key right here. Now the other thing you are gonna have to do is you're gonna have to grab your base URL from up here, and you probably can't see it on my screen right now. And then after the.cloud, or like the end of your base URL, you have to do /api/v1. So to make this easier, I'm just gonna right now do /api/v1, and then I'm gonna grab my base URL from up top right here, and then I'm gonna paste it in the beginning. So now you can see I have natehurk.app.endedn.cloud/, and make sure there's not two slashes like there is here, api/v1. And so I'm just gonna go ahead and make sure that I label this credential as my n8n cloud account, and we'll go ahead and save that credential. So now that this is set up, you can see what we're doing here is we're basically hitting n8n and we're saying we wanna pull in all of our workflows. So when I execute this step, you can see that I got 512 items, meaning in my cloud instance right now, I've got 512 workflows. And I'm not actually gonna do all 512 just because it would be very slow and it might mess up the recording. So what I'm gonna do instead is let's just pretend that I have 25 workflows in here, so I'm gonna limit it to 25, hit execute step, and now you can see that we're going to get only 25 workflows instead of those 512. And even just 25 workflows is still a ton of data because what's going on in each of those workflows is we have an updated at time, a created at time, the name, if it's active or not, we have all of these other things. We have every single node, all the parameters, all the different versions. And so it's a huge nasty chunk of JSON whenever you are looking at a workflow. So same thing if you ever downloaded a JSON template from a community like mine, and then you go ahead and import it. This is what's actually going on behind the scenes that makes up the workflow. So hopefully you guys understand now why we're logging everything, because there is a good chance if you're doing tons and tons of workflows, maybe something crashes. So if you're logging everything on something external like a Google Sheet, you'll be just fine. So what I'm gonna do is I'm just gonna click Execute Workflow, which is gonna pull in the 25 items, it's gonna loop through, and it's gonna one by one add it to a Google Sheet. So I'm gonna switch over to that sheet and you can see right now it's adding in workflows slowly one at a time and it's giving us the ID, it's giving us the name of the workflow, and then it's marking the status as to process. And this makes it really easy for us later because as we're pulling in workflows, we're only gonna pull in workflows if the status equals to process. And then after we actually move them to the new self-hosted instance, we mark them off as processed. And that's like I said, how we make sure we actually know which ones have been migrated and which ones haven't. So I'm just gonna let this finish up. We'll get all 25 in here and then I'll show the next phase. Phase of the workflow. All right, there we go. We got all 25 items pushed into the sheet. You can see here now we have 25. And now let's talk about what's going on down here. So down here we have our Google Sheet, and what we're doing is we're pulling in rows. But you can see that we have a filter, which means we're only going to pull in rows if the status column equals to process. So right here I'll click execute step, and we should see all 25 of those items come back, as you can see right there. And of course, if I was to go into the Google Sheet and I mark off this first one as processed, for example, and I come back in here and then hit execute step, we should now only see 24 items actually ready to process. So out of these 24 workflows, we have the ID, and that's all we actually need to do the next node, which is looking up that ID so that we can get the actual JSON makeup of that workflow. So that's what we're doing in this next node. This is once again, still our N8N Cloud account. So the old one that we want to migrate workflows from, and we're just doing a get workflow operation where we're looking it up by ID. So there's 24 IDs on this left-hand side. We're putting all those in the middle. So when I hit execute step here, we should see 25 workflows popping out on on the other side, and that's exactly what we see here. Now, this could be more than 24. It could be hundreds and hundreds. So what we want to do is once again set up a loop so that we can just process one at a time to limit our chances of anything going wrong. But before I show you how this loop works, let's talk about this node here. So these other ended in nodes, as you can see, are either getting many workflows or getting one workflow. And so what we're doing in this one is we're actually going to create a workflow. And in order to do that, we have to send over a workflow object, which is made up of JSON. So we'll be sending over the name of the workflow, the nodes, the connections, and the settings. You can see I've got some variables in here with a couple expressions in the front, but don't worry about it. This JSON and this entire workflow that you're looking at right here will be available to download for free, so you won't have to worry about it. But if you wanna also build this for yourself, just take a screenshot of this real quick and then have ChatGPT write it out for you. But this is where we have to make a credential for our new instance. So I'm gonna switch over real quick to my self-hosted instance, which you can see there are only 2 total workflows in here. And what we need to do is get an API key. And real quick, since you guys ask me this all the time, I'm using Hostinger VPS to self-host my N8N instance, and you can actually get a 10% off annual plans with code Nate Hurk. And also if you're in my Plus community, AIS Plus, you can get a bigger discount. So check that out in the link in the description. But this is what the landing page looks like. You can see it says deploy N8N in one click, and you can even get started for just $5 a month. So it's a lot cheaper than N8N Cloud. I also made a full YouTube video walking through this exact process of setting up and it, and on Hostinger. So if you want to check that out, I'll tag that right up there. All right. Anyways, back in my self-hosted, we're going to do the same exact thing. I'm going to go to my settings. I'm going to go to edit an API. We're going to go ahead and create a new API key. I'll call this one demo. We'll let that expire in 30 days. That's fine. And now I'm going to go ahead and click this API key to copy it. We're going to do the exact same thing in this and in a node real quick. I'm going to go ahead and create a new credential. I'm going to paste in the API key and we have to do the base URL thing once again. So I'm going to once again type /api/v1. I'm going to go back into self-hosted and I'm going to grab my base URL, which is pretty much— I guess you'll just see it right here, enidn.blahblahblah.hostinger.cloud. And then we have /api/v1. So I'm just going to name this enidn-self-hosted. We'll hit save. And now we have this enidn node pretty much completely configured. And now this enidn node is ready for us and we can run the rest of the flow. So I'm just gonna go ahead and execute workflow. We've already seen how these first two steps, it's gonna pull in 24 workflows that are ready to process. We grab the JSON for all of those, and now we're gonna loop through, push them into the new account, and then update the status in the sheet. So if I go into my cloud instance of n8n and I go back home, you should see now that we're getting workflows added in. We now have 8. We started with 2. If I give this a refresh, we should have a few more now. There we go. We have 12. And if I go into that Google Sheet, you can see that they're slowly one by one getting marked off as processed, as you can see. So this basically just helps us keep track, like I've mentioned many times before. So I'm going to mark this last one as to process just so I can run one more all the way through and show you guys what the actual JSON body looks like in here. So we're passing over a workflow object, and if I open this up, you can see once again we have name and we have nodes, which is actually a lot longer than you may think. We have the connections and then we have the settings. So all of this basically just tells the self-hosted instance how to make the workflow and what the parameters are and how to actually connect the strings and things like that. So if I open up one of the workflows, you can see that it actually has even the stickers, it has all the naming conventions, it has all the parameters filled out already. As you can see, there's a user prompt in here, so it moves over everything just as you had it in your cloud version. The only thing that won't move over is, you know, credentials and users and executions and things like that, and there's really no great way to do that besides just manually resetting. So I know some of you guys are going to ask about what if you wanted to move workflows from a cloud to a local. It's similar, but it's not quite as simple because obviously this N8N API works a little bit differently because you have to somehow be able to speak to that local instance. But if you just get a little creative, there's lots of simple ways to do this because let's say you pull in your workflows up here from your cloud instance, you're getting everything you need in order to actually build the workflow. So you could basically just write all of the JSON of the workflow into something like a Google Sheet or wherever you want to store it. And then you could just pull that into your local instance of N8N. And then of course, from there you can just create the workflows. Or if you're on NNN Cloud, you could go to your panel, you could go to manage, and you can click on export. And this lets you actually just download all of your workflows in a zip file, and it's just all of the JSONs that you would need to actually import into your local instance. Okay, so just wanted to wrap up real quick with how do you actually access this template if you want to migrate your workflows. Well, you can get this for free by joining my FreeSchool community. The link for that will be down in the description. All you have to do to find that is you can search for the title of video, you can go in the classroom and look through the templates, you'll be able to find it in here. And when you find the post associated with that video, like pretend it's this one, you'd be able to download that workflow JSON right here and then import it. I will even include a copy of this Google Sheet template if you want to just be able to plug everything right in, just like the template suggests. So then the only thing you'll have to do is you'll have to go get your two different NN API keys. And remember, you can use code NATHURK to get 10% off annual plans at Hostinger. Or if you're interested in getting a larger discount, and checking out a community of over 3,000 members who are building with N8N every day and building businesses with N8N every day, then definitely check out my Plus community. The link for that is also down in the description. But anyways, that's gonna do it for today. I know it was a quick one, but hopefully it is a very specific use case that if you run into it, this video helps you out. And if you enjoyed or you learned something new, then please give it a like. It definitely helps me out a ton. And as always, I appreciate you guys making it to the end of the video. I'll see you on the next one. Thanks everyone.










