hosting
POST /v1/sites/{siteId}/application-reinstall
Reinstall an active site's PHP application, after backing it up.
Authentication
Send an API key as a bearer token. The key must carry the sites.view permission; a key without it is refused with 403, not 404.
This endpoint takes no organisation id. Your key already identifies the organisation it belongs to, and the response is scoped to it.
Try it
Replace anything in angle brackets with your own values, and the key placeholder with a key from your dashboard.
curl -X POST https://api.zinndigital.com/v1/sites/{siteId}/application-reinstall \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "mode": <SiteApplicationReinstallMode>, "confirm_domain": <string> }'Signed in? The API console in your dashboard fills in your real organisation id and your own key, and runs the request against the live API so you can see the actual response. Open this endpoint in the API console
Details
Rebuilds an active PHP application site (any application, not only Moodle) — the door for a site whose files are gone, which retrySiteProvisioning (failed or pending sites only) cannot reach. The site's domain must be typed in confirm_domain. The database and the files are ALWAYS backed up first into a root-only store on the server, read back (every table in the dump, the archive passes gzip -t), and only then cleared. keep_database lays down fresh files and reconnects them to the existing tables; fresh also clears the application's data directory and tables and installs from nothing. The request is queued through the transactional outbox and a consumer starts the Temporal workflow (one per site, so a press while one is running is absorbed by it): a workflow-engine outage delays a reinstall and never fails this request. The moment it is queued this answers 202; follow it on the GET. With keep_database Moodle's own non-interactive upgrade then brings the kept database up to the new release. Audit-logged (site.application.reinstall_requested, then site.application.reinstalled or site.application.reinstall_failed). Requires sites.view and hosting.deploy.manage. 422 with a refusal key: refusal.sites.reinstallConfirmMismatch, reinstallNotActive, reinstallNotPhpApp, reinstallNoApplication, reinstallNotOnFleet, reinstallKeepDatabaseUnsupported, reinstallBadMode.
Parameters
| Name | Type | Required | What it is |
|---|---|---|---|
siteId (path) | Uuid | Yes | Site ID (UUIDv7). |
Request body
| Name | Type | Required | What it is |
|---|---|---|---|
mode | SiteApplicationReinstallMode | Yes | keep_database — fresh files reconnected to the existing tables; fresh — files, data directory and tables cleared and the application installed from nothing. Both back the… |
confirm_domain | string | Yes | The site's primary domain, typed by the customer (case-insensitive). |
Response
| Name | Type | Required | What it is |
|---|---|---|---|
workflow_id | string | Yes | — |
mode | SiteApplicationReinstallMode | Yes | keep_database — fresh files reconnected to the existing tables; fresh — files, data directory and tables cleared and the application installed from nothing. Both back the… |
started | boolean | Yes | true once the request is queued. A consumer starts the workflow; a run already going absorbs the request (one workflow id per site). |
Errors this endpoint can return
401 · 403 · 404 · 422 · 429