UAPI Functions - UserManager::delete_user

Description

This function deletes a subaccount. This function returns only metadata if no other service accounts exist with the same username and domain. 

  • If one service account uses the same username and domain, the function returns the service account's information.
  • If two or more service accounts use the same username and domain, the function returns a hypothetical subaccount. 

Note:

A hypothetical subaccount consists of two or more service accounts that use the same username and domain.

Examples


 cPanel or Webmail Session URL

https://hostname.example.com:2083/cpsess##########/execute/UserManager/delete_user?username=example1&domain=example.com

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// Deletes the subaccount.
$Usermanager $cpanel->uapi(
    'UserManager''delete_user',
  array(
        'username'        => 'example1',
        'domain'          => 'example.com',
        )
);

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
# Deletes the subaccount.
my $Usermanager $cpliveapi->uapi(
    'UserManager''delete_user',
   {
        'username'        => 'example1',
        'domain'          => 'example.com',
   }
);

 cPanel Template Toolkit

<!-- Deletes the subaccount. -->
[% execute('UserManager', 'delete_user', {'username' => 'example1', 'domain' => 'example.com',} ) %]

 Command Line

uapi --user=username UserManager delete_user username=example1 domain=example.com

 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.

 Output (JSON)

{
    "messages": null,
    "errors": null,
    "status": 1,
    "metadata": {},
    "data": null
}

 

Note:

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

 

Parameters

 Parameter 

Type

Description

Possible values

Example

username

 string 

Required

The subaccount's username.

 

A username that meets the account name limitations.

  • Length — 64 characters
    • Characters — a-z, A-Z, 0-9, dot (.), hyphen (-), underscore (_) 

Note:

This value does not include the domain name.

example

domain

string

Required

 The subaccount's associated domain. 

A domain that the cPanel account owns.

 example.com 

 

Returns

 

Note:

This function returns only metadata if the specified username and domain do not match any service accounts or hypothetical subaccounts.

 

Return

Type

Description

Possible values

Example

alternate_email

string

An alternate email address for the account's user.

A valid email address.

 user@example.com

avatar_url

string

The user's account profile photo.

 

A valid HTTPS URL that points to an image file.

 

can_delete

Boolean

Whether the cPanel account user can delete the account.

  • 1 — Can delete.
  • 0 — Cannot delete.

0

can_set_password

Boolean

Whether the cPanel account user can  change the account's password.

 

  • 1 — Can change password.
  • 0 — Cannot change password.

Note:

The function returns 0 for accounts that inherit their password from the cPanel account.

1

can_set_quota

Boolean

Whether the cPanel account user can  change the  account's disk usage quota.

  • 1 — Can change quota.
  • 0 — Cannot change quota.

0

dismissed

Boolean

Whether the cPanel account user  dismissed the merge prompt for the service account.

Note:

Only service accounts return this value.

  • 1 — Dismissed prompt.
  • 0 — Did not dismiss prompt.

1

domain

string

The account user's associated domain.

A domain that the cPanel account owns.

example.com

full_username

string

The account's username and domain name.

 A valid username, the @ character, and the associated domain.

 user@example.com 

guid

string

The accountunique identifier.

The system-assigned unique value.

 

issues

array

Information about any issues or problems with the account.

This array includes the type, area, service, message,used, and limit returns.

 

type

string

The type of issue.

The function returns this value in the issuesarray.

  • error
  • warning
  • info

info

area

string

The affected section of cPanel & WHM.

quota

quota

service

string

 The affected service.

The function returns this value in the issuesarray.

  • email
  • ftp
  • webdisk

email

message

string

The description of the issue.

The function returns this value in the issuesarray.

A string value.

 Your account is over quota.

used

integer

The number of  Megabytes (MB) that the account currently uses.

The function returns this value in the issuesarray.

A positive integer.

2000

limit

integer

The set quota  Megabyte (MB)  limit for the affected account.

The function returns this value in the issuesarray.

A positive integer.

1500

merge_candidates

array

 The service accounts that the system could merge for this account.

This array includes  the alternate_email, avatar_url,can_delete, can_set_password, can_set_quota,dismissed, domain, full_username, guid,has_siblings, issues, merge_candidates,parent_type, phone_number, real_name, services,special, sub_account_exists, synced_password, type, and username returns.

 

has_siblings

Boolean

Whether the service account shares afull_usernamevalue with another service account.

  • 1 — Shares.
  • 0 — Does not share.

0

parent_type

string

The type of account that could own the service account.

  • sub — An account.
  • hypothetical — A hypothetical account that doesnot yet exist, but that the user could create as part of a merge.
  • null— Not a merge candidate.

 

 hypothetical

phone_number

string

The account user's phone number.

A valid phone number that conforms to ITU-T's E.164-recommended standard for the representation of telephone numbers.

+15551234567

real_name

string

The name of the account's user.

  • A first name, a last name, or a first name and last name.
  • An empty string.

John Doe

services

hash

Information about the account's access to email, FTP, and Web Disk.

This hash includes the email, ftp, and webdisk returns.

 

email

hash

Information that indicates the account's email status.

The function returns this value in the serviceshash.

This hash includes the enabled and quota returns.

 

enabled

Boolean

 Whether the account can access Webmail, POP, and IMAP services.

The function returns this value in the emailhash.

  • 1 — Can access.
  • 0 — Cannot access.

1

quota

string

The account's email disk space quota.

The function returns this value in the emailhash. 

  • A positive integer between 1 and 999999 that represents the maximum disk space that the account may use, in Megabytes (MB).
  • 0 — Unlimited.

100

ftp

hash

Information about the account's FTP status.

The function returns this value in the serviceshash. 

This hash includes the enabled, quota, and homedirreturns.

 

enabled

Boolean

 Whether the account can access FTP.

The function returns this value in the ftp hash.

  • 1 — Can access.
  • 0 — Cannot access.

0

quota

integer

The account's FTP disk space quota.

The function returns this value in the ftp hash. 

  • An integer that represents the account's maximum FTP disk usage, in Megabytes (MB). 
  • 0 — Unlimited.

100

homedir

string

The account's FTP home directory.

The function returns this value in the ftp hash. 

A valid path, relative to the cPanel account's home directory.

/account

webdisk

hash

Information about the account's Web Disk status.

The function returns this value in the serviceshash. 

This hash includes the enabled, homedir, perms, andprivate returns.

 

enabled

Boolean

 Whether the account can access Web Disk.

The function returns this value in the webdiskhash. 

  • 1 — Can access.
  • 0 — Cannot access.

0

homedir

string

The account's Web Disk directory.

The function returns this value in the webdiskhash. 

A valid path, relative to the cPanel account's home directory.

/bob

perms

string

Whether to grant  write permissions to the account.

 The function returns this value in the webdiskhash. 

  • ro — Read-only permissions.
  • rw — Read and write permissions.

rw

private

Boolean

Whether to set the  Web Disk directory's  permissions to public or private.

The function returns this value in the webdiskhash. 

  • 1 — Private (0700).
  • 0 — Public (0755).

0

special

Boolean

Whether the account is a system-created special account that the usercannot remove.

 

  • 1 — A special account.
  • 0 — Not a special account.

1

 sub_account_exists 

Boolean

Whether an account exists with the same username.

  • 1 — Exists.
  • 0 — Does not exist.

Note:

The function returns a null value if the account isnot a service account.

0

synced_password

 Boolean 

Whether the user  has synchronized the passwords for each of the account's service accounts.

  • 1 — Synchronized.
  • 0 — Not synchronized.

Note:

The function returns a null value if the account isnot a subaccount.

0

type

 string

 The type of account.

  • hypothetical — A hypothetical account that does not exist, but that the user could create as part of a merge.
  • service — A service account.

sub

username

string

The account username.

 

A username that meets the account name limitations.

  • Length — 64 characters
  • Characters — a-z, A-Z, 0-9, dot (.), hyphen (-), underscore (_)

Note:

This value does not include the domain name.

example

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....