Skip to content

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

accountIdstringrequired
The web hosting account ID (acct_…).
siteIdstringrequired
The ID of the WordPress site to copy (wp_…).

Body

stagingDomainstringrequired
Domain or subdomain on the same account for the staging site. Unicode names are accepted.
stagingDirectorystring
Folder for the staging site, relative to the domain’s folder. Leave it out to put the copy in the domain’s own folder.

Example

POST /api/v2/shared-hosting/{accountId}/wordpress/{siteId}/actions/staging
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.

Response 201
{
"id": "wp_01hxa3b4c5d6e7f8g9h0j1k2m4",
"url": "https://staging.example.com/wp-staging"
}
Response fields
idstring
ID of the new staging site (wp_…).
urlstring
Address of the staging site.

Errors

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

400Invalid request. The response body is an RFC 7807 Problem Details document.
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404Not found. The resource does not exist or is not owned by the caller; code is wp_installation_not_found.
409The 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.
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.
502Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists.