---
title: "Rename a primary, addon, or alias domain"
method: POST
path: "/Domain/rename_domain"
tags: ["Domain"]
---

# Rename a primary, addon, or alias domain

`POST /Domain/rename_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.

## Query parameters

- `domain` string, domain, required
- `new_domain` string, domain, required
- `docroot` string

## Response `200`

Request was successful.

- object
  - `apiversion` integer — The version of the API.
  - `func` string — The name of the method called.
  - `module` string — The name of the module called.
  - `result` object
    - `data` object
      - `message` string — A message describing the result of the rename.
    - `errors` string[], nullable — List of errors if the API failed.
    - `messages` string[], nullable — List of messages generated by the API.
    - `status` 0 | 1 — - 1 - Success. - 0 - Failed: Check the errors field for more details.
    - `warnings` string[], nullable — List of warnings generated by the API.

---

[API](https://skmtc.net/cpanel/apis/cpanel-uapi.md) · [All operations](https://skmtc.net/cpanel/apis/cpanel-uapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cpanel/cpanel-uapi/revisions/632e2f8e6d04/schema)
