---
title: "Start an in-place restore of a website backup"
method: POST
path: "/WebsiteBackup/restore_backup"
tags: ["WebsiteBackup"]
---

# Start an in-place restore of a website backup

`POST /WebsiteBackup/restore_backup`

## Request

- Base URL: `https://cpanel-server.tld:2083/execute`
- URL: `https://cpanel-server.tld:2083/execute/WebsiteBackup/restore_backup`
- Auth: HTTP basic

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.

## Request body `application/x-www-form-urlencoded`

- object
  - `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.
  - `database` string[]: 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.
  - `domain` string, required: The website to restore in place. **Note:** The account must own this domain.
  - `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.
  - `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`

HTTP Request was successful.

- object
  - `apiversion` integer: The version of the API.
  - `func` string: The name of the method called.
  - `module` string: The name of the module called.
  - `result` object
    - `data` object: The identifier of the background operation this call started.
      - `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.
    - `errors` string[], nullable: List of errors if the API failed.
    - `messages` string[], nullable: List of messages generated by the API.
    - `metadata` object
    - `status` 0 | 1: * `1` - Success. * `0` - Failed. Check the `errors` field for more details.
    - `warnings` string[], nullable: List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running an API.

## Changes

- **2026-09-12** `99adb57e7a5d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/cpanel/apis/cpanel-uapi/changes/WebsiteBackup/restore_backup/post.md)

---

[API](https://skmtc.dev/cpanel/apis/cpanel-uapi.md) - [All operations](https://skmtc.dev/cpanel/apis/cpanel-uapi/llms.txt) - [OpenAPI document](https://skmtc.dev/cpanel/apis/cpanel-uapi/revisions/05239220da37?raw)
