# Not Able to Get the Flow by ID in Node-RED Editor

**URL:** <https://discourse.nodered.org/t/not-able-to-get-the-flow-by-id-in-node-red-editor/93109>\
**Category:** General\
**Created:** [13 November 2024 07:54 UTC](https://discourse.nodered.org/t/not-able-to-get-the-flow-by-id-in-node-red-editor/93109 "2024-11-13T07:54:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vidit.khemka](https://avatars.discourse-cdn.com/v4/letter/v/e5b9ba/32.png) [@vidit.khemka](https://discourse.nodered.org/u/vidit.khemka)\
**Post date:** [13 November 2024 07:54 UTC](https://discourse.nodered.org/t/not-able-to-get-the-flow-by-id-in-node-red-editor/93109/1 "2024-11-13T07:54:22Z")

</div>

Hello,  
I’m trying to fetch only a specific flow based on the flow ID from the URL in Node-RED's editor (e.g., `http://localhost:4200/editor/#flow/5d4ed2fee1e3ecb0`) instead of fetching all flows.

Currently, I’m using an `httpAdminMiddleware` to intercept the request, but I’m unable to retrieve the flow ID from the URL in the request. It seems like Node-RED is directly making an API call to fetch all flows, and I don't see the flow ID in the request headers or body.

Here’s the code for my current approach:

javascript

Copy code

```auto
const flowId = 'a3994a4a93d6a53e';
export async function interceptFlowRequests(req, res, next) {
    if (req.method === 'GET' && req.url.startsWith('/flows')) {
        console.log('URL:', req.url);
        const originalJson = res.json;
        res.json = function(data) {
            const filteredData = data.flows.filter(item => item.id === flowId || item.z === flowId);
            return originalJson.apply(res, [{ flows: filteredData }]);
        };
    }
    next(); 
}

```

I’ve hardcoded the flow ID for testing, but I’d like to dynamically retrieve the flow ID based on the URL in the editor (e.g., extracting it from `#flow/<flowId>`).

If anyone could offer any guidance on how to get the flow ID from the URL in the request or suggest a better approach to achieve this, it would be greatly appreciated!

Thank you in advance for your help!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 November 2024 08:48 UTC](https://discourse.nodered.org/t/not-able-to-get-the-flow-by-id-in-node-red-editor/93109/2 "2024-11-13T08:48:58Z")

</div>

Node-red always returns the full flows. The parameter in that URL is only for which flow tab to select.

Instead, try the admin API: [Admin API Methods : Node-RED](https://nodered.org/docs/api/admin/methods/)

---

<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:** [11 February 2025 08:49 UTC](https://discourse.nodered.org/t/not-able-to-get-the-flow-by-id-in-node-red-editor/93109/3 "2025-02-11T08:49:15Z")

</div>

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