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

Adding Resource Tags in Batches

Function

This API is used to add tags to a specified instance in batches.

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

vpn::tagResource

write

vpnGateways

  • g:EnterpriseProjectId
  • g:RequestTag/<tag-key>
  • g:ResourceTag/<tag-key>
  • g:TagKeys

vpn:resourceInstanceTags:create

-

customerGateways

  • g:ResourceTag/<tag-key>
  • g:RequestTag/<tag-key>
  • g:TagKeys

vpnConnections

  • g:EnterpriseProjectId
  • g:RequestTag/<tag-key>
  • g:ResourceTag/<tag-key>
  • g:TagKeys

URI

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

Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Specifies a project ID. You can obtain the project ID by referring to Obtaining the Project ID.

resource_type

String

Yes

  • Specifies the resource type.
  • Value range:

    vpn-gateway: S2C VPN gateway

    customer-gateway: customer gateway

    vpn-connection: VPN connection

resource_id

String

Yes

Indicates a resource ID.

Request

  • Request parameters
    Table 2 Request parameters

    Parameter

    Type

    Mandatory

    Description

    tags

    Array of ResourceTag objects

    Yes

    • Specifies a tag list.
    • A maximum of 20 tags can be specified.
    Table 3 ResourceTag

    Parameter

    Type

    Mandatory

    Description

    key

    String

    Yes

    • Specifies a tag key.
    • The value is a string of 1 to 128 characters that can contain digits, letters, Spanish characters, Portuguese characters, spaces, and special characters (_ . : = + - @).

    value

    String

    No

    • Specifies a tag value.
    • The value is a string of 0 to 255 characters that can contain digits, letters, Spanish characters, Portuguese characters, spaces, and special characters (_ . : = + - @).
  • Example request
    POST https://{Endpoint}/v5/{project_id}/{resource_type}/{resource_id}/tags/create
    {
        "tags": [{
            "key": "key1",
            "value": "value1"
        }]
    }

Response

  • Response parameters

    Returned status code 204: Tags are successfully added.

Status Codes

For details, see Status Codes.