---
title: Inbound Rules and Groups
excerpt: Create one inbound rule per queue or DID, share schedules with rules groups, edit in bulk and import or export your rules.
order: 2
---

## Inbound rules

An inbound rule is what your call flow queries. It represents one entry point of your PBX (a queue or a DID) and holds the [time spans and exceptions](/en/docs/smart-routings/opening-hours) that decide where calls go.

Go to **Routings** > **Inbound rules** and click **Add rule**.

| Field | Description |
|---|---|
| **Name** | Required. Can be used by the call flow to identify the rule (`queue_name`). |
| **PBX** | Required. One of the 3CX PBXs connected to your account. |
| **Type of resource associated with the incoming rule** | **Queue** or **DID**. |
| **Resource associated with the incoming rule** | For a queue: the queue number (`queue_number` in the lookup). For a DID: a DID picked from the PBX. |
| **Default destination type** / **Default destination** | Optional. Stored with the rule and included in exports. |
| **Rules group** | Optional. Makes the rule follow the group's schedule (see below). |
| **Code** | Optional free code, for your own reference. |
| **Active** | Only active rules answer lookups. An inactive rule returns `404`. |

> [!WARNING]
> The default destination is **not** returned by the lookup endpoint. When no time span or exception matches, the lookup answers `404`: your call flow must handle that case with its own fallback route.

Click a rule to open it: its page shows the **time spans** and **exceptions** tables.

Deleting a rule also deletes its time spans and exceptions, including when you delete several rules at once, from the list or through the API.

### Bulk edit

Select several rules in the list and use **Edit selected** to change, in one go:

- **Active**
- **Default destination type**
- **Default destination**

Fields left on *Leave unchanged* are not modified. The same tables also support bulk deletion.

## Rules groups

A rules group is a **schedule template** shared by several inbound rules. Typical use: all the queues of a site share the same opening hours and public holidays.

1. Go to **Routings** > **Rules groups** and click **Add rules group**.
2. On the group page, add the time spans and exceptions (no destination at group level).
3. On each inbound rule, select the group in the **Rules group** field.

### How inheritance works

When a rule joins a group, every time span and exception of the group is copied to the rule as an **inherited row**. Any later change on the group (add, edit, delete) is pushed down to every rule of the group. Rows the rule already had before joining the group are kept.

| On a rule that belongs to a group | Allowed |
|---|---|
| Edit the **destination type** and **destination** of an inherited row | Yes |
| Edit the day, date, times, label or reference of an inherited row | No, edit the group |
| Delete an inherited row | No, delete it from the group |
| Add its own time spans, exceptions or public holidays | No, add them to the group |

Destinations are always set **per rule**: two rules of the same group share the same opening hours but can route to different destinations.

To stop following the group, open the rule and click **Dissociate group**. The inherited rows stay on the rule and become regular rows that you can edit or delete. Deleting a group has the same effect on all its rules.

> [!WARNING]
> Rows inherited from a group are created **without a destination**. After adding a time span, an exception or public holidays to a group, set the destination on each rule of the group, otherwise the lookup matches the row but returns an empty `destination`.

## Import and export

From **Routings** > **Inbound rules**:

- **Export** downloads `inbound_rules.xlsx`, with one row per time span.
- **Import** accepts `.xlsx`, `.xls` or `.csv` (`;` separator).

The easiest way to build an import file is to start from an export. The column names are on the second row, data starts on the third row.

| Column | Description |
|---|---|
| `name` | Rule name |
| `number` | Queue number or DID, depending on `type` |
| `type` | `queue` or `did` |
| `host_name` | PBX host name, must be one of the PBXs of your account |
| `group_name` | Rules group name, created if it does not exist |
| `active` | `1`, `true`, `vrai` or `x` for an active rule. Any other value, or an empty cell, imports the rule as **inactive** |
| `code` | Free code |
| `default_destination_type`, `default_destination` | Default destination |
| `day_of_week` | `1` (Monday) to `7` (Sunday) |
| `full_date` | Specific date, `YYYY-MM-DD` |
| `start`, `end` | `HH:MM:SS` |
| `destination_type`, `destination` | Destination returned during the time span |
| `reference` | Internal reference returned by the lookup |

To add several time spans to the same rule, repeat the rule columns on each row, or leave `type` and `number` empty on the following rows. A row creates a time span only if it has a day or a date **and** a destination.

Rules are matched on `type` + `number`: existing rules are updated, new ones are created.

> [!WARNING]
> For a rule outside a group, the import **replaces all its time spans** with the rows of the file. Exceptions are not part of the import or export.

The **Replace all** option also deletes the inbound rules that are not in the file, and the groups left without any rule.

If one row is invalid, the whole file is rejected and the error lists the faulty rows. Nothing is written.

## Automate with the API

Inbound rules, groups, time spans and exceptions can also be managed through the API, including bulk endpoints. See [CX-Engine API › Smart Routings](/en/docs/cx-api/smart-routings).
