Skip to content

Clone a WordPress site

POST /api/v2/shared-hosting/{accountId}/wordpress/{siteId}/actions/clone

Copy a WordPress site to another domain or folder on the same web hosting account. targetDomain is a domain on the account. targetDirectory is a sub-folder of it, such as copy. Leave it out to copy to the domain’s root. The copy is made before the response returns. It is a new WordPress site with its own ID. The original site is not changed. To test changes before they reach the live site, use POST /api/v2/shared-hosting/{accountId}/wordpress/{siteId}/actions/staging instead. The account must be active and on cPanel.

Authentication: An API key with the scopes write:hosting and console:services. About keys and scopes

Request

Path parameters

accountIdstringrequired
The web hosting account ID (acct_…).
siteIdstringrequired
The WordPress site ID (wp_…).

Body

targetDomainstringrequired
The domain on the account to copy to, in Unicode or punycode form.
targetDirectorystring
Sub-folder of the target domain, relative to its root. Letters, digits, _, ., / and -, up to 200 characters. Leave it out for the root.

Example

POST /api/v2/shared-hosting/{accountId}/wordpress/{siteId}/actions/clone
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/wordpress/wp_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/clone" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"targetDomain": "shop.example.com",
"targetDirectory": "copy"
}'

Responses

201 The copy was created.

Response 201
{
"id": "wp_01hxb7c8d9e0f1g2h3j4k5m6n7",
"url": "https://staging.example.com/copy"
}
Response fields
idstring
The new site’s ID (wp_…).
urlstring
The new site’s address.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400The site ID, targetDomain or targetDirectory is invalid (invalid_request).
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404No such WordPress site on this account (wp_installation_not_found).
409account_suspended: the hosting account is suspended. account_not_eligible_cpanel: the account is not on cPanel.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.
502The copy could not be made right now (upstream_failed).