Create a WordPress staging copy
POST /api/v2/shared-hosting/{accountId}/wordpress/{siteId}/actions/staging
Copies one WordPress site to a staging site on a domain or subdomain of the same web hosting account. Use it to test changes before they reach the live site.
stagingDomain must already be on the account and its folder must exist. Otherwise the call returns 409 staging_destination_not_ready. The account must be active and on cPanel.
The copy is made before the response returns. The staging site gets its own new database on the account. The response has the new staging site’s ID and address.
Authentication: An API key with the scopes write:hosting and console:services. About keys and scopes
Request
Path parameters
accountIdstringrequiredThe web hosting account ID (
acct_…).siteIdstringrequiredThe ID of the WordPress site to copy (
wp_…).Body
stagingDomainstringrequiredDomain or subdomain on the same account for the staging site. Unicode names are accepted.
stagingDirectorystringFolder for the staging site, relative to the domain’s folder. Leave it out to put the copy in the domain’s own folder.
Example
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/wordpress/wp_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/staging" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "stagingDomain": "staging.example.com", "stagingDirectory": "wp-staging" }'Responses
201 The staging site was created.
{ "id": "wp_01hxa3b4c5d6e7f8g9h0j1k2m4", "url": "https://staging.example.com/wp-staging"}Response fields
idstringID of the new staging site (
wp_…).urlstringAddress of the staging site.
Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code is wp_installation_not_found. |
| 409 | The staging site was not created. code is staging_destination_not_ready when the staging domain is not on the account or its folder is missing, account_suspended when the account is suspended, or account_not_eligible_cpanel when 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 | Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists. |