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
accountIdstringrequiredacct_…).siteIdstringrequiredwp_…).Body
targetDomainstringrequiredtargetDirectorystring_, ., / and -, up to 200 characters. Leave it out for the root.Example
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.
{ "id": "wp_01hxb7c8d9e0f1g2h3j4k5m6n7", "url": "https://staging.example.com/copy"}Response fields
idstringwp_…).urlstringErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | The site ID, targetDomain or targetDirectory is invalid (invalid_request). |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | No such WordPress site on this account (wp_installation_not_found). |
| 409 | account_suspended: the hosting account is suspended. account_not_eligible_cpanel: the account is not on cPanel. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |
| 502 | The copy could not be made right now (upstream_failed). |