---
title: "Action switch"
description: "Multi-branch routing: the first true condition returns its event name."
---

# Action `switch`

> **System ID:** `action_switch`

## Description

Evaluates conditions in order (object keys are event names, values are expressions). Returns the name of the first true condition. Supports comparisons, single-quoted strings, `*` (AND) and `+` (OR), and placeholders.

## Events (scenario branches)

| Event | When it occurs |
|-------|----------------|
| **(key from config)** | Matching condition is true (first match) |
| **error** | Expression parse error |
| *(no branch)* | No condition matched |

## Parameters

There are no fixed parameters. The config is a JSON object: key = event name, value = condition.

| Element | Type | Required | Default | Description |
|---------|------|----------|---------|-------------|
| *(arbitrary keys)* | string | no | — | Condition expression (placeholders, comparisons, `*` / `+`) |

It is recommended to add a fallback branch, e.g. `"default": "true"`.

## Configuration example

```json
{
  "low": "{{score}} < 50",
  "medium": "({{score}} >= 50)*({{score}} < 80)",
  "high": "{{score}} >= 80",
  "default": "true"
}
```

## Related docs

- [Actions reference](/en/actionjail/reference/actions-reference.md)
