# Website firewall

The firewall in front of every site: whether it is on, and what it recently blocked.

## Website firewall of a site

`GET /sites/{site_id}/firewall` · scope `sites:read`

The same as the site's "Website firewall" tab: whether the firewall is on for this site, and the requests it recently refused (when, what was asked for, why, and the reference number the visitor was shown). Signing in, editing, uploads, plugin installs, the database tool and the file manager are never blocked. If something ordinary was blocked, open a ticket with its reference number. Switching the firewall off for a site is done by support.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `site_id` | path | integer | yes | The site id (see GET /sites). |
| `limit` | query | integer | no | How many recent blocks to return (newest first). Default: `25`. |

### Example

```bash
curl -s "https://app.pbn.ltd/api/v1/sites/123/firewall" \
  -H "Authorization: Bearer $PBN_API_KEY"
```

```python
import os
import requests

headers = {"Authorization": "Bearer " + os.environ["PBN_API_KEY"]}
r = requests.get("https://app.pbn.ltd/api/v1/sites/123/firewall", headers=headers, timeout=120)
print(r.status_code, r.json())
```

```javascript
const res = await fetch("https://app.pbn.ltd/api/v1/sites/123/firewall", {
  method: "GET",
  headers: {Authorization: `Bearer ${process.env.PBN_API_KEY}`}
});
console.log(res.status, await res.json());
```

### Response

`200`

```json
{
  "data": {
    "enabled": true,
    "recent": [
      {
        "when": "Thu Sep 24 21:46:47 2026",
        "method": "GET",
        "path": "/.env",
        "why": [
          "Restricted File Access Attempt"
        ],
        "reference": "462fee8ae8421f81e28f69c998e90369",
        "signed_in_visitor": false
      }
    ]
  }
}
```

Errors: `not_found`, `rate_limited`, `scope_missing`, `unauthorized`
