# SubDomain

The SubDomain module for UAPI.

## Create subdomain

 - [GET /SubDomain/addsubdomain](https://api.docs.cpanel.net/specifications/cpanel.openapi/subdomain/subdomain-addsubdomain.md): This function creates a subdomain.

Important:

When you disable the Web Server role, the system disables this function.

## Remove a subdomain

 - [GET /SubDomain/delsubdomain](https://api.docs.cpanel.net/specifications/cpanel.openapi/subdomain/subdomain-delsubdomain.md): This function removes a subdomain from the cPanel account.

Important:

- If any addon domain is parked on the subdomain, the system refuses to
  remove it and names the addon domains in the errors field. Remove
  those addon domains first with the
  AddonDomain::deladdondomain function.
- This function does not remove the subdomain's document root or the
  files in it.

When you disable the Web Server role,
the system disables this function.

## List the reserved subdomain names

 - [GET /SubDomain/getreservedsubdomains](https://api.docs.cpanel.net/specifications/cpanel.openapi/subdomain/subdomain-getreservedsubdomains.md): This function lists the subdomain labels that the system reserves, and
that an account therefore cannot use to create a subdomain.

Note:

The returned labels are not sorted.

## List the subdomains

 - [GET /SubDomain/listsubdomains](https://api.docs.cpanel.net/specifications/cpanel.openapi/subdomain/subdomain-listsubdomains.md): This function lists the subdomains on the cPanel account, including the subdomains that the account's addon domains are parked on.

## Return the subdomain validation pattern

 - [GET /SubDomain/validregex](https://api.docs.cpanel.net/specifications/cpanel.openapi/subdomain/subdomain-validregex.md): This function retrieves the regular expression that the system uses to
validate a subdomain label.

Note:

Use this value to validate a subdomain label in an interface before you
call the SubDomain::addsubdomain function. It does not replace the
server-side validation that SubDomain::addsubdomain performs.

