Getting current tab(flow) id from sidebar


Can I get the id of the opened tab (which is already deployed) from a sidebar? I am getting the flow description using flows/ endpoint but I want current flow id to filter the response from the flows/ API call. I thought using editor events and tried workspace: change. But it provides only the older tab id but not the current tab id. Is there any way to get the current tab id from my sidebar html?



the payload of the workspace:change event has two properties - the old workspace you were on and the new workspace you've switched to:

    old: oldWorkspaceId,
    workspace: newWorkspaceId

But there's no need to track that yourself. You can get the id of the current workspace tab by calling:

  var activeWorkspaceId =;

Once you have that id, it might be a subflow tab or a flow tab. To check which it is, you can do:

  var activeWorkspaceId =;
  var flow = RED.nodes.workspace(activeWorkspaceId);
  if (!flow) {
    // this is probably a subflow
    flow = RED.nodes.subflow(activeWorkspaceId);

Once you have that flow object you have access to all its properties - such as for its description. There's no need to use the /flow api to get this information.


Ok, one later later...
i would like to get the name of the current flow.
so with the above i tried this below

var activeWorkspaceId =;
msg.payload = activeWorkspaceId;
return msg;

but that gives the error

"TypeError: Cannot read property 'active' of undefined"

maybe i understand the usage wrong?

Where are you trying to do that? In a custom node or a Function node? If the latter, it doesn't have access to these APIs.

in the function node.
Is there another way to get it?


Nodes are supposed to be black boxes so have no concept of where they are.