Updated on 2025-12-31 GMT+08:00

Adding Resource Tags

Function

This API is used to add resource tags.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    cts:resourceTag:create

    Write

    tracker *

    g:ResourceTag/<tag-key>

    -

    -

    -

    • g:TagKeys

    • g:RequestTag/<tag-key>

URI

POST /v3/{project_id}/{resource_type}/{resource_id}/tags

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

resource_type

Yes

String

Resource type. The value is cts-tracker.

resource_id

Yes

String

Resource ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

tag

No

ResourceTag object

Tags. A maximum of 10 keys are allowed. Each key contains a maximum of 10 values. The structure body cannot be missing, and the key cannot be left blank or set to an empty string. Each tag key must be unique, and the tag values of a key must also be unique.

Table 3 ResourceTag

Parameter

Mandatory

Type

Description

key

No

String

Tag key. A tag key contains a maximum of 128 Unicode characters. It can contain letters, digits, spaces, and special characters _.:=+-@. It cannot start or end with a space, or start with sys.

value

No

String

Tag value. Each value contains a maximum of 255 Unicode characters. If value is specified, tags are deleted by key and value. If value is not specified, tags are deleted by key. A tag value can contain letters, digits, spaces, and special characters _.:/=+-@. It cannot start or end with a space.

Response Parameters

Status code: 204

Request succeeded.

None

Example Requests

https://{endpoint}/v3/{project_id}/{resource_type}/{resource_id}/tags

{
  "tag" : {
    "key" : "",
    "value" : ""
  }
}

Example Responses

None

Status Codes

Status Code

Description

204

Request succeeded.

Error Codes

See Error Codes.