# Admin API flow creation with duplicate IDs

**URL:** <https://discourse.nodered.org/t/admin-api-flow-creation-with-duplicate-ids/65261>\
**Category:** Feature Requests\
**Created:** [18 July 2022 11:19 UTC](https://discourse.nodered.org/t/admin-api-flow-creation-with-duplicate-ids/65261 "2022-07-18T11:19:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [18 July 2022 23:29 UTC](https://discourse.nodered.org/t/admin-api-flow-creation-with-duplicate-ids/65261/2 "2022-07-18T23:29:23Z")

</div>

As a workaround you may find this post interesting

> [@How to generate unique node ID when creating a flow via node-red API](https://discourse.nodered.org/t/how-to-generate-unique-node-id-when-creating-a-flow-via-node-red-api/18237/2):
>
> Hi Charlotte, I had the same problem as you. I have found that IDs are generated with this JScript function (1 + Math.random () \* 4294967295) .toString (16); You can find it on file @node-red/util/lib/util.js, function generateId() I hope it is useful for you Ciao

Also the link to the Node-red util file with the code that generates the ids. ([LINK](https://github.com/node-red/node-red/blob/master/packages/node_modules/%40node-red/util/lib/util.js#L44))  
You may implement the same method to give the nodes a unique id before the POST ?

**[EDIT]**  
Why would you want to POST a flow with duplicate node ids which in my mind means a duplicate flow ?!  
Maybe you should be using `PUT /flow/:id` that updates a Flow ?

---

_[View the full topic](https://discourse.nodered.org/t/admin-api-flow-creation-with-duplicate-ids/65261)._
