# IRPCVaultsAdmin.RestoreVault

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Administration API](https://developer.m-files.com/APIs/gRPC-API/admin/index.md) > [Vault management](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/RestoreVault/

Badges: `Administration API / specialized` `admin` `session`

Restores a vault from backup files on the server and attaches it.

- **Service:** [Vault management](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/index.md) `MFiles.IRPCVaultsAdmin`
- **gRPC method:** `/MFiles.IRPCVaultsAdmin/RestoreVault`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/restore-vault`
- **Request:** [`RestoreVaultRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/RestoreVault/index.md#request)
- **Response:** [`RestoreVaultResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/RestoreVault/index.md#response)
- **Book and level:** Administration API, specialized
- **Kind:** admin
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** no
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- **Long-running.** With `synchronous` false the call starts a background job and returns before
  it completes; follow it with `task_id` (see the service overview). With `synchronous` true the
  call returns when the restore is done.
- Requires the system administrator server role (server right `restore_vault`).
- The backup files are read by the server: paths are on the server machine. Inspect a backup with
  [GetBackupFileContents](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/GetBackupFileContents/index.md) first.
- `restore_job.overwrite_existing_files` true lets the restore overwrite existing files in the
  target location.

<a id="request"></a>

## Request: RestoreVaultRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `restore_job` | [`RestoreJob`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.RestoreJob/index.md) | The backup files to restore and the definition of the restored vault. If `target_vault.vault.guid` is the null GUID, the vault keeps the GUID stored in the backup. |
| `restore_job.full_backup_file` | `string` | Full path to the backup file on server (full backup). |
| `restore_job.differential_backup_file` | `string` | Full path to the backup file on server (differential backup, optional). |
| `restore_job.target_vault` | [`Vault`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Vault/index.md) | The definition of the vault. If the GUID field is GUID_NULL, the restored vault uses the GUID specified in the backup files. Otherwise, it uses the given GUID (= restore to a different identity). |
| `restore_job.target_vault.vault` | [`VaultBasic`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.VaultBasic/index.md) | Basic data. |
| `restore_job.target_vault.main_data_folder` | `string` | The main physical folder of this vault on the server (e.g. C:\Program Files\M-Files\Server Vaults\MyVault). |
| `restore_job.target_vault.additional_data_folders[]` | repeated [`AdditionalFolder`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AdditionalFolder/index.md) | The specification of the additional file data folders. |
| `restore_job.target_vault.database_info` | [`SQLDatabase`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SQLDatabase/index.md) | The vault's SQL database. |
| `restore_job.target_vault.file_data_storage` | [`FileDataStorage`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.FileDataStorage/index.md) | Identifies file data storage to use. Typically specifies that the file data storage is determined automatically. Values: `FILE_DATA_STORAGE_DEFAULT` (0), `FILE_DATA_STORAGE_DISK` (1), `FILE_DATA_STORAGE_DATABASE` (2), `FILE_DATA_STORAGE_EXTERNAL` (3), `FILE_DATA_STORAGE_MASTER` (4). |
| `restore_job.target_vault.file_data_connection_string` | `string` | The connection string that identifies the location, protocol, and credentials for the file data storage of this vault. For example, this might specify a storage account, a protocol, and a container name for Azure's BLOB Services. Can be unset or empty. |
| `restore_job.overwrite_existing_files` | `bool` | If true, existing target files are overwritten. If false, restore fails if a target file already exists. |
| `restore_job.impersonation` | [`Impersonation`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Impersonation/index.md) | Impersonation information for accessing the backup file on server. |
| `restore_job.impersonation.type` | [`ImpersonationType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.ImpersonationType/index.md) | Impersonation type. Values: `IMPERSONATION_TYPE_SYSTEM_ACCOUNT` (0), `IMPERSONATION_TYPE_LOCAL_WINDOWS_ACCOUNT` (1), `IMPERSONATION_TYPE_EXTERNAL_ACCOUNT` (2). |
| `restore_job.impersonation.account` | `string` | Account name (e.g. DOMAIN\user). |
| `restore_job.impersonation.encrypted_password` | `bytes` | Encrypted password. |
| `restore_job.vault_attach_options` | [`AttachVaultOptions`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AttachVaultOptions/index.md) | Options for controlling the attaching of the vault. |
| `restore_job.vault_attach_options.disable` | [`ExternalConnectionOptions`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ExternalConnectionOptions/index.md) | Which vault's external data connection points must be put disabled? |
| `restore_job.vault_attach_options.update_attachment_guid` | `bool` | Specify true if the attachment GUID should be updated. Usually, it is desirable to update the attachment GUID each time the vault is re-attached. |
| `restore_job.vault_attach_options.fail_attach_if_bring_online_fails` | `bool` | A flag that controls if attaching the vault must fail if its online operations do not start successfully. Typically this is false meaning that starting online operations can fail although attaching the vault succeeds. |
| `restore_job.vault_attach_options.enforce_file_data_encryption` | `bool` | A flag that controls if file data encryption should be turned on in the vault when it is attached. |
| `restore_job.vault_attach_options.disable_local_indexes` | `bool` | A flag that controls if the local indexes such as dtSearch are disabled when the vault is attached. |
| `restore_job.vault_attach_options.allow_only_vault_temp_path_for_content_replication` | `bool` | If true the temporary processing location of cloud replication jobs are cleared and other replication jobs are disabled. |
| `restore_job.vault_attach_options.ignore_vault_external_data_connection_points` | `bool` | If true vault's external data connection points are ignored when vault is already in msm cluster. |
| `synchronous` | `bool` | True to restore within the call. False to start a background job and return at once. |

<a id="response"></a>

## Response: RestoreVaultResponse

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `task_id` | `int32` | The ID of the server-level restore job when `synchronous` is false; -1 when it is true. |
| `output_info` | [`RestoreJobOutputInfo`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.RestoreJobOutputInfo/index.md) | The restored vault when `synchronous` is true; empty otherwise (read the result from the job's `output`). |
| `output_info.restored_vault` | [`Vault`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Vault/index.md) | Receives the full definition of the restored vault. |
| `output_info.restored_vault.vault` | [`VaultBasic`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.VaultBasic/index.md) | Basic data. |
| `output_info.restored_vault.main_data_folder` | `string` | The main physical folder of this vault on the server (e.g. C:\Program Files\M-Files\Server Vaults\MyVault). |
| `output_info.restored_vault.additional_data_folders[]` | repeated [`AdditionalFolder`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AdditionalFolder/index.md) | The specification of the additional file data folders. |
| `output_info.restored_vault.database_info` | [`SQLDatabase`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SQLDatabase/index.md) | The vault's SQL database. |
| `output_info.restored_vault.file_data_storage` | [`FileDataStorage`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.FileDataStorage/index.md) | Identifies file data storage to use. Typically specifies that the file data storage is determined automatically. Values: `FILE_DATA_STORAGE_DEFAULT` (0), `FILE_DATA_STORAGE_DISK` (1), `FILE_DATA_STORAGE_DATABASE` (2), `FILE_DATA_STORAGE_EXTERNAL` (3), `FILE_DATA_STORAGE_MASTER` (4). |
| `output_info.restored_vault.file_data_connection_string` | `string` | The connection string that identifies the location, protocol, and credentials for the file data storage of this vault. For example, this might specify a storage account, a protocol, and a container name for Azure's BLOB Services. Can be unset or empty. |

<a id="related"></a>

## Related methods

- [GetBackupFileContents](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCVaultsAdmin/GetBackupFileContents/index.md): Reads the vault identity and data folders stored in a backup file on the server.
