# GET /security/modsec/rules

First published 19 Nov 2026 (release 0.2.30) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the security group.

List custom ModSecurity rules

- Who may call it: administrator
- Token scope, any of: security, read, all
- Answers: 200 OK

Returns the server-wide custom rules saved in UrbeStack, ordered by rule number. Each entry includes the rule text, its note, whether it is enabled, and whether it can refuse a request. Apache reads custom rules after the bundled rule set.

## As a command

- [urbestack-modsec-rules](https://urbestack.com/docs/commands/urbestack-modsec-rules.md): Lists the custom ModSecurity rules shown in the ModSecurity section of the web interface, in rule number order.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X GET "$API/security/modsec/rules" \
  -H "Authorization: Bearer $TOKEN"
```

Response, 200 OK:

```
{
  "enabled": 1,
  "file": "urbestack-panel-20260909T101500Z.json.enc",
  "numbers": {
    "first": 1,
    "last": 1
  },
  "rules": [
    {
      "apache": "text",
      "created_at": "2026-09-09T10:15:00Z",
      "created_by": "text",
      "enabled": true,
      "files_changed": 1,
      "note": "added by hand",
      "refuses": true,
      "rule": 1,
      "text": "text",
      "updated_at": "text",
      "updated_by": "text"
    }
  ],
  "total": 1,
  "yours": "text"
}
```

## Errors

- 401: Authentication required
- 404: No custom rule has the number <rule>
