---
title: Switch
description: Route items to any number of named branches, with a fallback for the rest
---

Send each item down one of several named branches, with a fallback branch for the rest.

## Try it

## What it does

Switch has one output per rule you add, named after the rule, plus a fallback output for items that match no rule. [IF](/nodes/builtin/flow/if/) gives you two branches; Switch gives you as many as you need, without nesting IF nodes.

There are two ways to pick the branch, set with **Mode**:

* **Rules**: each rule has its own **Conditions**, built like the ones in IF. Rules are tried from top to bottom, and by default the first one that matches wins, so put narrow rules above broad ones. A rule with no conditions never matches.
* **Expression**: one value, **Value To Match**, is compared with each rule's **Output Name**. The item goes to the branch whose name is exactly that value. The comparison is done as text, so the number `200` matches a branch named `200`.

Items that match nothing go to the fallback branch (**Anything else** by default). Turn off **Add A Fallback Branch** and they are dropped instead. Set **On Multiple Matches** to **Every match** to send an item to every branch it matches.

## When to use it

* Route items to **Billing**, **Bug** or **Other** depending on words in their title (Rules mode).
* Split a list by a status or category field whose values are the branch names (Expression mode).
* Handle three or more cases where you would otherwise chain IF nodes.

For two branches, [IF](/nodes/builtin/flow/if/) is simpler. To drop non-matching items, use [Filter](/nodes/builtin/flow/filter/).

## Inputs and settings

* In **Expression** mode, rules only need an **Output Name**; their conditions are ignored. Set **Value To Match** to the field to compare, for example `{{ $input.status }}`, and name the rules after the possible values (`open`, `closed`). Matching is case-sensitive.
* A rule left without a name is called `Rule 1`, `Rule 2`, and so on. Two rules with the same name get a suffix, such as `Urgent (2)`.

## Outputs

More ports appear as you add them in the settings (one per rule).

Items leave unchanged through the branch they took. Connections are tied to the branch **name**: reordering rules keeps every connection in place, but renaming a rule removes the connection that left it, and the canvas tells you so.

## Dependencies and credentials

None. This node needs no connection and has no slots for other nodes.

## Example workflow

Handle support tickets by status:

1. [Http Request](/nodes/builtin/core/http-request/) gets `https://api.example.com/tickets`, which returns a list of tickets.
2. [Split Out](/nodes/builtin/datatransformation/splitout/) with **Field To Split Out** `data` and **Output field name** `ticket` makes one item per ticket.
3. Switch with **Mode** **Expression**, **Value To Match** `{{ $input.ticket.status }}`, and two rules named `urgent` and `open`. Keep the fallback named `Anything else`.
4. From **urgent**: [Slack](/nodes/builtin/integration/slack/) posts `{{ $input.ticket.title }}` to your support channel. From **open**: [Todoist](/nodes/builtin/integration/todoist/) creates a task. Leave **Anything else** unconnected to ignore the rest.

## Common issues

* **"Switch needs at least one rule. Add one, and name the branch it routes to."** Add a rule under **Rules**.
* **"No source node is connected to this node."** Connect a node to the Switch input.
* **Everything goes to the fallback.** In **Rules** mode, a rule without conditions never matches, so check each rule has its conditions. In **Expression** mode, the value must equal an **Output Name** exactly, including capital letters and spaces.
* **A connection disappeared after editing a rule.** You renamed the rule, which disconnects its branch. Reconnect it from the new name.
* **An item went down only one branch although it matched two.** **On Multiple Matches** is **First match only**. Switch it to **Every match**.

## Related nodes

* [IF](/nodes/builtin/flow/if/): two branches, true or false.
* [Filter](/nodes/builtin/flow/filter/): keep only matching items.
* [Funnel](/nodes/builtin/flow/funnel/): bring the branches back together afterwards.
* [Text Classifier](/nodes/builtin/ai/aiagents/textclassifiernode/): let an AI model pick the category first.