---
title: Flows Manager
slug: sdk/Usage-Guideline-Authentication/flows-manager
docTags: 
createdAt: 2025-03-20T20:01:42.947Z
---

The flows module manages Node-RED flow instances on Litmus Edge.

:::BlockQuote
**Note:** For reading or modifying the internal content of a flow (nodes, wires, tabs), use the [Node-RED API](https://nodered.org/docs/api/) directly. The SDK only covers the flows-manager service (lifecycle management).
:::

## Imports

```python
from litmussdk import flows
```

***

## Common Operations (3.x and 4.0.x)

### Listing Flows

```python
all_flows = flows.list_flows()  # list[dict]
# Each entry: {id, name, memory_limit, secret, tabs: [...]}

# Find a flow by name
flow = next((f for f in flows.list_flows() if f["name"] == "My Flow"), None)
```

### Creating a Flow

Creates a stopped, empty flow. Fails if a flow with the same name already exists.

```python
flow = flows.create_flow(
    name="My Flow",
    secret="my-secret",
    memory_limit=256,
)
flow_id = flow["id"]
```

### Starting and Stopping

```python
flows.start_flow(flow_id)
flows.stop_flow(flow_id)
```

:::BlockQuote
Calling `start_flow` on a running flow (or `stop_flow` on a stopped flow) will raise an error.
:::

### Updating a Flow

```python
flows.update_flow(
    flow_id=flow_id,
    name="Renamed Flow",
    memory_limit=512,
)
```

### Removing a Flow

Destroys the flow and all its internal tabs.

```python
flows.remove_flow(flow_id)
```

***

## 4.0.x-Only Operations

These functions raise `UnsupportedVersionError` when called against a 3.x device.

### Download Flow File

Returns the raw `.json` flow definition as bytes.

```python
content: bytes = flows.download_flow_file(flow_id)

# Save to disk
with open("my_flow.json", "wb") as f:
    f.write(content)
```

:::BlockQuote
**2.6.0 fix**: prior versions of the SDK silently UTF-8-decoded the response, which corrupted binary content. As of 2.6.0, `download_flow_file` and `download_flow_logs` route through a binary-safe code path and return real `bytes`. Upgrade if you saw mangled output or the literal string `"None"` before.
:::

### Download Flow Logs

```python
logs: bytes = flows.download_flow_logs(flow_id)
```

### Delete Flow Artifacts

Clean up individual flow artifacts without deleting the flow itself:

```python
flows.delete_flow_flows_json(flow_id)     # removes flows.json
flows.delete_flow_credentials(flow_id)   # removes credentials file
flows.delete_flow_logs(flow_id)          # removes log files
flows.delete_flow_node_modules(flow_id)  # removes node_modules
```

***

## License

Copyright (c) Litmus Automation Inc.
