Restore a secret backup

This page explains how to restore a secret backup. When you restore a backup, Secret Manager creates a secret with the details available in the source backup.

Required roles

To get the permissions that you need to restore a secret backup, ask your administrator to grant you the Secret Manager Admin (roles/secretmanager.admin) IAM role on the project, folder, or organization. For more information about granting roles, see Manage access to projects, folders, and organizations.

This predefined role contains the permissions required to restore a secret backup. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to restore a secret backup:

  • secretmanager.backups.restore
  • secretmanager.secrets.restore

You might also be able to get these permissions with custom roles or other predefined roles.

Restore a secret backup

To restore a secret backup, use one of the following methods:

Console

  1. In the Google Cloud console, go to the Secret Manager page.

    Go to Secret Manager

  2. Click the Backups tab to view all backups in the project. Alternatively, if the source secret still exists, open its details page and click the Backups tab.

  3. Locate the backup in the list and click the Actions menu associated with that backup. In the Actions menu, click Restore backup.

  4. On the Restore backup page, enter a unique name for the new secret.

  5. In the Location section, select global to restore the backup as a global secret, or select a region to restore it as a regional secret.

  6. Optional: To encrypt the restored secret with a customer-managed encryption key (CMEK), select Customer-managed encryption key (CMEK) and select a Cloud KMS key.

  7. Click Restore.

REST

Before using any of the request data, make the following replacements:

  • BACKUP_LOCATION: the supported region where the backup is stored.
  • PROJECT_ID: the Google Cloud project ID where the backup is stored.
  • BACKUP_ID: the ID of the backup that you want to restore.
  • DESTINATION_PROJECT_ID: the ID of the Google Cloud project where you want to restore the secret.
  • DESTINATION_SECRET_ID: a unique ID for the new secret created from the backup.

HTTP method and URL:

POST https://secretmanager.BACKUP_LOCATION.rep.googleapis.com/v1/projects/PROJECT_ID/locations/BACKUP_LOCATION/backups/BACKUP_ID:restore

Request JSON body:

{
  "destinationSecretParent": "projects/DESTINATION_PROJECT_ID",
  "destinationSecretId": "DESTINATION_SECRET_ID"
}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://secretmanager.BACKUP_LOCATION.rep.googleapis.com/v1/projects/PROJECT_ID/locations/BACKUP_LOCATION/backups/BACKUP_ID:restore"

PowerShell

Save the request body in a file named request.json, and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://secretmanager.BACKUP_LOCATION.rep.googleapis.com/v1/projects/PROJECT_ID/locations/BACKUP_LOCATION/backups/BACKUP_ID:restore" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "name": "projects/PROJECT_ID/locations/BACKUP_LOCATION/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.secretmanager.v1.OperationMetadata",
    "createTime": "2026-03-25T08:24:13.153705Z",
    "target": "projects/PROJECT_ID/locations/BACKUP_LOCATION/backups/BACKUP_ID",
    "verb": "restore",
    "requestedCancellation": false,
    "apiVersion": "v1"
  },
  "done": false
}

Restoring a backup starts a long-running operation. While the operation is in progress ("done": false), the new secret is in the RESTORING state, and read and write operations on it fail with a FAILED_PRECONDITION error. When the operation completes, the secret is ready to use. For more information, see Use long-running operations.

What's next