> ## 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.

# Switch

> Branch a workflow into several named cases, with a fallback for everything else.

The **Switch** node holds an ordered list of named cases, each with its own condition. It publishes one output port per case, plus an **Other** port for runs that match nothing. The first case whose condition matches wins.

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

## When to use Switch

* You have **three or more mutually exclusive paths**, such as one extraction schema per document type.
* You want a **named fallback** for unrecognized inputs, rather than a run that quietly stops.
* Use [if](/nodes/if) instead for a simple yes/no split.
* Use [classify](/nodes/classify) instead when the decision needs to read the document's content. Switch compares values you already have.
* Use [split](/nodes/split) instead when one upload holds several documents and each needs its own run. Switch picks a path; it does not fan a run out.

## Configuration

| Field     | Type | Required | Description                                                                                                                                                                                                                         |
| --------- | ---- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Cases** | list | Yes      | An ordered list of cases. Each has a **name** and a **condition** (a group of rules over upstream data, supporting AND/OR groups, nesting, and NOT). See [authoring a condition](/guides/conditional-routing#authoring-a-condition) |

Each case row can be renamed, reordered by dragging its handle, and removed. The case name becomes its port label on the canvas, so a descriptive name keeps the graph readable.

<Warning>
  A Switch node with no cases fails the step when the run reaches it. Open the node and add at least one case.

  Removing a case also removes any edge connected to that case's port.
</Warning>

### Order matters

Cases are evaluated top to bottom and the **first** match wins, so a run never leaves through two case ports. Put the most specific case first: a broad case placed above a narrow one will shadow it.

A case with no rules in its condition never matches, so a half-configured case is skipped rather than swallowing every run.

## Inputs and outputs

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

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

**Output ports:** one port per case, labeled with the case name, plus:

| Port      | Fires when      |
| --------- | --------------- |
| **Other** | No case matched |

Exactly one port fires. Leaving a port unconnected is fine: a run that leaves through an unconnected port stops there, and the run still completes. Connect **Other** whenever your cases are not exhaustive, so unrecognized inputs are handled instead of silently stopping.

The data on every port is the upstream output, unchanged.

## Credits

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

## Related

<CardGroup cols={2}>
  <Card title="If action" icon="code-branch" href="/nodes/if">
    A simple true/false split
  </Card>

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

  <Card title="Classify action" icon="tags" href="/nodes/classify">
    Branch on document type by rules or examples
  </Card>

  <Card title="Split action" icon="scissors" href="/nodes/split">
    Cut one upload into per-sub-document runs
  </Card>
</CardGroup>
