Switch a WordPress plugin on or off
POST /api/v2/shared-hosting/{accountId}/wordpress-plugins/{slug}/actions/toggle
Switch a WordPress plugin off or back on by renaming its folder. Use it when a plugin breaks the site and wp-admin cannot be reached. enable: false renames wp-content/plugins/<slug> to <slug>.deactivated-by-support. enable: true renames it back. The plugin must be in the list from GET /api/v2/shared-hosting/{accountId}/wordpress-plugins. Asking for the state it is already in returns 200 without a change. When both folders exist the call returns 409 name_in_use. Remove or rename one of them in the file manager first. 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_…).slugstringrequiredBody
enablebooleanrequiredfalse switches the plugin off. true switches it back on.domainstringExample
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/wordpress-plugins/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/toggle" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "enable": true, "domain": "example.com" }'Responses
200 The plugin’s state after the call.
{ "slug": "contact-form-7", "disabled": true}Response fields
slugstringdisabledbooleanErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | slug, enable or domain is invalid (invalid_request). |
| 401 | Unauthorized. Authentication is required. |
| 403 | The key lacks a scope or the account is not active. domain_not_owned: the domain is not on this account. |
| 404 | not_found: the site has no plugin with that slug or is not a WordPress site. |
| 409 | name_in_use: both the plugin folder and its switched-off copy exist. 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 folder could not be renamed right now (upstream_failed). |