# Programmatically generate flows?

**URL:** https://discourse.nodered.org/t/programmatically-generate-flows/1564
**Category:** General
**Created:** [13 July 2018 20:44 UTC](https://discourse.nodered.org/t/programmatically-generate-flows/1564 "2018-07-13T20:44:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![carrollj](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@carrollj](https://discourse.nodered.org/u/carrollj)
#### Post date: [13 July 2018 20:44 UTC](https://discourse.nodered.org/t/programmatically-generate-flows/1564/1 "2018-07-13T20:44:13Z")

</div>

Is there anyway to programmatically generate nodes/flows outside of creating a large JSON blob via the APIs exposed in the node-red npm package? For instance, could I programmatically create a flow then add nodes to it simlar to this:

flow.addNode('httpRequest', {method: POST,..., wires: []

If not, is there a way for developers to programmatically access the special parameters associated with a particular type of node? I see that there is a registerType function that allows users to specify the special parameters associated with a new node, but I would like to be able to tell the special parameters that an inject node has that a debug node does not.

---

<div class="post-metadata">

### Author: ![AMES](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AMES](https://discourse.nodered.org/u/AMES)
#### Post date: [15 July 2019 21:40 UTC](https://discourse.nodered.org/t/programmatically-generate-flows/1564/2 "2019-07-15T21:40:46Z")

</div>

Is there any answer to this question? I have similar problem.  
I want to read a csv file on the beginning of deployment and generate nodes/flows based on the number of columns on csv file. But I don't want to change the nodes/flows while running.  
@carrollj I think you can edit your flow when node-red is off and then start node-red. It'll be deployed when started. For instance, you can use java json library to make new nodes and flows.  
However, how to connect the nodes? If I generate nodes/flows by copying the text, connecting them can be tricky because I should generate unique ids. I used simple numbers like "1", "2", ... they seem to work. I don't know if this is the right way or not.  
But if you want to generate nodes/flows while running, I have no idea. Does anyone know if this is possible or not?

---

<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: [15 July 2019 22:10 UTC](https://discourse.nodered.org/t/programmatically-generate-flows/1564/3 "2019-07-15T22:10:28Z")

</div>

> [@AMES](#):
>
> Does anyone know if this is possible or not?

No, it is not possible to create nodes dynamically at runtime.

The only way to add/remove nodes is to deploy a new flow configuration.

---

<div class="post-metadata">

### Author: ![AMES](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AMES](https://discourse.nodered.org/u/AMES)
#### Post date: [15 July 2019 22:28 UTC](https://discourse.nodered.org/t/programmatically-generate-flows/1564/4 "2019-07-15T22:28:30Z")

</div>

Thank you for your reply. What do you recommend for generating the nodes and flows @knolleary ? Any specific library?
