# uip flow node and uip flow edge

> A Flow is a graph. **Nodes** are the vertices (triggers, activities, connectors, agents); **edges** are the directed connections between them. The `uip flow node` and `uip flow edge` commands edit a `.flow` file in place — adding, configuring, listing, and deleting both.

A Flow is a graph. **Nodes** are the vertices (triggers, activities, connectors, agents); **edges** are the directed connections between them. The `uip flow node` and `uip flow edge` commands edit a `.flow` file in place — adding, configuring, listing, and deleting both.

This page also covers three companion command groups that edit the `.flow` file in the same way: [`variable`](#variables-and-variable-updates), [`variable-update`](#variables-and-variable-updates), and [`binding`](#bindings).

## Synopsis

```
uip flow node add       <file> <node-type> [-i <json>] [--position <x,y>] [--label <label>] [--source <uuid>]
uip flow node configure <file> <node-id> --detail <json>
uip flow node list      <file>
uip flow node delete    <file> <node-id>

uip flow edge add    <file> <source-id> <target-id> [--source-port <port>] [--target-port <port>]
uip flow edge list   <file>
uip flow edge delete <file> <edge-id>
```

Honors [global options](./global-options.md). Exit codes follow the [standard contract](./exit-codes.md).

---

## uip flow node add

Add a node to a `.flow` file. The node type must exist in the registry — use [`uip flow registry search`](./uip-flow-registry.md) to discover valid `<node-type>` values.

### Arguments

- `<file>` *(required)* — path to the `.flow` file.
- `<node-type>` *(required)* — node type identifier (e.g. `core.trigger.manual`, `uipath.connector.slack.send-message`).

### Options

| Option | Description |
|---|---|
| `-i, --input <json>` | JSON object of input values to set on the node (e.g. `'{"script":"…"}'`). Must be a JSON object, not an array or scalar. For **connector** nodes (type `uipath.connector.*`), do **not** pass `--input` here — run [`node configure`](#uip-flow-node-configure) afterward. |
| `--position <x,y>` | Canvas position, e.g. `250,150`. Both x and y are required numbers. |
| `--label <label>` | Display label for the node. |
| `--source <uuid>` | Source identifier for inline agent nodes (populates `model.source`). |

### Example

```bash
uip flow node add invoice-flow.flow uipath.connector.slack.send-message --label "Notify team"
```

### Data shape (`--output json`)

```json
{
  "Code": "NodeAddSuccess",
  "Data": {
    "Node": { "id": "node_a1b2c3d4", "type": "uipath.connector.slack.send-message" },
    "DefinitionAdded": true,
    "BindingsCreated": 0,
    "VariableCount": 0
  }
}
```

`DefinitionAdded` is `true` on the first insertion of a given `node-type` — the corresponding entry in the `.flow` `definitions[]` array is created.

---

## uip flow node configure

Populate `inputs.detail` on an already-added node and create the workflow bindings it needs. Run this **after** `node add` for connector and managed-HTTP nodes.

### Arguments

- `<file>` *(required)* — path to the `.flow` file.
- `<node-id>` *(required)* — ID of the node to configure (find it with `node list`).

### Options

- `--detail <json>` *(required)* — configuration JSON. Shape depends on node type:

### Connector nodes (uipath.connector.*)

Get `method` and `endpoint` from `connectorMethodInfo` in the [`registry get`](./uip-flow-registry.md#uip-flow-registry-get) output.

- **Required**: `connectionId`, `folderKey`, `method`, `endpoint`
- **Optional**: `bodyParameters`, `queryParameters`, `pathParameters`

```bash
uip flow node configure invoice-flow.flow node_a1b2c3d4 --detail '{
  "connectionId": "b2c3d4e5-0000-0000-0000-000000000001",
  "folderKey":    "c3d4e5f6-0000-0000-0000-000000000001",
  "method":       "POST",
  "endpoint":     "/issues",
  "bodyParameters": { "summary": "Bug" }
}'
```

### Managed HTTP nodes (core.action.http.v2)

Two authentication modes:

**Connector mode** (`authentication: "connector"`) — uses an Integration Service connection for auth:

- **Required**: `authentication`, `method`, `connectionId`, `folderKey`, `targetConnector`
- `method` ∈ `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `HEAD`
- **Optional**: `url` (path appended to connector base URL), `headers`, `query`, `body`

```bash
uip flow node configure invoice-flow.flow node_abc --detail '{
  "authentication":  "connector",
  "targetConnector": "uipath-microsoft-outlook365",
  "connectionId":    "…",
  "folderKey":       "…",
  "method":          "GET",
  "url":             "/me"
}'
```

**Manual mode** (`authentication: "manual"`) — no connector auth, provide the full URL and any auth headers yourself:

- **Required**: `authentication`, `method`, `url` (full URL)
- **Optional**: `headers`, `query`, `body` (string; can be an expression, e.g. `=js:({…})`)

```bash
uip flow node configure invoice-flow.flow node_abc --detail '{
  "authentication": "manual",
  "method":         "GET",
  "url":            "https://api.example.com/data",
  "headers":        { "Authorization": "Bearer <token>" }
}'
```

### Data shape (`--output json`)

```json
{
  "Code": "NodeConfigureSuccess",
  "Data": {
    "NodeId": "node_a1b2c3d4",
    "BindingsCreated": 2,
    "DetailPopulated": true
  }
}
```

---

## uip flow node list

List all nodes in a `.flow` file.

### Arguments

- `<file>` *(required)* — path to the `.flow` file.

### Data shape (`--output json`)

```json
{
  "Code": "NodeListSuccess",
  "Data": {
    "Nodes": [
      { "id": "start",          "type": "core.trigger.manual" },
      { "id": "node_a1b2c3d4",  "type": "core.action.http.v2" }
    ],
    "Count": 2
  }
}
```

Each entry includes at minimum `id` and `type`; the service also attaches display metadata from the `.flow` `definitions[]` array.

---

## uip flow node delete

Delete a node and everything it owns. Removes:

- Connected edges
- Orphaned bindings
- Orphaned definitions
- Node variables owned by the deleted node
- Variable updates owned by the deleted node

### Arguments

- `<file>` *(required)* — path to the `.flow` file.
- `<node-id>` *(required)* — ID of the node to delete.

### Data shape (`--output json`)

```json
{
  "Code": "NodeDeleteSuccess",
  "Data": {
    "DeletedNode":           { "id": "node_a1b2c3d4", "type": "core.action.http.v2" },
    "EdgesRemoved":          1,
    "BindingsRemoved":       0,
    "DefinitionsRemoved":    0,
    "VariablesRemoved":      0,
    "VariableUpdatesRemoved": 0
  }
}
```

---

## uip flow edge add

Add an edge between two nodes.

### Arguments

- `<file>` *(required)* — path to the `.flow` file.
- `<source-id>` *(required)* — ID of the source node.
- `<target-id>` *(required)* — ID of the target node.

### Options

- `--source-port <port>` — source port name (default: `output`).
- `--target-port <port>` — target port name (default: `input`).

### Data shape (`--output json`)

```json
{
  "Code": "EdgeAddSuccess",
  "Data": {
    "Edge": {
      "id":         "edge_a1b2c3d4",
      "source":     "Node_1",
      "target":     "Node_2",
      "sourcePort": "output",
      "targetPort": "input"
    }
  }
}
```

---

## uip flow edge list

```json
{
  "Code": "EdgeListSuccess",
  "Data": {
    "Edges": [
      { "id": "edge_a1b2c3d4", "source": "Node_1", "target": "Node_2" }
    ],
    "Count": 1
  }
}
```

---

## uip flow edge delete

Delete a single edge by ID. Use `edge list` to find the ID.

```json
{
  "Code": "EdgeDeleteSuccess",
  "Data": {
    "DeletedEdge": { "id": "edge_a1b2c3d4", "source": "Node_1", "target": "Node_2" }
  }
}
```

---

## Variables and variable updates

Two companion command groups (not yet in the sidebar) edit the `variables` and variable-update subtrees of a `.flow` file.

### uip flow variable

```
uip flow variable add    <file> <variable-id> -d <direction> [-t <type>] [--default-value <val>] [--description <text>] [--schema <json>] [--sub-type <type>]
uip flow variable list   <file>
uip flow variable delete <file> <variable-id>
```

- `direction` ∈ `in`, `out`, `inout` (required).
- `type` ∈ `string`, `number`, `boolean`, `object`, `array`, `file` (default `string`).
- `--default-value` is parsed per `--type` — `object`/`array` values must be valid JSON of the matching shape.
- `--schema` must be a JSON object (e.g. `'{"type":"string"}'`).

Data shapes: `VariableAddSuccess` (`Data.Variable`), `VariableListSuccess` (`Data.Variables[]`, `Count`), `VariableDeleteSuccess` (`Data.DeletedVariable`).

### uip flow variable-update

Attach a JS expression to a node that runs on completion and assigns to a global variable (which must be `out` or `inout`).

```
uip flow variable-update add    <file> --node-id <id> --variable-id <id> --expression <expr>
uip flow variable-update list   <file> [--node-id <id>]
uip flow variable-update delete <file> <node-id> <variable-id>
```

The expression is auto-prefixed with `=js:` if missing. Example: `--expression "=js:ctx.output"`.

Data shapes: `VariableUpdateAddSuccess` (`Data.VariableUpdate`), `VariableUpdateListSuccess` (`Data.VariableUpdates[]`, `Count`), `VariableUpdateDeleteSuccess` (`Data.DeletedUpdate`).

---

## Bindings

Bindings declare the external resources a Flow needs at publish/deploy time (a target process, an agent, a connection, a queue, …) and which node property they wire into.

```
uip flow binding add    <file> <name> <resource> <default-value> [--resource-key <key>] [--property-attribute <attr>] [--resource-sub-type <type>]
uip flow binding list   <file>
uip flow binding delete <file> <resource-key>
```

- `<resource>` must be one of the service's `VALID_RESOURCE_TYPES` (shown in the `add` command's error message if an invalid value is passed).
- `--property-attribute` is the target node property the binding populates (e.g. `name`, `folderPath`, `connection`).
- `--resource-sub-type` provides sub-classification (e.g. `Agent`, `Process`).
- `binding delete` removes **all** bindings with the given resource key, not a single entry by ID.

Data shapes: `BindingAddSuccess` (`Data.Binding`), `BindingListSuccess` (`Data.Bindings[]`, `Count`), `BindingDeleteSuccess` (`Data.DeletedBindings[]`, `Count`).

---

## uip flow tidy

Auto-layout: reposition nodes in a `.flow` file to remove overlaps and arrange the graph cleanly.

```
uip flow tidy <file>
```

Data shape: `Code: "FlowTidy"`, `Data: { File, NodesTotal, EdgesTotal, NodesRepositioned }`.

## See also

- [`uip flow registry`](./uip-flow-registry.md) — discover node types
- [`uip flow validate`](./uip-flow-validate.md) — validate the edited `.flow`
- [`uip flow init`](./uip-flow-init.md)
- [Flow overview](./uip-flow.md)
