# How to add new flows to a running Node-RED instance with the admin API

**URL:** <https://discourse.nodered.org/t/how-to-add-new-flows-to-a-running-node-red-instance-with-the-admin-api/83858>\
**Category:** General\
**Created:** [20 December 2023 08:44 UTC](https://discourse.nodered.org/t/how-to-add-new-flows-to-a-running-node-red-instance-with-the-admin-api/83858 "2023-12-20T08:44:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![markoz](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@markoz](https://discourse.nodered.org/u/markoz)\
**Post date:** [20 December 2023 08:44 UTC](https://discourse.nodered.org/t/how-to-add-new-flows-to-a-running-node-red-instance-with-the-admin-api/83858/1 "2023-12-20T08:44:11Z")

</div>

I'm trying to use the Admin API to add flows to a running Node-RED instance. The flow files are downloaded/exported with the build in Node-RED editor.

I've tried using the `POST /flows` and it works adding the first flow, but when I want to add another one, the old flows disappear.

I've also tried using the `POST /flow`, but I'm not sure how I need to set-up the exported Flow JSON, so it can be added. I keep getting _"Unexpected error : Missing nodes property"_.

I'd appreciate any tips on how I can get this to work.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [20 December 2023 08:52 UTC](https://discourse.nodered.org/t/how-to-add-new-flows-to-a-running-node-red-instance-with-the-admin-api/83858/2 "2023-12-20T08:52:12Z")

</div>

Welcome to the forums @markoz

> [@markoz](#):
>
> `POST /flow`

Is what you need to use to add an additional flow tab, `flows` replaces everything that you upload.

According to the guide.  
it will be something like this.

```auto
{
  "id": "91ad451.f6e52b8",
  "label": "My New (additional) Flow",
  "nodes": [
    {
      "id": "abeb0d0dade32de5",
      "type": "inject",
      "z": "e3aa352edc6e5a3f",
      "name": "",
      "props": [
        {
          "p": "payload"
        },
        {
          "p": "topic",
          "vt": "str"
        }
      ],
      "repeat": "",
      "crontab": "",
      "once": false,
      "onceDelay": 0.1,
      "topic": "",
      "payload": "",
      "payloadType": "date",
      "x": 190,
      "y": 130,
      "wires": [
        [
          "4b3c5f62b2af4c96"
        ]
      ]
    },
    {
      "id": "4b3c5f62b2af4c96",
      "type": "debug",
      "z": "e3aa352edc6e5a3f",
      "name": "debug 2",
      "active": true,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "false",
      "statusVal": "",
      "statusType": "auto",
      "x": 435,
      "y": 130,
      "wires": [
        
      ]
    }
  ],
  "configs": []
}

```

[https://nodered.org/docs/api/admin/methods/post/flow/](https://nodered.org/docs/api/admin/methods/post/flow/)

---

<div class="post-metadata">

**Author:** ![markoz](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@markoz](https://discourse.nodered.org/u/markoz)\
**Post date:** [20 December 2023 11:58 UTC](https://discourse.nodered.org/t/how-to-add-new-flows-to-a-running-node-red-instance-with-the-admin-api/83858/3 "2023-12-20T11:58:37Z")

</div>

Thank you for the answer. I tried it out with this way and it does work, but it doesn't post if I also try to add subflows. Is there a way to also add subflows?

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [20 December 2023 12:03 UTC](https://discourse.nodered.org/t/how-to-add-new-flows-to-a-running-node-red-instance-with-the-admin-api/83858/4 "2023-12-20T12:03:01Z")

</div>

I don't have much xp with the API directly.  
But I believe it should support subflows when adding a new flow

```auto
{
  "id": "91ad451.f6e52b8",
  "label": "My New (additional) Flow",
  "nodes": [...],
  "subflows": [...], /* <-- HERE */
  "configs": [...]
}

```

See : [Types : Node-RED](https://nodered.org/docs/api/admin/types)

---

<div class="post-metadata">

**Author:** ![markoz](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@markoz](https://discourse.nodered.org/u/markoz)\
**Post date:** [21 December 2023 11:38 UTC](https://discourse.nodered.org/t/how-to-add-new-flows-to-a-running-node-red-instance-with-the-admin-api/83858/5 "2023-12-21T11:38:26Z")

</div>

I don't know how I missed that. Thank you for all the help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 February 2024 11:39 UTC](https://discourse.nodered.org/t/how-to-add-new-flows-to-a-running-node-red-instance-with-the-admin-api/83858/6 "2024-02-19T11:39:14Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
