You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • UAPI Functions - Email::get_disk_usage
Skip to end of metadata
Go to start of metadata

Description

This function retrieves the disk space that an email account uses.

Important:

In cPanel & WHM version 76 and later, when you disable the Receive Mail role, the system disables this function.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Email/get_disk_usage?user=user&domain=example.com



Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// List disk usage for user@example.com.
$disk_used = $cpanel->uapi(
    'Email', 'get_disk_usage',
    array(
        'user'         => 'user',
        'domain'       => 'example.com',
        )
);


Note:

For more information, read our Guide to the LiveAPI System.


 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# List disk usage for user@example.com.
my $disk_used = $cpliveapi->uapi(
    'Email', 'get_disk_usage',
    {
        'user'         => 'user',
        'domain'       => 'example.com',
    }
);


Note:

For more information, read our Guide to the LiveAPI System.


 Command Line
uapi --user=username Email get_disk_usage user=user domain=example.com


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{  
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{  

   },
   "data":{  
      "domain":"example.com",
      "diskused":0,
      "user":"user",
      "login":"user"
   }
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

Required

The email account username.

A valid email account username on the cPanel account.

For example, user if the email address is user@example.com.

user
domainstring

Required

The email account's domain.

A valid domain on the cPanel account.

example.com

Returns

ReturnTypeDescriptionPossible valuesExample

diskused

numericThe disk space that the email account uses.
  • A positive floating-point value that represents the disk space, used in megabytes (MB).
  • 0 — The account posesses an unlimited disk quota.
399.6

login

string

The email address or the main account username.

  • A valid email address.
  • The main account's username.

user@example.com

domain

stringThe email account's domain.

The email account's domain.

For example, example.com if the email address is user@example.com.

example.com

user

stringThe email account username.

The email account's username.

For example, user if the email address is user@example.com.

user