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

# Blocking rules

> Block traffic by IP address, country, user agent or request rate.

**Where:** Observability → Rules → Create Rule

The **Rules** tab opens with four counters: **Total Rules**, **Active Rules**, **Blocks Today** and **Blocks This Week**. Filter the table by **Status** (**Active** or **Inactive**). Its columns are **Name**, **Type**, **Priority**, **Blocks**, **Created**, **Status** and actions (**Edit rule**, **Delete rule**). Click a row for its details. A rule can also be **Expired**.

| Field | What to enter | Rules and defaults |
| - | - | - |
| **Rule Name** | For example `Block suspicious IPs` | Required |
| **Rule Type** | **IP Blocking**, **Country Blocking**, **User Agent Blocking** or **Rate Based Blocking** | Required. Default **IP Blocking**. The fields below depend on the type |
| **IP Addresses to Block** | One or more addresses, such as `192.168.1.1`. **Add IP Address** adds a row | IP Blocking. At least one. Each must be a valid IPv4 address (`Please enter a valid IP address`). Ranges are not accepted |
| **Countries to Block** | Pick from the list, for example `United States (US)` | Country Blocking. At least one. The list offers US, CN, RU, IN, JP, DE, GB, FR, BR, CA, AU, KR, MX, ES and IT |
| **User agent patterns** | A pattern such as `.*bot.*`. Add more rows for more patterns | User Agent Blocking. At least one pattern |
| **Request Threshold** | Requests allowed in the window, for example `100` | Rate Based Blocking. 1 to 10,000. Counted for each client IP |
| **Time Window (seconds)** | The window, for example `60` | Rate Based Blocking. 1 to 3,600 |
| **Reason for Blocking** | For example `Security threat, Abuse prevention` | Required. Up to 500 characters. Callers see it in the error |
| **Priority** | A number | Optional. Default 100. Higher values are checked first |

Click **Create Rule** (**Update Rule** when editing). The button stays disabled until the required fields are filled.

A blocked request gets **HTTP 403** with the body `{"error":"forbidden","message":"..."}`. If you gave a reason the message is that reason. Otherwise it reads `IP <address> is blocked`, `Country <code> is blocked`, `User agent matches blocked pattern` or `Rate limit exceeded`.

> [!WARNING]
>
> An IP or country rule applies to all traffic through the gateway, including your own team. Check the address or country before you save.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.