Method: projects.secrets.addVersion

Creates a newSecretVersion containing secret data and attaches it to an existingSecret.

HTTP request

POST https://secretmanager.googleapis.com/v1beta1/{parent=projects/*/secrets/*}:addVersion

The URL usesgRPC Transcoding syntax.

Path parameters

Parameters
parent

string

Required. The resource name of theSecret to associate with theSecretVersion in the formatprojects/*/secrets/*.

Authorization requires the followingIAM permission on the specified resourceparent:

  • secretmanager.versions.add

Request body

The request body contains data with the following structure:

JSON representation
{"payload":{object (SecretPayload)}}
Fields
payload

object (SecretPayload)

Required. The secret payload of theSecretVersion.

Response body

If successful, the response body contains an instance ofSecretVersion.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see theAuthentication Overview.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-14 UTC.