# Rename a primary, addon, or alias domain

This function renames a primary domain, addon domain, or alias domain on a
cPanel account. The system updates all relevant configuration files, document root
paths, and DNS entries automatically.

Note:

* You cannot rename a domain while another rename operation is in progress.
* You cannot rename the server hostname.
* The new domain must not already be configured on the account.

Endpoint: POST /Domain/rename_domain
Version: 11.137.9999.106
Security: BasicAuth

## Query parameters:

  - `domain` (string, required)
    The current domain name to rename.
    Example: "old.example.com"

  - `new_domain` (string, required)
    The new domain name.
    Example: "new.example.com"

  - `docroot` (string)
    The path to the domain's document root directory. If you do not specify a
value, this parameter defaults to the new domain name.
    Example: "new.example.com"

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "rename_domain"

  - `module` (string)
    The name of the module called.
    Example: "Domain"

  - `result` (object)

  - `result.data` (object)

  - `result.data.message` (string)
    A message describing the result of the rename.
    Example: "Domain old.example.com successfully renamed to new.example.com"

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.status` (integer)
    - 1 - Success.
- 0 - Failed: Check the errors field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API.


