v1

latestOpenAPI 3.0.2cPanel License2026-08-06657427.1 MB
DirectoryPrivacy
Directory Privacy

Enable or disable protected directory

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

get/DirectoryPrivacy/configure_directory_protection

Query parameters

authnamestring required
Example:protectandserve

The name of the directory protection authorization instance.

Note:

Only use this parameter when you enable password protection.

dirstring path required
Example:/home/example/example.com

The absolute or relative directory path for which to enable or disable password protection.

enabled0 | 1 required
Example:1

Whether to enable password protection for the directory.

  • 1 - Enable.
  • 0 - Disable.

Response

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "configure_directory_protection",
  "module": "DirectoryPrivacy",
  "result": {
    "data": {
      "auth_name": "protectandserve",
      "auth_type": "Basic",
      "passwd_file": "/home/example/.htpasswds/example.com/passwd",
      "protected": 1
    },
    "status": 1
  }
}