Purge a website's page cache
POST /api/v2/shared-hosting/{accountId}/page-cache/actions/purge
Empty a website’s stored page cache. Use it when visitors get an old or broken copy of a page while you see the real site when logged in. The call deletes the contents of wp-content/cache/ in the website’s folder. That is where WordPress cache plugins such as WP-Optimize, WP Rocket, WP Super Cache and W3 Total Cache keep their pages. It also empties the account’s lscache/ folder, the web server’s page cache for every website on the account. The folders themselves stay, as do any .htaccess, index.php and index.html in them. The cache fills again on the next visits. The response lists what was emptied and what was skipped. 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_…).Body (optional)
domainstringshop.example.com. Default: the account’s main domain.Example
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/page-cache/actions/purge" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json"curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/page-cache/actions/purge" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "domain": "shop.example.com" }'Responses
200 What was emptied and what was skipped.
{ "domain": "example.com", "purged": [ { "path": "public_html/wp-content/cache", "entries": 148 } ], "skipped": [ { "path": "lscache", "reason": "not_present" } ]}Response fields
domainstringpurgedarray of objectpathstringentriesinteger0 means the folder was already empty. At least 0.skippedarray of objectpathstringreasonstringnot_present: the folder does not exist. delete_failed: the entry could not be deleted. One of not_present, delete_failed.Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | domain is not a full host name (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 resource does not exist or is not owned by the caller. |
| 409 | The account is not on cPanel (account_not_eligible_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 cache folder could not be read or emptied right now (upstream_failed). Try again later. |