Skip to content

Install a WordPress plugin

POST /api/v2/shared-hosting/{accountId}/wordpress-plugins/{slug}/actions/install

Install a plugin from the wordpress.org directory on a WordPress site on a web hosting account. Use it to add a plugin the site is missing, for example WP Mail SMTP when WordPress cannot send email. The plugin is installed inactive unless you send activate: true. When the plugin’s folder is already there, nothing is installed and the response has alreadyInstalled: true. The site must be in the account’s WordPress list. Otherwise the call returns 409 not_supported. Run GET /api/v2/shared-hosting/{accountId}/wordpress/actions/scan to add it. 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_…).
slugstringrequired
The plugin’s slug in the wordpress.org directory.

Body (optional)

domainstring
The WordPress site, as a full host name on the account. Default: the account’s main domain.
activateboolean
true activates the plugin after it is installed. Default false.

Example

POST /api/v2/shared-hosting/{accountId}/wordpress-plugins/{slug}/actions/install
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/wordpress-plugins/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/install" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json"

Responses

200 The plugin’s state after the call.

Response 200
{
"slug": "wp-mail-smtp",
"alreadyInstalled": false,
"active": false
}
Response fields
slugstring
The plugin’s slug.
alreadyInstalledboolean
True when the plugin’s folder was already there. Nothing was installed.
activeboolean
For a new install: whether the plugin was activated. For an existing plugin: whether its folder is not switched off.

Errors

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

400slug, activate or domain is invalid (invalid_request).
401Unauthorized. Authentication is required.
403The key lacks a scope or the account is not active. domain_not_owned: the domain is not on this account.
404The site has no wp-content/plugins folder (not_found). It is not a WordPress site.
409not_supported: the site is not in the account’s WordPress list. 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 site could not be inspected or the plugin could not be installed right now (upstream_failed).