---
title: "POST /v1/{+parent}/databases:restore"
method: POST
path: "/v1/{+parent}/databases:restore"
tags: ["projects"]
---

# POST /v1/{+parent}/databases:restore

`POST /v1/{+parent}/databases:restore`

Create a new database by restoring from a completed backup. The new database must be in the same project and in an instance with the same instance configuration as the instance containing the backup. The returned database long-running operation has a name of the format `projects//instances//databases//operations/`, and can be used to track the progress of the operation, and to cancel it. The metadata field type is RestoreDatabaseMetadata. The response type is Database, if successful. Cancelling the returned operation will stop the restore and delete the database. There can be only one database being restored into an instance at a time. Once the restore operation completes, a new restore operation can be initiated, without waiting for the optimize operation associated with the first restore to complete.

## Path parameters

- `parent` string, required

## Request body

- RestoreDatabaseRequest — The request for RestoreDatabase.
  - `databaseId` string — Required. The id of the database to create and restore to. This database must not already exist. The `database_id` appended to `parent` forms the full database name of the form `projects//instances//databases/`.
  - `backup` string — Name of the backup from which to restore. Values are of the form `projects//instances//backups/`.
  - `encryptionConfig` RestoreDatabaseEncryptionConfig — Encryption configuration for the restored database.
    - `encryptionType` 'ENCRYPTION_TYPE_UNSPECIFIED' | 'USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION' | 'GOOGLE_DEFAULT_ENCRYPTION' | 'CUSTOMER_MANAGED_ENCRYPTION' — Required. The encryption type of the restored database.
    - `kmsKeyName` string — Optional. This field is maintained for backwards compatibility. For new callers, we recommend using `kms_key_names` to specify the KMS key. Only use `kms_key_name` if the location of the KMS key matches the database instance's configuration (location) exactly. For example, if the KMS location is in `us-central1` or `nam3`, then the database instance must also be in `us-central1` or `nam3`. The Cloud KMS key that is used to encrypt and decrypt the restored database. Set this field only when encryption_type is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form `projects//locations//keyRings//cryptoKeys/`.
    - `kmsKeyNames` string[] — Optional. Specifies the KMS configuration for one or more keys used to encrypt the database. Values have the form `projects//locations//keyRings//cryptoKeys/`. The keys referenced by `kms_key_names` must fully cover all regions of the database's instance configuration. Some examples: * For regional (single-region) instance configurations, specify a regional location KMS key. * For multi-region instance configurations of type `GOOGLE_MANAGED`, either specify a multi-region location KMS key or multiple regional location KMS keys that cover all regions in the instance configuration. * For an instance configuration of type `USER_MANAGED`, specify only regional location KMS keys to cover each region in the instance configuration. Multi-region location KMS keys aren't supported for `USER_MANAGED` type instance configurations.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/spanner.md) · [All operations](https://skmtc.net/google/apis/spanner/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/spanner/versions/4b66067d2622/schema)
