All Products
Search
Document Center

Key Management Service:TagResource

Last Updated:Jul 29, 2025

Adds tags to a customer master key (CMK), secret, or certificate.

Operation description

You can add up to 10 tags to a CMK, secret, or certificate.

In this example, the tags [{"TagKey":"S1key1","TagValue":"S1val1"},{"TagKey":"S1key2","TagValue":"S2val2"}] are added to the CMK whose ID is 08c33a6f-4e0a-4a1b-a3fa-7ddf****.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
KeyIdstringNo

The ID of the customer master key (CMK). The ID must be globally unique.

Note You can configure only one of the KeyId, SecretName, and CertificateId parameters.
08c33a6f-4e0a-4a1b-a3fa-7ddf****
TagsstringYes

One or more tags that you want to add. The value is in the array format.

Tag attributes:

  • TagKey: the tag key.
  • TagValue: the tag value.
[{"TagKey":"S1key1","TagValue":"S1val1"},{"TagKey":"S1key2","TagValue":"S2val2"}]
SecretNamestringNo

The name of the secret.

Note You can configure only one of the KeyId, SecretName, and CertificateId parameters.
MyDbC****
CertificateIdstringNo

The ID of the certificate.

Note You can configure only one of the KeyId, SecretName, and CertificateId parameters.
770dbe42-e146-43d1-a55a-1355db86****

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request, which is used to locate and troubleshoot issues.

4162a6af-bc99-40b3-a552-89dcc8aaf7c8

Examples

Sample success responses

JSONformat

{
  "RequestId": "4162a6af-bc99-40b3-a552-89dcc8aaf7c8"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameterThe specified parameter is not valid.An invalid value is specified for the parameter.
404InvalidAccessKeyId.NotFoundThe Access Key ID provided does not exist in our records.-

For a list of error codes, visit the Service error codes.