# Start an in-place restore of a website backup

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.

Endpoint: POST /WebsiteBackup/restore_backup
Version: 11.138.0.10
Security: BasicAuth

## Request fields (application/x-www-form-urlencoded):

  - `clean` (integer)
    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.
    Example: 1

  - `database` (array)
    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.
    Example: ["user_wordpress","user_store"]

  - `domain` (string, required)
    The website to restore in place.

Note:
The account must own this domain.
    Example: "example.com"

  - `id` (string, 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.
    Example: "example.com-2026.08.18_12-53-12"

  - `restore_databases` (integer)
    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.

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "restore_backup"

  - `module` (string)
    The name of the module called.
    Example: "WebsiteBackup"

  - `result` (object)

  - `result.data` (object)
    The identifier of the background operation this call
started.

  - `result.data.operationId` (string)
    Identifier of the detached operation that performs
the work.

Note:
Pass it to the WebsiteBackup::operation_status
function to poll progress. The
WebsiteBackup::list_operations function recovers
it if the client loses it.
    Example: "2026-08-18T12:53:12Z.1"

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.status` (integer)
    * 1 - Success.
* 0 - Failed. Check the errors field for more
  details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings
describe non-critical failures or other problematic
conditions noted while running an API.


