Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function lists the cPanel account's Subaccounts.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/UserManager/list_users

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 the cPanel account's Subaccounts.
$UserManager = $cpanel->uapi(
    'UserManager', 'list_users',
	array(
		'flat'	=>	'0'
	)
);

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 the cPanel account's Subaccounts.
my $UserManager = $cpliveapi->uapi(
    'UserManager', 'list_users',
	{	
	'flat'	=>	'0'
	}
);

Note:

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

 

 cPanel Template Toolkit
<!-- List the cPanel account's Subaccounts. -->
[% execute('UserManager', 'list_users', ) %]

Note:

For more information, read our Guide to Template Toolkit documentation. 

 

 Command Line
uapi --user=username UserManager list_users

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. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{
	"metadata": {
		"transformed": 1
	},
	"messages": null,
	"status": 1,
	"errors": null,
	"data": [{
		"can_delete": 0,
		"guid": "EXAMPLE_LOGS::5762B073:8778C5434DD63FFB295260590367923F72122023BC7EFE5555A72348417F1C51",
		"dismissed_merge_candidates": [],
		"sub_account_exists": 0,
		"invite_expiration": null,
		"domain": null,
		"type": "service",
		"has_invite": 0,
		"parent_type": null,
		"alternate_email": null,
		"merge_candidates": [],
		"services": {
			"webdisk": {
				"enabled": 0
			},
			"email": {},
			"ftp": {
				"quota": "0.00",
				"enabled": 1,
				"homedir": "usr/local/apache/domlogs/example"
			}
		},
		"real_name": null,
		"synced_password": 0,
		"phone_number": null,
		"can_set_quota": 0,
		"special": 1,
		"username": "example_logs",
		"issues": [],
		"has_expired_invite": 0,
		"can_set_password": 0,
		"full_username": "example_logs",
		"dismissed": 0,
		"avatar_url": null,
		"has_siblings": 0
	}, {
		"has_siblings": 0,
		"avatar_url": null,
		"issues": [],
		"username": "example1",
		"dismissed": 0,
		"full_username": "example1@example.com",
		"has_expired_invite": 0,
		"can_set_password": 1,
		"synced_password": 1,
		"phone_number": null,
		"real_name": "John Doe",
		"special": 0,
		"can_set_quota": 0,
		"merge_candidates": [],
		"alternate_email": "john@example.com",
		"services": {
			"webdisk": {
				"private": 0,
				"perms": "rw",
				"enabledigest": 0,
				"homedir": "public_html/example.com/example1",
				"enabled": 1
			},
			"email": {
				"enabled": 1,
				"quota": 1024
			},
			"ftp": {
				"homedir": "public_html/example.com/example1",
				"quota": "0.00",
				"enabled": 1
			}
		},
		"type": "sub",
		"has_invite": 1,
		"parent_type": null,
		"invite_expiration": 1466258282,
		"sub_account_exists": 0,
		"domain": "example.com",
		"guid": "EXAMPLE1:EXAMPLE.COM:5762B06A:FE462165689213EB230D2222EFB42D4DBF78C3BEC79D18315071D2AA4CD42725",
		"can_delete": 1,
		"dismissed_merge_candidates": []
	}, {
		"parent_type": null,
		"has_invite": 0,
		"type": "cpanel",
		"services": {
			"ftp": {
				"enabled": 1
			},
			"email": {
				"enabled": 1
			},
			"webdisk": {
				"enabled": 1
			}
		},
		"merge_candidates": [],
		"alternate_email": null,
		"dismissed_merge_candidates": [],
		"guid": "EXAMPLE::5762B073:A6F3526F027034E62041E780C16900D519DEF5F51F7FEA3942BF962CA5559D41",
		"can_delete": 0,
		"domain": null,
		"invite_expiration": null,
		"sub_account_exists": 0,
		"dismissed": 0,
		"full_username": "example",
		"can_set_password": 0,
		"has_expired_invite": 0,
		"username": "example",
		"issues": [],
		"avatar_url": null,
		"has_siblings": 0,
		"special": 1,
		"can_set_quota": 0,
		"phone_number": null,
		"synced_password": 0,
		"real_name": null
	}]
}


Note:

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

   

Parameters

ParameterTypeDescriptionPossible valuesExample
flatBoolean

Whether to return Subaccounts with the same name under the merge_candidates array.

This parameter defaults to 0.

  • 1 — Do not return.
  • 0 — Return.
0

Returns

ReturnTypeDescriptionPossible valuesExample
alternate_emailstring

An alternate email address for the subaccount's user.

A valid email address. user@example.com
avatar_urlstring

The user's subaccount profile photo.

 A valid HTTPS URL that points to an image file.
 Click to view...

https://img.example.com/avatars/example.jpg

can_deleteBooleanWhether the cPanel account user can delete the subaccount.
  • 1 — Can delete.
  • 0Cannot delete.
0
can_set_passwordBoolean

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

 

  • 1 — Can change.
  • 0Cannot change.

Note:

The function returns a 0 value for subaccounts that inherit their password from the cPanel account.

1
can_set_quotaBooleanWhether the cPanel account user can change the subaccount's disk usage quota.
  • 1 — Can change.
  • 0Cannot change.
0
dismissedBoolean

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

Note:

Only service accounts return this value.

  • 1 — Dismissed.
  • 0 — Did not dismiss.
1
domainstringThe subaccount user's associated domain.A domain that the cPanel account owns.example.com
full_usernamestring

The subaccount's username and domain name.

A valid username, the @ character, and the associated domain.user@example.com
guidstring

The subaccount unique identifier.

The system assigned unique value.
 Click to view...

N4641:EXAMPLE.COM:564CC8A7:A82EA007D8348AC631C0170F9418EC1DEB0D164CC5A722A87C55EF5DD2AD98D4

issuesarrayInformation about any issues or problems with the subaccount.

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

 

type

string

The type of issue.

The function returns this value in the issues array.

  • error
  • warning
  • info
info

area

string

The affected section of cPanel & WHM.

The function returns this value in the issues array.

A valid section name.quota

service

string

The affected service.

The function returns this value in the issues array.

  • email
  • ftp
  • webdisk
email

message

string

The description of the issue.

The function returns this value in the issues array.

A valid string.Your account is over quota.

used

integer

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

The function returns this value in the issues array.

A positive integer.2000

limit

integer

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

The function returns this value in the issues array.

A positive integer.1500
merge_candidatesarrayAn array of hashes that represents the service accounts that the system could merge for this subaccount.This array contains 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_siblingsBooleanWhether the service account shares a full_username value with another service account.
  • 1 — Shares.
  • 0 — Does not share.
0
parent_typestringThe type of account that could own the service account.
  • sub — A subaccount.
  • hypothetical — A hypothetical subaccount that does not yet exist, but the user could create as part of a merge.
  • nullNot a merge candidate.

 

 hypothetical
phone_numberstringThe subaccount 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_namestring

The name of the subaccount's user.

  • A first name, a last name, or a first name and last name.
  • An empty string.
John Doe
serviceshashThis hash contains information about the subaccount's access to email, FTP, and Web Disk.This hash contains the email, ftp, and webdisk returns. 

email

hash

This hash contains the information that indicates the subaccount's email status.

The function returns this hash in the services hash.

This hash contains the enabled and quota returns.

 

enabled

Boolean

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

The function returns this value in the email hash.

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

quota

integer

The subaccount's email disk space quota.

The function returns this value in the email hash.

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

ftp

hash

This hash contains the information that indicates the subaccount's FTP status.

The function returns this hash in the services hash.

This hash contains the enabled, quota, and homedir returns.

 

enabled

Boolean

Whether the subaccount can access FTP.

The function returns this value in the ftp hash.

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

quota

integer

The subaccount's FTP disk space quota.

The function returns this value in the ftp hash.

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

homedir

string

The subaccount's FTP home directory.

The function returns this value in the ftp hash.

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

webdisk

hash

This hash contains information that indicates the subaccount's Web Disk status.

The function returns this hash in the services hash.

This hash contains the enabled, homedir, perms, and private returns.

 

enabled

Boolean

Whether the subaccount can access Web Disk.

The function returns this value in the webdisk hash.

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

homedir

string

The subaccount's Web Disk home directory.

The function returns this value in the webdisk hash.

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

perms

string

Whether to grant write permissions to the subaccount.

The function returns this value in the webdisk hash.

  • 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 webdisk hash.
  • 1 — Private (0700).
  • 0 — Public (0755).
0
specialBoolean

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

 

  • 1 — A special account.
  • 0Not a special account.
1
sub_account_existsBooleanWhether a subaccount exists with the same username.
  • 1 — Exists.
  • 0 — Does not exist.

Note:

The function returns a null value if the account is not a service account.

0
synced_passwordBoolean

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

  • 1 — Synchronized.
  • 0Not synchronized.

Note:

The function returns a null value if the account is not a subaccount.

0
type string

The type of account.

  • sub — A subaccount.
  • hypothetical — A hypothetical subaccount that does not exist, but that the user could create as part of a merge.
  • service — A service account.
  • cpanel — The cPanel account.
sub
usernamestring

The username for the subaccount.

A username that meets the subaccount name limitations.

  • Length — 64 characters
  • Characters — a-zA-Z0-9, dot (.), hyphen (-), underscore (_)

Note:

This value does not include the domain name.

example