tencent cloud

APIs

UpdateSecret

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2026-11-30 19:10:20

1. API Description

Domain name for API request: ssm.intl.tencentcloudapi.com.

This API is used to update the content of a specified secret version, or to set or migrate the Stage_Current label of an existing version.
This API is used to update secret content. It supports custom secrets, and the new content is encrypted and overwrites the original content. Setting version labels supports custom secrets, cloud product secrets, and Redis/MongoDB secrets. Cloud product secrets and Redis/MongoDB secrets only support setting or migrating labels.

A maximum of 50 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: UpdateSecret.
Version Yes String Common Params. The value used for this API: 2019-09-23.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
SecretName Yes String

Specifies the name of the credential content to update.

VersionId Yes String

Specifies the existing version number whose content is to be updated or version label is to be set. This parameter is required.

If VersionStage is specified, the label is migrated to this version. If the target version does not exist, ResourceNotFound is returned. If the credential is in the PendingCreate or CreateFailed state, FailedOperation is returned.

SecretBinary No String

New binary credential content, which must be Base64-encoded. Only custom credentials support content update through this API.

Input limits: If VersionStage is not specified, one and only one of SecretString and SecretBinary must be non-empty. If VersionStage is specified, both can be omitted to only migrate the label, but they cannot be non-empty at the same time. For cloud product credentials and Redis/MongoDB credentials, both fields must be omitted.

SecretString No String

New text credential content, which does not need to be Base64-encoded. Only custom credentials support content update through this API.

Input limits: If VersionStage is not specified, one and only one of SecretString and SecretBinary must be non-empty. If VersionStage is specified, both can be omitted to only migrate the label, but they cannot be non-empty at the same time. For cloud product credentials and Redis/MongoDB credentials, both fields must be omitted.

VersionStage No String

Sets or migrates the Stage_Current label to the existing version specified by VersionId. This parameter is case-sensitive.

Input limits: This parameter supports custom credentials, cloud product credentials, and Redis/MongoDB credentials. VersionId is required.

For custom credentials, you can set only the label or update the content at the same time. SecretString and SecretBinary cannot be non-empty at the same time. For cloud product credentials and Redis/MongoDB credentials, only label operations are supported, and both content fields must be omitted. The label is bound to the version number, and the original rotation process remains unchanged. Binding a historical version does not guarantee that the account and password are still valid.

3. Output Parameters

Parameter Name Type Description
SecretName String

Credential name.

VersionId String

Credential version number.

RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Updating Credential Content

Input Example

https://ssm.intl.tencentcloudapi.com/?Action=UpdateSecret
&SecretName=lzctestss
&VersionId=v1.0
&SecretString=new value
&<Common request parameters>

Output Example

{
    "Response": {
        "RequestId": "e6993612-6922-4f2d-bb36-37348f36eba5",
        "SecretName": "lzctestss",
        "VersionId": "v2.0"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
FailedOperation.AccessKmsError KMS operation failed.
InternalError Internal error.
InvalidParameterValue Parameter value error.
OperationDenied Operation denied.
OperationDenied.AutoRotatedResource Credentials with automatic rotation cannot be updated manually.
ResourceNotFound Resources do not exist.
ResourceUnavailable.NotPurchased The service has not been purchased.
UnauthorizedOperation Unauthorized operation.

Ajuda e Suporte

Esta página foi útil?

comentários