/security/modsec/rules/{id}
0.2.30Unchanged since publicationUpdate a custom ModSecurity rule
securityallProvide at least one of text, note, or enabled. The API returns 400 if none is supplied or if id, text, or note fails validation. If text specifies a different rule number, that number must be unused by other custom rules and becomes the rule's new id. Numbers from 90000 onward are reserved for UrbeStack and the bundled rule set.
Enabling a rule or replacing the text of a rule that will remain enabled requires UrbeStack to manage ModSecurity and Apache to load the module. UrbeStack tests Apache's configuration before applying the change. If Apache rejects it, UrbeStack keeps the previous rule and returns Apache's error. You can disable a rule even if Apache would reject its text. The response contains the updated rule.
As a command
Run as root on the serverParameters
idpath ·integer, 1 to 89999RequiredRequest body
JSON· 3 fieldsenabledbooleannotestring, up to 200 characterstextstring, up to 8000 charactersExample
See the API overview for how to set $API and $TOKEN.curl -sS -X PATCH "$API/security/modsec/rules/1" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"note": "added by hand",
"text": "text"
}'200 OK{
"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"
}Errors
9 errors, each a status and a sentence400--enabled is on or off400A rule is named by its number400Nothing to set: give text, note or enabled400Nothing to set: give the text, what it is for, or on or off400Say which rule: --rule NUMBER400note is one line of up to 200 characters400text is the rule, as the engine reads it, up to 8000 characters401Authentication required409Rule <new.rule_id> is already another custom ruleurbestack.com/docs/api/patch-security-modsec-rules-id/