# Configurations lost while creating a dynamic node and flow

**URL:** https://discourse.nodered.org/t/configurations-lost-while-creating-a-dynamic-node-and-flow/20155
**Category:** General
**Created:** [10 January 2020 09:31 UTC](https://discourse.nodered.org/t/configurations-lost-while-creating-a-dynamic-node-and-flow/20155 "2020-01-10T09:31:54Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![sriramachandramanjun](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sriramachandramanjun/32/16103_2.png) [@sriramachandramanjun](https://discourse.nodered.org/u/sriramachandramanjun)
#### Post date: [10 January 2020 09:31 UTC](https://discourse.nodered.org/t/configurations-lost-while-creating-a-dynamic-node-and-flow/20155/1 "2020-01-10T09:31:54Z")

</div>

I have started exploring, how to create a dynamic nodes in NodeRED and I found it was not possible, instead I can create a new flow dynamically with the nodeids mentioned below as suggested by the documentationo. I tested with below request with Bearer Token and Content-Type and it created a new flow and returned an object.

But the issue was as soon as below request executed successfully all my configurations got changed and Node-Red UI remains blank with no flow visible and running in the background, I have around 20-30 flows created and lost those.

Can someone help in restoring my configurations as earlier.

[http://localhost:1880/flow](http://localhost:1880/flow)  
POST  
{  
"id": "91ad451.f6e52b8a",  
"label": "loraapi",  
"nodes": ["a2d5ec3d.d9992","b87a8378.e46a2","54c4b89d.82f088"],  
"configs":   
}

Please find the attached image.

Thanks!

 ![NodeRed](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bdf875fe358b79304c9a25c7c4a74c5a0dabd441.png)

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [10 January 2020 09:46 UTC](https://discourse.nodered.org/t/configurations-lost-while-creating-a-dynamic-node-and-flow/20155/2 "2020-01-10T09:46:26Z")

</div>

If you post a new flow to overwrite your old flow then that is exactly what you have done... overwritten your existing flow... We do keep a one level backup at this point as a file in your user directory usually called something like `.flows_{hostname}.json.backup` where {hostname} is the name of your computer. If you copy or rename that file back to `flows_{hostname}.json` you should be able to restart Node-RED back where you were.  
If you have deployed (or posted) more than once then sadly that may have ben overwritten.

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [10 January 2020 09:50 UTC](https://discourse.nodered.org/t/configurations-lost-while-creating-a-dynamic-node-and-flow/20155/3 "2020-01-10T09:50:43Z")

</div>

In addition to what @dceejay said have a look at the Projects feature which can save you a lot of trouble in situations like yours.

---

<div class="post-metadata">

### Author: ![sriramachandramanjun](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sriramachandramanjun/32/16103_2.png) [@sriramachandramanjun](https://discourse.nodered.org/u/sriramachandramanjun)
#### Post date: [10 January 2020 12:17 UTC](https://discourse.nodered.org/t/configurations-lost-while-creating-a-dynamic-node-and-flow/20155/4 "2020-01-10T12:17:10Z")

</div>

Thanks for your suggestions, nothing worked for me, I think overwritten. Hopefully looking forward to have a better detailed documentation for NODE-RED to properly use the API calls

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [10 January 2020 13:58 UTC](https://discourse.nodered.org/t/configurations-lost-while-creating-a-dynamic-node-and-flow/20155/5 "2020-01-10T13:58:03Z")

</div>

Sounds like the API calls worked just fine... Not sure that documentation would help much if you don't backup your flows... The few people I know who autogenerate flows do so outside of Node-RED - so they always deploy into a runtime only instance.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [10 January 2020 14:10 UTC](https://discourse.nodered.org/t/configurations-lost-while-creating-a-dynamic-node-and-flow/20155/6 "2020-01-10T14:10:53Z")

</div>

I don't think you have deleted your flow configuration, but I do think you've corrupted it.

In your POST to the /flow endpoint, the example flow configuration you've shared is wrong:

```auto
"nodes": ["a2d5ec3d.d9992","b87a8378.e46a2","54c4b89d.82f088"],

```

You have provided `nodes` as an array of strings. It should be an array of full node configurations.

I haven't tested what happens if you pass an array of strings rather than objects, but it may have appended those strings to your flow configuration and thus breaking it. This is why the editor looks completely blank.

At this point, manually edit your flow file. It should contain an array of node objects. Search for those strings you've added and remove them. Then restart NR.

If you're in doubt over what format to use, do a GET of `/flow/<flow-id>` for one of your existing flows and see what it looks like.

---

<div class="post-metadata">

### Author: ![sriramachandramanjun](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sriramachandramanjun/32/16103_2.png) [@sriramachandramanjun](https://discourse.nodered.org/u/sriramachandramanjun)
#### Post date: [14 January 2020 14:31 UTC](https://discourse.nodered.org/t/configurations-lost-while-creating-a-dynamic-node-and-flow/20155/7 "2020-01-14T14:31:51Z")

</div>

Thanks a lot, it worked!
