---
title: "Update ModSecurity configuration"
method: GET
path: "/modsec_set_setting"
tags: ["ModSecurity", "Server Settings"]
---

# Update ModSecurity configuration

`GET /modsec_set_setting`

This function sets a global ModSecurity™ configuration directive.

**Important:**

When you disable the [Web Server role](https://go.cpanel.net/howtouseserverprofiles#roles), the system **disables** this function.

## Query parameters

- `setting_id` integer, required
- `state` string, required

## Response `200`

HTTP Request was successful.

- object
  - `data` object
    - `default` string — The setting's default value.
    - `description` string — The setting's description.
    - `directive` string — The setting's Apache® directive.
    - `name` string — The setting's name.
    - `radio_options` object[] — An array of objects with the options that the client should display, as buttons, for this setting in a user interface. **Note:** The function **only** returns this array of objects when you set the `type` parameter's value to `radio`.
      - `name` string — The setting name to display to the user. The user's [locale](https://go.cpanel.net/localedocs) may translate this value.
      - `option` string — The setting that the system used to select the setting's state. **Note:** This value is identical to the string that the client sends in as `state` value when users select the specified setting. In most cases, you should **not** display this value to the user. Instead, display the `name` value.
    - `setting_id` integer — The setting's ID.
    - `state` integer — The setting's new state.
    - `type` 'text' | 'radio' | 'number' — The type of UI control that the client should use to represent the setting. * `text` - WHM users modify this setting via a text box. * `radio` - WHM users modify this setting via a radio button. - **Note:** If the `type` parameter's value is `radio`, the function also returns the `radio_options` array of objects. * `number` - WHM users modify this setting via a text box that only allows numeric values.
    - `url` string, url — The URL for the setting's documentation.
    - `validation` union[] — A validator or array of validators to apply. Use these validators to perform frontend validation through your preferred implementation methods. **Note:** The function may represent each validator as either a string or an object. * When the function represents the validator as a string, no arguments exist for the validator. * When the function returns the validator as a object, the API may also include an argument for the validator.
      - union
        - object — A JSON object string that contains one or more arguments for the validator.
          - `arg` string — The regular expression pattern that is used with `name` when the validator checks a user's input.
          - `name` string — The method that determines where the validator should match a pattern in a user's input.
        - 'path' | 'honeypotAccessKey' | 'positiveInteger' — A string that is one of the following values: * `path` - An instruction to verify whether the user's input is a valid path. * `honeypotAccessKey` - An instruction to verify whether the user's input fits the constraints of an `Http:BL` API access key. * `positiveInteger` - An instruction to verify whether the user's input is a positive integer.
  - `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)
