What is the published format for storing NodeRED graph to a file?

Hi, I'm wondering if there is published format on how NodeRED stores its visual node representation into a file (serializes graph GUI into a file in JSON format). So is it possible to manually create such file (by writting JSON values programmatically) and have NodeRED restore graph from it? Where is this format published? Is this purely done in JSON or some other format?

Here is the read me, it contains the json formats for the graphs. You can store your charts in this format. The output of the chart node will output this data.

@E1cid I think this question is about the flow file format, not dashboard charts.

@raid2light we do have this quite old wiki page that describes the basic format: Flow Format · node-red/node-red Wiki · GitHub

The flow file is an array of objects, each object representing either a node, group, subflow or flow (tab).

There are a few more core properties than mentioned on that wiki page, but the basic structure is the same.

You are probably right it looks like i misread that question.

Thanks for both suggestions, this is indeed very helpful. I was hoping to be able to programmatically update graph flow file and have NodeRED reload the graph flows with updated layout from this file (graph visual layout might change out of band based on environment and other factors). In this way this file would represent a model that I need to update so that NodeRED web page graph can adjust automatically.

Btw. is there a way to reload the layout graph from the file programmatically or via command line? Are there any examples how to automate using NodeRED in this manner?

The Admin API - Admin API : Node-RED can be used to get existing and post new flows to the server.

Thanks - is this recommended way to alter the flows programmatically? Would it be easier to save the flows in the file, parse the file and and then restore flows from the file once it has been updated to account for altered flows?

Hello, is there any example how to use Admin API? How does one invoke this API from command line? Can API be used to adjust position of the node in the graph for example? How about adjusting to what other node does selected node connects to?

Well not really. The P in API stands for programming. So while yes you could somehow create a curl command or some such to invoke it, it would be hugely inefficient compared to just using the user interface.