# Restore databases

This function restores a database's backup files.

Important:

When the MySQL Client role is disabled, the system also disables this function.

Note:

You must pass either the file or backup parameter.

Endpoint: POST /Backup/restore_databases
Version: 11.138.0.19
Security: BasicAuth

## Query parameters:

  - `backup` (string)
    The database backup file to restore.

Important:

Only pass this parameter to restore files already on the server.

The file must be inside the account's home directory. The system rejects paths that resolve outside it, including symlinks that point outside the home directory.

Note:

To restore multiple database backup files, increment the parameter name. For example: backup-1, backup-2, and backup-3.

  - `timeout` (integer)
    The maximum number of seconds to try to restore the file.
* 0 - The system will not time out the file restoration.
    Example: 3600

  - `verbose` (integer)
    Whether to return additional information from the /usr/local/cpanel/logs/cpbackup log file.
* 1 - Return additional information.
* 0 - Do not return additional information.
    Enum: 0, 1

## Request fields (multipart/form-data):

  - `file` (string)

## Response 200 fields (application/json):

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

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

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

  - `result` (object)

  - `result.data` (object)

  - `result.data.log_id` (string)
    The log file's restoration identification (ID). The system uses the backup restoration's date to create this ID. The ID is in [ISO-8601 Date Time](https://en.wikipedia.org/wiki/ISO_8601) format with the log's revision number appended.
    Example: "2019-08-13T15:10:07Z.1"

  - `result.data.log_path` (string)
    The filepath to the backup restoration's log file.
    Example: "/home/cptest/logs/restoredb/2019-08-13T15:10:07Z.1.log"

  - `result.data.messages` (array)
    An array of statements about the database's restoration.
    Example: ["The system successfully restored the database 'user_db1' from the backup file 'user_db1.sql.gz'"]

  - `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 a API.


