Domain Listing via UAPI for cPanel User

  Uncategorized

This document provides details on using the uapi command-line tool to list all domains associated with a specific cPanel user account. The example focuses on retrieving domain information for the user < cpanel username > using the DomainInfo::list_domains function of the Universal API (UAPI).

Command Used

uapi --user=<cpanelusername> DomainInfo list_domains

This command queries and lists all domain-related data for the user, including:

  • Main domain
  • Addon domains
  • Parked domains (aliases)
  • Subdomains

Prerequisites

Before executing the command, ensure the following conditions are met:

  1. The server has a valid cPanel installation with UAPI available.
  2. SSH access is available with sufficient privileges (typically root).
  3. The user pheonixsolutions exists on the server and has domain configurations.
  4. The uapi tool is accessible in the server’s environment path (default on cPanel systems).

Output Structure

Upon successful execution, the output will include structured data in YAML format (or JSON if specified). The primary components returned are:

  • main_domain: The primary domain of the cPanel account.
  • addon_domains: A list of additional domains hosted under the same user.
  • parked_domains: Domains pointing to the main domain (aliases).
  • sub_domains: Subdomains created under the main or addon domains.
  • status: Status code indicating success (1) or failure (0).
  • errors, warnings, messages: Optional fields providing additional context.

Example Output (Truncated for Brevity)

data:
  addon_domains:
    - example1.com
    - example2.in
  main_domain: example.com
  parked_domains: []
  sub_domains:
    - app.example1.com
    - billing.example2.in
status: 1

Use Cases

  • Verifying domain ownership and mappings
  • Auditing hosted domains under a specific user
  • Assisting in domain migration or restructuring
  • Generating reports for support or compliance

Conclusion

The uapi --user=username DomainInfo list_domains command is a reliable method for retrieving detailed domain information for a given cPanel user. It helps administrators efficiently manage multi-domain hosting environments, track configuration changes, and support troubleshooting tasks.

LEAVE A COMMENT