Adds tags to resources.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

Request syntax

POST /openapi/tags HTTP/1.1

Request parameters

Parameter Type Position Required Example Description
Object Body No

The information about the resources and tags that you want to create.

ResourceIds Array of String Body Yes ["es-cn-aaa","es-cn-bbb"]

The resource IDs. Uses the JSON array format. A maximum of 20 sub-items are supported.

Tags Array Body Yes

Details of the tag.

key String Body Yes env

A tag key.

value String Body Yes IT

A tag value.

ResourceType String Body Yes INSTANCE

The type of the resource. Set the value to INSTANCE.

  • If a key exists in Tags, a value must be an empty string. Otherwise, the error message InvalidParameter.TagKey.
  • If the input key-value pair is duplicate, the error Duplicate.TagKey is returned.
  • If the same tag key exists before the custom tag, the value of the tag key is overwritten.

Response parameters

Parameter Type Example Description
Result Boolean true

Returned results:

  • true: The tag resource relationship is created.
  • false: The tag resource relationship fails to be created.
RequestId String 3D8795D9-8FF5-46B2-86E6-E3B407*******

The ID of the request.


Sample requests

POST /openapi/tags HTTP/1.1

    "Tags": [
            "key": "env",
            "value": "IT"
    "ResourceType": "INSTANCE"

Sample success response

JSON format

HTTP/1.1 200 OK

  "Result" : true,
  "RequestId" : "27627E6B-E26A-406F-B6E1-0247882C****"

Error codes

For a list of error codes, visit the API Error Center.