WebsiteBackup

Start an in-place restore of a website backup

Changed on

This function starts an in-place restore of the domain parameter from the named backup and returns an operationId return value immediately.

Note:

  • The work runs in a detached background process. Poll the WebsiteBackup::operation_status function with the returned id for progress and the terminal state, or recover the id from the WebsiteBackup::list_operations function after a page reload.
  • By default the function restores the document root as a merge. The archive's files overwrite their counterparts, missing files are added, and files created since the backup are kept. The clean parameter selects a snapshot restore instead.
  • Database restoration is opt-out, controlled by the restore_databases parameter, and the database parameter names the subset to restore.
  • The function resets a restored database to exactly its backed-up state, dropping its existing objects and re-importing the dump, so objects created after the backup do not survive. It takes a rollback snapshot first, so a failed restore returns the database to its previous contents and reports failure rather than destroying live data.
  • Pre-flight checks run synchronously and fail this call. The account must own the domain, the archive must exist, each named database must be recorded in the archive's manifest, no other backup or restore may be running for the account, and the expanded archive must fit on disk.
  • The operation runs under a six-hour wall-clock cap.
  • This function requires the account's backup feature and is unavailable to demo (shared) accounts.
post/WebsiteBackup/restore_backup

Request

  • Base URL
    https://cpanel-server.tld:2083/execute
  • Auth
    HTTP basic

Request body application/x-www-form-urlencoded

cleaninteger

Send the integer 1 to restore the website files as a snapshot, which rebuilds the document root from the archive and removes anything added since the backup.

Note:

  • Omit this parameter for the default merge, which keeps those files. This parameter governs website files only.
  • The function also reads 0 as merge, so that is safe.
  • Never send the string false. Perl reads a non-empty string as true, so clean=false opts into the snapshot and deletes files added since the backup.
databasestring[]

A database from the archive to restore.

Note:

  • This parameter is repeatable and each name must appear in the archive's databaseNames.
  • Omit it, while databases are being restored, to restore every database in the archive.
domainstring required

The website to restore in place.

Note: The account must own this domain.

idstring required

Identifier of the backup to restore, as returned by the WebsiteBackup::list_backups function.

Note: The function does not check this parameter against the domain parameter. It accepts a backup taken from a different site the account owns and writes that site's files here. Pass an id that the WebsiteBackup::list_backups function returned for this domain.

restore_databasesinteger

Send the integer 0 to restore website files only and leave every database untouched. Defaults to 1, which restores the archive's databases.

Note:

  • Send 0, never false. Perl reads a non-empty string as true, so restore_databases=false is read as 1 and the function does restore the databases. That resets each one to its backed-up state and drops every object created since.
  • To leave your databases alone, send restore_databases=0 and nothing else. Omitting the parameter restores them.

Example request

{
  "clean": 1,
  "database": [
    "user_wordpress",
    "user_store"
  ],
  "domain": "example.com",
  "id": "example.com-2026.08.18_12-53-12"
}

Response

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "restore_backup",
  "module": "WebsiteBackup",
  "result": {
    "data": {
      "operationId": "2026-08-18T12:53:12Z.1"
    },
    "status": 1
  }
}

Changes