tencent cloud

Secrets Manager

CreateProductSecret

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-11-30 19:10:38

1. API Description

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

This API is used to create a cloud product secret.

A maximum of 20 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: CreateProductSecret.
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

Credential name, which must be unique within the same region and can contain up to 128 bytes. It can contain only letters, digits, hyphens (-), and underscores (_), and must start with a letter or digit.

UserNamePrefix Yes String

Prefix of the user account name, specified by the user. It can contain up to 8 characters.
Valid characters:
Digits: [0, 9]
Lowercase letters: [a, z]
Uppercase letters: [A, Z]
Special characters (English symbols): Underscore (_)
The prefix must start with an uppercase or lowercase letter.

ProductName Yes String

Name of the cloud service bound to the credential, such as Mysql. You can call the DescribeSupportedProducts API to obtain the supported cloud service names.

InstanceID Yes String

Cloud service instance ID.

Domains.N Yes Array of String

Domain name of the account, in IP format. % is supported.

PrivilegesList.N Yes Array of ProductPrivilegeUnit

List of permissions to grant when binding the credential to a cloud service instance.

Description No String

Description used to describe the purpose in detail, up to 2048 bytes.

KmsKeyId No String

Specifies the KMS CMK used to encrypt the credential.
If this parameter is empty, the CMK created by Secrets Manager by default is used for encryption.
You can also specify a KMS CMK created in the same region for encryption.

Tags.N No Array of Tag

Tag list.

RotationBeginTime No String

User-defined rotation start time in the format of 2006-01-02 15:04:05.
This parameter is required when EnableRotation is True.

EnableRotation No Boolean

Specifies whether to enable rotation.
True: Enable
False: Disable
If this parameter is not specified, False is used by default.

RotationFrequency No Integer

Rotation period in days. Default value: 1.

KmsHsmClusterId No String

ID of the dedicated KMS cluster. This parameter is valid when KmsKeyId is empty and a valid HsmClusterId exists in the user's KMS.

AccountRemark No String

Account remarks

AccountType No String

Database account type. This parameter is used only when creating SQL Server credentials. Only L3 is supported.

Valid values:

  • L3: Account with regular permissions
EncryptType No Integer

Credential encryption type

Valid values:

  • 0: KMS key
  • 1: Software key

Default value: 0

3. Output Parameters

Parameter Name Type Description
SecretName String

Name of the created secret.

TagCode Integer

Return code of the tag operation. 0: success; 1: internal error; 2: business processing error.

TagMsg String

Return message of the tag operation.

FlowID Integer

ID of the asynchronous task for creating the cloud product secret.

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 Creating a Cloud Product Credential

This example shows you how to create a cloud product credential.

Input Example

POST / HTTP/1.1
Host: ssm.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateProductSecret
<Common request parameters>

{
    "SecretName": "test3-db-secret",
    "UserNamePrefix": "lzctest",
    "ProductName": "Mysql",
    "InstanceID": "cdb-n4j3y33j",
    "Domains": [
        "%"
    ],
    "PrivilegesList": [
        {
            "PrivilegeName": "GlobalPrivileges",
            "Privileges": [
                "SELECT"
            ]
        }
    ],
    "Description": "Test database credential creation",
    "KmsKeyId": "6abd1fdb-86d4-11ef-b72d-52540089bc41",
    "Tags": [
        {
            "TagKey": "env",
            "TagValue": "dev"
        }
    ],
    "RotationBeginTime": "2024-10-31 11:11:00",
    "EnableRotation": true,
    "RotationFrequency": 30
}

Output Example

{
    "Response": {
        "FlowID": 43415,
        "RequestId": "0f5fa585-7671-4d4a-bc28-41910b772936",
        "SecretName": "test3-db-secret",
        "TagCode": 0,
        "TagMsg": "ok"
    }
}

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.
InvalidParameter Parameter error.
InvalidParameterValue Parameter value error.
InvalidParameterValue.TagKeysDuplicated Duplicate tag key.
InvalidParameterValue.TagsNotExisted The tag key or tag value does not exist.
LimitExceeded The quota limit is exceeded.
MissingParameter Missing parameter error.
OperationDenied Operation denied.
OperationDenied.AutoRotatedResource Credentials with automatic rotation cannot be updated manually.
RequestLimitExceeded The number of requests exceeds the frequency limit.
ResourceInUse The resource is occupied.
ResourceInUse.SecretExists The credential name already exists.
ResourceInUse.VersionIdExists The version number already exists.
ResourceInsufficient Insufficient resources.
ResourceNotFound Resources do not exist.
ResourceUnavailable The resource is unavailable.
ResourceUnavailable.NotPurchased The service has not been purchased.
ResourceUnavailable.ResourceDisabled The credential is disabled.
ResourceUnavailable.ResourcePendingDeleted The credential is in the scheduled deletion state.
ResourceUnavailable.ResourceUninitialized The credential is not initialized.
ResourcesSoldOut Resources have been sold out.
UnauthorizedOperation Unauthorized operation.
UnauthorizedOperation.AccessKmsError Failed to access KMS.
UnknownParameter Unknown parameter error.
UnsupportedOperation The operation is not supported.

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백