# cPanel API 2 Functions - WebDisk::addwebdisk

Warning:
The cPanel API 2 system is deprecated. We **strongly** recommend that you use [UAPI](/cpanel/introduction) instead of cPanel API 2.

## Description

This function creates a Web Disk account.

Warning:
We **strongly** recommend that you use [UAPI](/cpanel/introduction/) instead of cPanel API 2. However, no equivalent UAPI function exists.

Important:
When you disable the [*Web Disk* role](https://docs.cpanel.net/knowledge-base/general-systems-administration/how-to-use-server-profiles/#roles), the system **disables** this function.

## Examples

WHM API (JSON)


```undefined syntaxhighlighter-pre
https://hostname.example.com:2087/cpsess###########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=WebDisk&cpanel_jsonapi_func=addwebdisk&domain=example.com&user=user&password=12345luggage&homedir=%2Fhome%2Fexample%2Fpublic_html%2Fwebdav%2F&private=0&enabledigest=1&perms=rw
```

Note:
For more information, read our [Calls from the WHM API](/whm/use-whm-api-to-call-cpanel-api-and-uapi) documentation.

LiveAPI PHP Class


```undefined syntaxhighlighter-pre
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.

// Create the "user@example.com" webdisk account with password "12345luggage"
$create_webdisk = $cpanel->api2(
    'WebDisk', 'setstatus',
 array(
        'domain' => 'example.com',
        'user' => 'user',
        'password' => '12345luggage',
        'homedir' => 'public_html/webdav/',
        'private' => '1',
        'enabledigest' => '1',
        'perms' => 'rw',
  )
);
```

Note:
For more information, read our [Guide to the LiveAPI System](/guides/guide-to-the-liveapi-system/#guide-to-the-liveapi-system).

LiveAPI Perl Module


```undefined syntaxhighlighter-pre
my $cpliveapi = Cpanel::LiveAPI - > new();#
Connect to cPanel - only do this once.
    #
    Create the "user@example.com"
webdisk account with password "12345luggage"
my $create_webdisk = $cpliveapi - > api2(
    'WebDisk', 'setstatus', {
        'domain' => 'example.com',
        'user' => 'user',
        'password' => '12345luggage',
        'homedir' => 'public_html/webdav/',
        'private' => '1',
        'enabledigest' => '1',
        'perms' => 'rw',
    }
);
```

Note:
For more information, read our [Guide to the LiveAPI System](/guides/guide-to-the-liveapi-system).

cPanel Tag System (deprecated)

Warning:
- cPanel tags are **deprecated**. We **strongly** recommend that you **only** use the [LiveAPI](/guides/guide-to-the-liveapi-system) system to call the cPanel APIs. Examples are **only** present in order to help developers move from the old cPanel tag system to our [LiveAPI](/guides/guide-to-the-liveapi-system).
- cPanel API 2 calls that use cPanel tags vary in code syntax and in their output.
- For more information, read our [Deprecated cPanel Tag Usage](/cpanel-api-2/cpanel-api-2-deprecate-cpanel-tag-usage/) documentation.


Command Line


```undefined syntaxhighlighter-pre
cpapi2 --user=username WebDisk addwebdisk domain=example.com user=user password=12345luggage homedir=public_html%2Fwebdav%2F private=1 enabledigest=1 perms=rw
```

div
Notes:

- You **must** URI-encode values.
- `username` represents your account-level username.
- You **must** include the `--user=username` option.
- For more information and additional output options, read our [Guide to cPanel API 2](/cpanel-api-2/) documentation or run the `cpapi2 --help` command.
- If you run CloudLinux™, you **must** use the full path of the `cpapi2` command:

```undefined syntaxhighlighter-pre
/usr/local/cpanel/bin/cpapi2
```


br
Output (JSON)


```undefined syntaxhighlighter-pre
{
    "cpanelresult": {
        "apiversion": 2,
        "func": "addwebdisk",
        "data": [
            {
            "enabledigest": 1,
            "domain": "example.com",
            "user": "user",
            "perms": "rw",
            "login": "user@example.com"
                }
        ],
        "event": {
            "result": 1
        },
        "module": "WebDisk"
    }
}
```

Note:
Use cPanel's *[API Shell](https://docs.cpanel.net/cpanel/advanced/api-shell-for-cpanel)* interface (*cPanel >> Home >> Advanced >> API Shell*) to directly test cPanel API calls.

## Parameters

table
thead
tr
th
Parameters
th
strong
Type
th
strong
Description
th
strong
Possible values
th
strong
Example
tbody
tr
td
code
domain
td
em
string
td
p
strong
Required
p
The account's domain name.
td
A valid domain name.
td
code
example.com
tr
td
code
user
td
em
string
td
p
strong
Required
p
The account's username.
td
A valid username.
td
code
user
tr
td
code
password
td
em
string
td
p
The account's password.
p
You 
strong
must
 use either the 
code
password
 parameter or the 
code
password_hash
 parameter, but you 
strong
cannot
 use both.
td
A valid password.
td
code
12345luggage
tr
td
code
perms
td
em
string
td
p
strong
Required
p
Whether to grant a user write permissions to the user.
td
ul
li
code
rw
 — Read-Write permissions.
li
code
ro
 — Read-only permissions
td
code
ro
tr
td
code
homedir
td
em
string
td
p
The path to account's directory.
td
A valid directory path, 
span
relative to the cPanel account's home directory.
td
code
public_html/webdav/
tr
td
code
private
td
em
Boolean
td
p
Whether to set the directory's permissions to public or private.
p
This value defaults to 
code
0
.
td
ul
li
code
1
 — Private (
code
0700
).
li
code
0
 — Public
span
 (
code
0755
span
).
td
code
1
tr
td
code
enabledigest
td
em
Boolean
td
p
Whether to enable Digest Authentication.
p
span
This value defaults to 
code
0
span
.
td
ul
li
code
1
 — Enable Digest Authentication.
li
code
0
 — Disable Digest Authentication.
td
code
1
tr
td
code
password_hash
td
em
string
td
p
The account's password hash.
p
You 
strong
must
 use either the 
code
password
 parameter or the 
code
password_hash
 parameter, but you 
strong
cannot
 use both.
p
p
We introduced this parameter in cPanel 
&
 WHM version 54.
td
p
A valid password hash that utilizes your server's cryptographic hash function.
p
You can find your server's hash type in the 
code
/etc/sysconfig/authconfig
 file.
td
div
div
div
p
code
$6$1sOyHP5ZDYp3pGUz$R0TSgfPRHfDjT5PP5RJGv39FhiGTNNPvM7IFpCBjXijMmlMZk9yI8T3LqGuntc9fdKb5eX.lGL7wBS9e4DAWn/
tr
td
code
digest_auth_hash
td
em
string
td
p
The account's digest authentication hash.
p
You 
strong
must
 use this parameter if you use the 
code
password_hash
 parameter.
p
p
span
We introduced this parameter in cPanel 
&
 WHM version 54.
td
p
A valid digest authentication hash that uses the MD5 cryptographic hash function.
p
For more information, read Wikipedia's 
a
Digest Access Authentication
 documentation.
td
div
div
div
p
code
6ca48e22b86fa074b72ef0e598ea9d66
## Returns

table
thead
tr
th
strong
strong
Return
th
strong
Type
th
strong
Description
th
strong
Possible values
th
strong
Example
tbody
tr
td
code
domain
td
em
string
td
The account's domain name.
td
A valid domain name.
td
code
example.com
tr
td
code
user
td
em
string
td
The account's username.
td
A valid username.
td
code
user
tr
td
p
code
perms
td
em
string
td
The account's permissions.
td
ul
li
code
rw
 — Read-Write permissions.
li
code
ro
 — Read-only permissions
td
code
rw
tr
td
code
login
td
em
string
td
The account's full username.
td
The full username, which includes the at symbol (
code
@
) and the domain name.
td
code
user@example.com
tr
td
code
reason
td
em
string
td
p
A reason for failure.
p
This function only returns a 
code
reason
 value if it failed.
td
p
A string that describes the error.
td
code
This is an error message.
tr
td
code
result
td
em
boolean
td
p
Whether the function succeeded.
td
ul
li
code
1
 — The function succeeded.
li
code
0
 — The function failed.
td
code
1