Skip to content

Install WordPress

POST /api/v2/shared-hosting/{accountId}/wordpress

Install WordPress on a domain of a web hosting account. Leave out directory to install at the domain’s root. Send it to install in a sub-folder, such as blog. The site is set up for HTTPS. Automatic updates of WordPress, plugins and themes are on unless you send false. The call returns 201 with the new site’s ID when the install is confirmed. When the install was sent but could not be confirmed yet, it returns 202 with state: unconfirmed. Do not retry then. List the sites with GET /api/v2/shared-hosting/{accountId}/wordpress until it appears. 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_…).

Body

domainstringrequired
The domain on the account to install on, in Unicode or punycode form.
directorystring
Sub-folder to install in, relative to the domain’s root. Letters, digits, _, ., / and -, up to 200 characters. Leave it out for the root.
siteNamestringrequired
The site title, 1 to 120 characters.
siteDescriptionstring
The site tagline, up to 500 characters.
adminUsernamestringrequired
Username of the first WordPress admin. Letters, digits, ., _ and -, up to 64 characters.
adminPasswordstringrequired
Password of the first WordPress admin, up to 128 characters.
adminEmailstringrequired
E-mail address of the first WordPress admin.
languagestring
WordPress language code, such as en or sv_SE. Default en.
autoUpgradeboolean
Update WordPress automatically. Default true.
autoUpgradePluginsboolean
Update plugins automatically. Default true.
autoUpgradeThemesboolean
Update themes automatically. Default true.

Example

POST /api/v2/shared-hosting/{accountId}/wordpress
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/wordpress" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"domain": "example.com",
"siteName": "Example Store",
"adminUsername": "admin",
"adminPassword": "YOUR_WORDPRESS_ADMIN_PASSWORD",
"adminEmail": "admin@example.com",
"language": "en",
"autoUpgrade": true,
"autoUpgradePlugins": true,
"autoUpgradeThemes": true
}'

Responses

201 WordPress was installed.

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

202 The install was sent but could not be confirmed yet. Do not retry. List the sites until it appears.

Response 202
{
"state": "unconfirmed",
"url": "https://example.com",
"message": "WordPress installation was submitted, but confirmation is not ready yet. Refresh WordPress installations or scan for existing installations before trying again.",
"actions": {
"canList": true,
"canScan": true,
"canRetry": false
}
}
Response fields
statestring
Always unconfirmed. One of unconfirmed.
urlstring
The address the site will have.
messagestring
What to do next, in English.
actionsobject
What to do next.
canListboolean
True: list the sites to see whether the install finished.
canScanboolean
True: run a scan to add the site to the list.
canRetryboolean
False: do not send the install again.

Errors

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

400The body is invalid (invalid_request).
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.
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.
502WordPress could not be installed (upstream_failed).