# Automatically import SubModule

**URL:** https://discourse.nodered.org/t/automatically-import-submodule/92609
**Category:** General
**Tags:** http-request
**Created:** [23 October 2024 12:52 UTC](https://discourse.nodered.org/t/automatically-import-submodule/92609 "2024-10-23T12:52:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![PetrVasata](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@PetrVasata](https://discourse.nodered.org/u/PetrVasata)
#### Post date: [23 October 2024 12:52 UTC](https://discourse.nodered.org/t/automatically-import-submodule/92609/1 "2024-10-23T12:52:32Z")

</div>

Hi all, I’m trying to import a subflow into a project. I’ve been using an HTTP POST request to `/flow`, which works fine for flows but not for subflows. I’ve tried reorganizing the JSON data, but I still haven’t had any success. Is there a way to import a subflow if it doesn’t exist or update it if it already exist? Target is to make automatic update, Thank you a lot

---

<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: [23 October 2024 12:58 UTC](https://discourse.nodered.org/t/automatically-import-submodule/92609/2 "2024-10-23T12:58:20Z")

</div>

Hi @PetrVasata

Subflows live on the `global` flow - if you do a GET to `/flow/global` you'll find all of the current subflow definitions.

To add a subflow you will need to first get `/flow/global`, add the subflow to that and post it back.

It's a little awkward and I do think it would be better to have a cleaner api for adding/removing subflows, but this is what we have today.

---

<div class="post-metadata">

### Author: ![PetrVasata](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@PetrVasata](https://discourse.nodered.org/u/PetrVasata)
#### Post date: [23 October 2024 14:47 UTC](https://discourse.nodered.org/t/automatically-import-submodule/92609/3 "2024-10-23T14:47:12Z")

</div>

Thank you a lot for help. Works fantastic

---

<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: [21 January 2025 14:47 UTC](https://discourse.nodered.org/t/automatically-import-submodule/92609/4 "2025-01-21T14:47:50Z")

</div>

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