Updated on 2025-11-06 GMT+08:00

Adding Tags to the Specified Resource

Function

This API is used to add tags to the specified resource.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

AccessAnalyzer::tagResource

Tagging

analyzer *

g:ResourceTag/<tag-key>

-

-

-

  • g:RequestTag/<tag-key>

  • g:TagKeys

URI

POST /v5/{resource_type}/{resource_id}/tags/create

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

resource_type

Yes

String

Resource type.

  • analyzers: analyzer

resource_id

Yes

String

Unique identifier of a resource

Minimum: 1

Maximum: 36

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

tags

Yes

Array of Tag objects

List of custom tags.

Array Length: 1 - 20

Table 3 Tag

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key

value

Yes

String

String value associated with the tag key.

Response Parameters

Status code: 200

OK

None

Example Requests

Adding a tag to the specified resource

POST https://{hostname}/v5/{resource_type}/{resource_id}/tags/create

{
  "tags" : [ {
    "key" : "key-1",
    "value" : "value-1"
  } ]
}

Example Responses

None

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.