# Enable or disable protected directory

This function enables or disables password protection for a directory on the cPanel account.

Endpoint: GET /DirectoryPrivacy/configure_directory_protection
Version: 11.136.0.25
Security: BasicAuth

## Query parameters:

  - `authname` (string, required)
    The name of the directory protection authorization instance.

Note:

Only use this parameter when you enable password protection.
    Example: "protectandserve"

  - `dir` (string, required)
    The absolute or relative directory path for which to enable or disable password protection.
    Example: "/home/example/example.com"

  - `enabled` (integer, required)
    Whether to enable password protection for the directory.
* 1 - Enable.
* 0 - Disable.
    Enum: 0, 1

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "configure_directory_protection"

  - `module` (string)
    The name of the module called.
    Example: "DirectoryPrivacy"

  - `result` (object)

  - `result.data` (object)

  - `result.data.auth_name` (string)
    The authentication resource name.
    Example: "protectandserve"

  - `result.data.auth_type` (string)
    The directory's authentication type.
* Basic
* None
    Enum: "Basic", "None"

  - `result.data.passwd_file` (string)
    The path to the directory's password file.
    Example: "/home/example/.htpasswds/example.com/passwd"

  - `result.data.protected` (integer)
    Whether the directory uses password protection.
* 1 - Protected.
* 0 - Not protected.
    Enum: 0, 1

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.status` (integer)
    * 1 - Success.
* 0 - Failed. Check the errors field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


