Help Center/ VPC Endpoint/ API Reference/ API/ Tags/ Batch Adding or Deleting Tags to or from a Resource
Updated on 2025-10-28 GMT+08:00

Batch Adding or Deleting Tags to or from a Resource

Function

This API is used to batch add tags to or delete tags from a specified VPC endpoint service or VPC endpoint.

You can add up to 10 tags to a resource.

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

    vpcep::updateResourceTags

    Tagging

    endpoints

    -

    • vpcep:tags:update

    -

    endpointServices

    -

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

resource_type

Yes

String

Specifies the resource type.

  • endpoint_service: indicates the VPC endpoint service.

  • endpoint: indicates the VPC endpoint.

resource_id

Yes

String

Specifies the resource ID, which can be the ID of a VPC endpoint service or a VPC endpoint.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token. It can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token.

Content-Type

No

String

Specifies the MIME type of the request body. Default value application/json is recommended. For APIs used to upload objects or images, the MIME type varies depending on the flow type.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

tags

No

Array of ResourceTag objects

Specifies the tag list. If no tag is matched, an empty array is returned.

action

Yes

String

Specifies the operation to be performed, which only can be:

  • create

  • delete

Table 4 ResourceTag

Parameter

Mandatory

Type

Description

key

Yes

String

Specifies the tag key. A key can contain up to 128 Unicode characters.

The key must comply with the tag key configuration requirements.

value

No

String

Specifies the tag value. value is mandatory when action is set to create. Each value can contain 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. The tag value must comply with the tag value configuration requirements.

Response Parameters

Status code: 204

The server has successfully processed the request.

None

Example Requests

  • Adding resource tags

    POST https://{endpoint}/v1/{project_id}/endpoint_service/{resource_id}/tags/action
    
    {
      "action" : "create",
      "tags" : [ {
        "key" : "key1",
        "value" : "value1"
      }, {
        "key" : "key",
        "value" : "value3"
      } ]
    }
  • Deleting resource tags

    POST https://{endpoint}/v1/{project_id}/endpoint/{resource_id}/tags/action
    
    {
      "action" : "delete",
      "tags" : [ {
        "key" : "key1"
      }, {
        "key" : "key2",
        "value" : "value3"
      } ]
    }

Example Responses

None

Status Codes

Status Code

Description

204

The server has successfully processed the request.

Error Codes

See Error Codes.