> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ingestly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# If

> Split a workflow into a true path and a false path with a single condition.

The **If** node evaluates one condition over upstream data and sends the run down one of two ports: **True** or **False**. It is the simplest way to branch a workflow.

If never changes the data. It passes the incoming output straight through, so downstream nodes keep referencing the node *above* the If, not the If itself.

## When to use If

* You need a **yes/no split**: high-value invoices go to a review queue, everything else continues.
* You want to **skip an optional step** for some documents, by leaving one of the two ports unconnected.
* Use [switch](/nodes/switch) instead when you have three or more mutually exclusive cases. A chain of If nodes for the same field is harder to read than one Switch.
* Use [classify](/nodes/classify) instead when the decision needs to read the document's content. If compares values you already have.
* Use [filter](/nodes/filter) instead when you want to narrow the pages of one document rather than pick a path.

## Configuration

| Field         | Type             | Required | Description                                                                                                                                                   |
| ------------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Condition** | condition editor | Yes      | A group of rules over upstream data. Supports AND/OR groups, nesting, and NOT. See [authoring a condition](/guides/conditional-routing#authoring-a-condition) |

The condition can reference the node directly upstream and any of its ancestors. Type `{{` in a **Field** or **Value** box to autocomplete.

<Warning>An If node with no condition fails the step when the run reaches it. Open the node and add at least one rule.</Warning>

## Inputs and outputs

**Allowed inputs:** every trigger and every action node, including another If or Switch.

The condition resolves against the incoming node's output and that node's ancestors, so anything upstream is available to compare.

**Output ports:**

| Port      | Fires when                       |
| --------- | -------------------------------- |
| **True**  | The condition evaluated to true  |
| **False** | The condition evaluated to false |

Exactly one of the two fires. Leaving a port unconnected is fine: a run that leaves through an unconnected port simply stops there, and the run still completes.

The data on both ports is the upstream output, unchanged.

## Credits

The If node costs 0 credits. It only compares values that already exist in the run.

## Related

<CardGroup cols={2}>
  <Card title="Switch action" icon="code-branch" href="/nodes/switch">
    Branch into three or more named cases
  </Card>

  <Card title="Conditional routing guide" icon="book" href="/guides/conditional-routing">
    How ports, conditions, and operators fit together
  </Card>

  <Card title="Validation action" icon="circle-check" href="/nodes/validation">
    Validate data and branch on valid or invalid
  </Card>

  <Card title="Transform action" icon="arrows-rotate" href="/nodes/transform">
    Compute a flag upstream, then branch on it
  </Card>
</CardGroup>
