Help Center/ Enterprise Router/ API Reference/ APIs/ Tags/ Batch Creating or Deleting Resource Tags
Updated on 2026-03-20 GMT+08:00

Batch Creating or Deleting Resource Tags

Function

This API is used to add tags to or delete tags from specified instances.

  • TMS needs to use this API to manage tags of instances in batches.

  • A resource can have up to 20 tags.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account root user 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

er:tags:batchOperation

Write

routeTables

  • g:EnterpriseProjectId

  • g:ResourceTag/<tag-key>

er:tags:create

-

instances

  • g:EnterpriseProjectId

  • g:ResourceTag/<tag-key>

attachments

  • g:EnterpriseProjectId

  • g:ResourceTag/<tag-key>

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

resource_id

Yes

String

Resource ID.

resource_type

Yes

String

Tagged resource type.

  • instance: enterprise router

  • route-table: route table

  • vpc-attachment: VPC attachment

  • vgw-attachment: virtual gateway attachment

  • peering-attachment: peering connection attachment

  • vpn-attachment: VPN gateway attachment

  • gdgw-attachment: global DC gateway attachment

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

action

Yes

String

Operation action. Value options: create and delete

tags

No

Array of Tag objects

Tag list

Table 3 Tag

Parameter

Mandatory

Type

Description

key

No

String

Tag key.

  • A tag key can contain letters, digits, spaces encoded using UTF-8, and special characters _.:=+-@

  • A tag key cannot be left blank.

  • A tag key can contain 1 to 128 characters.

  • Tags with the tag key starting with _sys_ are system tags and cannot be added by tenants.

Minimum: 1

Maximum: 128

value

No

String

Tag value.

  • A tag value can contain letters, digits, spaces encoded using UTF-8, and special characters _.:=+-@

  • A tag value can be left blank or set to null.

  • A tag value can contain 0 to 255 characters.

Minimum: 0

Maximum: 255

Response Parameters

Status code: 204

No Content

None

Example Requests

  • Batch adding resource tags

    POST https://{erouter-endpoint}/v3/cfa563efb77d4b6d9960781d82530fd8/instance/3320166e-b937-40cc-a35c-02cd3f2b3ee2/tags/action
    
    {
      "action" : "create",
      "tags" : [ {
        "key" : "key1",
        "value" : "value1"
      }, {
        "key" : "key2",
        "value" : "value2"
      } ]
    }
  • Batch deleting resource tags

    POST https://{erouter-endpoint}/v3/cfa563efb77d4b6d9960781d82530fd8/instance/3320166e-b937-40cc-a35c-02cd3f2b3ee2/tags/action
    
    {
      "action" : "delete",
      "tags" : [ {
        "key" : "key1"
      }, {
        "key" : "key2",
        "value" : "value3"
      } ]
    }

Example Responses

None

Status Codes

Status Code

Description

204

No Content

Error Codes

See Error Codes.