---
title: "Add staged ModSecurity rule"
method: GET
path: "/modsec_add_rule"
tags: ["ModSecurity", "Rule Settings"]
---

# Add staged ModSecurity rule

`GET /modsec_add_rule`

This function adds a new rule to a ModSecurity™ configuration staging file. For example, if you choose to add a rule for the example.conf file, the function stages the rule in the example.conf. STAGE file.

**Important:**

  This function does not actually deploy the rule. To deploy the rule, use the WHM API 1 Functions - modsec_deploy_all_rule_changes function.

**Important:**

  When you disable the Web Server role, the system disables this function.

## Query parameters

- `config` string, required
- `rule` string, required

## Response `200`

HTTP Request was successful.

- object
  - `data` object
    - `rule` object — hash that contains information about the new ModSecurity rule. This hash includes the id , rule , disabled , meta_msg , and duplicate returns.
      - `config` unknown
      - `config_active` unknown
      - `disabled` 0 | 1 — Whether the rule is disabled. - 1 Disabled. - 0 Enabled.
      - `duplicate` 0 | 1 — Whether the rule already exists in the ModSecurity configuration staging file. - 1 Exists. - 0 Does not exist.
      - `id` integer — The ModSecurity rule's ID. A valid ModSecurity rule ID.
      - `meta_msg` string — The ModSecurity rule's description. A valid string.
      - `rule` string — The ModSecurity rule's text. A valid ModSecurity rule.
      - `staged` unknown
      - `vendor_active` unknown
      - `vendor_id` unknown
  - `metadata` object
    - `command` string — The method name called.
    - `reason` string — The reason the API function failed when the `metadata.result` field is 0. This field may display a success message when a function succeeds.
    - `result` 0 | 1 — * `1` - Success * `0` - Failed: Check the reason field for more details.
    - `version` integer — The version of the API function.

---

[API](https://skmtc.net/cpanel/apis/whm-api.md) · [All operations](https://skmtc.net/cpanel/apis/whm-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cpanel/whm-api/revisions/3da41671c02c/schema)
