v1

latestOpenAPI 3.0.2cPanel License2026-08-06657427.1 MB
File Restoration

Restore file or directory

This function restores a file or directory from a backup to the file or directory's original location.

Important:

When you disable the File Storage role, the system disables this function.

get/Restore/restore_file

Query parameters

string ISO-8601 Date required

A daily backup file from a specified backup date.

OR
'incremental' required

An incremental daily backup.

OR
'weekly/incremental' | 'monthly/incremental' required

A weekly or monthly incremental backup.

OR
string required

A weekly or monthly backup from a specified backup date.

The backup's identification.

  • YYYY-MM-DD — Restore a daily backup from the specified backup date.
  • incremental — Restore a daily incremental backup.
  • weekly/YYYY-MM-DD — Restore a weekly backup from the specified backup date.
  • monthly/YYYY-MM-DD — Restore a monthly backup from the specified backup date.
  • weekly/incremental — Restore a weekly incremental backup.
  • monthly/incremental — Restore a monthly incremental backup.
overwrite1 | 0 required
Example:1

Whether to overwrite the file or directory on the disc with its backup replacement.

  • 1 — Overwrite the file or directory.
  • 0 — Do not overwrite the file or directory.
pathstring path required
Example:/public_html/index.php

The absolute file or directory's path, within a backup, that you wish to restore.

Important:

  • The value of this parameter must begin with a forward slash (/).
  • You must parse filenames properly to prevent a cross-site scripting (XSS) attack.

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_file",
  "module": "Restore",
  "result": {
    "data": {
      "success": 1
    },
    "status": 1
  }
}