Node-RED – Example – Add flow from commandline

It is possible to add a flow in Node-red from the commandline using CURL and POST commands: https://nodered.org/docs/api/admin/methods/post/flow/


Append flow from plain commandline

use this commandline with JSON object to import a flow into Node-red:

you will recieve an flow ID code back when all went ok: {"id":"9d987943.ad2448"}

On the dashboard you will get the message:

Wich you can then merge with your existing flows:

Example to replace all flows with the one stored in a json file:

Example to add a flow stored in a json file:

you need to put in nodes:”;[ ] tags…


Append flow from a file

Create a file in your homefolder named: addflow

With JSON contents:

Then use this commandline to add it to nodered:

you will recieve an flow ID code back when all went ok: {"id":"9d987943.ad2448"}

With pwd (print working directory) command:


Replace all flows from a file

Note: this is exactly the exported flow format of Node-red
Posting to /flows replaces the entire flow configuration.

Create a file in your homefolder named: flows

With JSON contents:

Then use this commandline to add it to nodered:

you will recieve an flow ID code back when all went ok: {"id":"9d987943.ad2448"}

With pwd (print working directory) command: