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

# Block agents

> Set which AI agents can read each of your websites. The relay sends a 403 to the agents that you block.

You set the access rules for each website. The relay sends a `403` to each request from an agent that you block. Your site does not get the request. The rules of one website do not change the rules of your other websites.

## Set the rules for a group

Open the website, go to **Traffic** and select the **Agents** tab. The card **Who may read** your hostname has one row for each group of agents:

| Group | Agents, for example |
| - | - |
| **Fetches for a person** | `ChatGPT-User`, `Claude-User`, `Perplexity-User` |
| **AI search indexing** | `OAI-SearchBot`, `Claude-SearchBot`, `PerplexityBot` |
| **Training** | `GPTBot`, `ClaudeBot`, `CCBot` |
| **Tools and scripts** | HTTP clients and scripts |
| **Search engines and link previews** | `Googlebot`, `Bingbot` |

Each row has **Allow** and **Block**. When you select **Block**, a dialog shows the agents in the group. Click the block button in the dialog to confirm. An agent with its own rule keeps that rule.

The relay cannot find search engines and link previews by name. Thus, for this group, **Block** is not available.

The row **Not identified** has no rule. These are requests from names that are not in the agent list.

You can set the rules before the relay records traffic. The relay applies them from its first request.

## Set a rule for one agent

An agent rule is more important than the group rule. You can set it in two places:

* In the **Who may read** card, open a group. For each agent, select **Group rule**, **Allow** or **Block**.
* Open the agent. In the **Access** card, turn on **Block on this website**.

The relay finds an agent by its token in the `User-Agent` header. If other agents have this token in their name, the **Access** card tells you which agents the block also stops.

## What the agent gets

```http theme={null}
HTTP/1.1 403 Forbidden
content-type: text/plain; charset=utf-8
x-waniwani-blocked: 1
cache-control: private, no-store
vary: user-agent

Forbidden
```

A `HEAD` request gets no body.

* The block applies to `GET` and `HEAD` requests on the paths where the relay runs. With **Every page**, the relay does not run on `/api/`, on `/_next/` or on files such as `/logo.png`.
* The relay checks only the requests that it finds as agent requests. See [Which requests are agent requests](https://docs.waniwani.ai/agent-traffic/middleware.md#which-requests-are-agent-requests).
* The relay records the request before it sends the `403`. Thus, blocked requests stay in your agent traffic.
* Blocking works when agent pages are off.

A change to a rule gets to the relay in approximately 2 minutes. You do not deploy again.

## What the relay needs

| Platform | Call in your code | Relay version |
| - | - | - |
| Vercel, Cloudflare, self-hosted Next.js | `serveAgentPage` | 0.6.0 or later |
| AWS CloudFront | `handleViewerRequest`, in `viewer-request.mjs` | The zip from the setup screen |
| ASP.NET on IIS | None. The module does it. | 0.7.1 or later |

When you block an agent, the setup screen gives you the code with this call. See the pages for [Vercel](https://docs.waniwani.ai/agent-traffic/vercel.md#with-agent-pages-or-blocking), [Cloudflare](https://docs.waniwani.ai/agent-traffic/cloudflare.md#with-agent-pages-or-blocking), [AWS CloudFront](https://docs.waniwani.ai/agent-traffic/cloudfront.md#with-agent-pages-or-blocking), [self-hosted Next.js](https://docs.waniwani.ai/agent-traffic/self-hosted.md#with-agent-pages-or-blocking) and [ASP.NET on IIS](https://docs.waniwani.ai/agent-traffic/aspnet.md). If your code does not have the call, the **Relay code** row in **Settings** shows **Needs a change**. See [Relay status](https://docs.waniwani.ai/agent-traffic/middleware.md#relay-status).

## Rules that the relay does not apply yet

* **Probing for secrets**: this row shows when agents asked for files such as `/.env`. You can set its rule, but the relay does not apply it yet.
* **Impersonators**: agents that use the name of a known agent with no proof. **Flag** and **Block** have no effect until Waniwani verifies signatures.

The recommendations next to each agent, such as **Allow**, **Block**, **Watch** and **Your call**, are only advice. They do not change a rule.


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