Create a secret backup

This document explains how to create a secret backup. A secret backup is a copy of a secret's metadata and all its versions from the point in time you create the backup. You can create backups in any supported region to help reduce the risk of data loss.

Required roles

To get the permissions that you need to create 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 create a secret backup. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to create a secret backup:

  • secretmanager.backups.create
  • secretmanager.secrets.backup

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

Create a secret backup

To create 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. On the Secret Manager page, select the secret that you want to create a backup for.

  3. Click Actions, and then click Create backup.

  4. On the Create a backup page, in the Backup Name field, enter a name for the backup.

  5. In the Location section, select the region where you want to store your backup.

  6. Optional: In the Labels section, click Add label to add key-value labels to the backup.

  7. Click Create backup.

REST

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

  • BACKUP_LOCATION: the supported region where you want to store the backup.
  • PROJECT_ID: the Google Cloud project ID.
  • BACKUP_ID: the ID of the backup.
  • SECRET_ID: the ID of the secret that you want to back up.

HTTP method and URL:

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

Request JSON body:

{
  "sourceSecret": "projects/PROJECT_ID/secrets/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?backupId=BACKUP_ID"

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?backupId=BACKUP_ID" | 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": "create",
    "requestedCancellation": false,
    "apiVersion": "v1"
  },
  "done": false
}

Creating a backup starts a long-running operation. While the operation is in progress ("done": false), the backup is in the CREATING state. When the operation finishes, the backup transitions to the ACTIVE state and is ready to be restored or updated. For more information, see Use long-running operations.

What's next