All Products
Search
Document Center

:UntagResources

更新時間:Dec 20, 2023

Removes tags from Elastic Compute Service (ECS) resources. After a tag is removed from a resource, the tag is automatically deleted if it is not added to other resources.

Debugging

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 parameters

Parameter

Type

Required

Example

Description

Action String Yes UntagResources

The operation that you want to perform. Set the value to UntagResources.

RegionId String Yes cn-hangzhou

The region ID of the resource. You can call the DescribeRegions operation to query the most recent region list.

ResourceType String Yes instance

The type of the resource. Valid values:

  • instance: ECS instance
  • disk: disk
  • snapshot: snapshot
  • image: image
  • securitygroup: security group
  • volume: storage volume
  • eni: elastic network interface (ENI)
  • ddh: dedicated host
  • ddhcluster: dedicated host cluster
  • keypair: SSH key pair
  • launchtemplate: launch template
  • reservedinstance: reserved instance
  • snapshotpolicy: automatic snapshot policy
  • elasticityassurance: elasticity assurance
  • capacityreservation: capacity reservation
  • command: Cloud Assistant command
  • invocation: Cloud Assistant command execution result or file delivery result
  • activation: activation code for the Cloud Assistant managed instance
  • managedinstance: Cloud Assistant managed instance
All Boolean No false

Specifies whether to remove all tags from the resource. This parameter is valid only when the TagKey.N parameter is not specified. Valid values:

  • true
  • false

Default value: false.

ResourceId.N String Yes i-bp67acfmxazb4ph****

The ID of the resource.

TagKey.N String No TestKey

The key of tag N of the resource.

Response parameters

Parameter

Type

Example

Description

RequestId String C46FF5A8-C5F0-4024-8262-B16B639225A0

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=UntagResources
&RegionId=cn-hangzhou
&ResourceType=instance
&ResourceId.1=i-bp1j6qtvdm8w0z1o0****
&TagKey.1=TestKey
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<UntagResourcesResponse>
    <RequestId>C46FF5A8-C5F0-4024-8262-B16B639225A0</RequestId>
</UntagResourcesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "C46FF5A8-C5F0-4024-8262-B16B639225A0"
}

Error codes

HTTP status code

Error code

Error message

Description

400 Duplicate.TagKey The Tag.N.Key contain duplicate key. The tag key already exists. Tag keys must be unique.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. Invalid Tag.N.Key value.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. Invalid Tag.N.Value value.
400 OperationDenied.QuotaExceed The quota of tags on resource is beyond permitted range. The maximum number of tags is exceeded.
400 InvalidTag.Mismatch The specified Tag.n.Key and Tag.n.Value are not match. The Tag.N.Key and Tag.N.Value values do not correspond to each other.
400 InvalidTagCount The specified tags are beyond the permitted range. The maximum number of tags is exceeded.
400 Invalid.Scope The specified scope is invalid. Invalid Scope value.
403 PermissionDenied.TagOwnerUid The specified operator not have permission to set TagOwnerUid value. You are not authorized to specify the TagOwnerUid parameter.
403 PermissionDenied.Scope The specified operator not have permission to set Scope value. You are not authorized to specify the Scope parameter.
403 InvalidResourceId.NotSupported The specified ResourceId does not support tagging. The specified resource does not support tagging.
403 NoPermission.Tag The operator is not permission for the tag. You are not authorized to manage the tag.
404 InvalidRegionId.NotFound %s The specified region ID is not found.
404 MissingParameter.TagOwnerUid The parameter - TagOwnerUid should not be null TagOwnerUid is required.
404 MissingParameter.TagOwnerBid The parameter - TagOwnerBid should not be null TagOwnerBid is required.
404 MissingParameter.Tags The parameter - Tags should not be null The tag-related parameters are required.
404 MissingParameter.RegionId The parameter - RegionId should not be null RegionId is required.
404 InvalidResourceId.NotFound The specified ResourceIds are not found in our records. The specified resource does not exist. Check whether the ResourceId parameter is correct.
404 InvalidResourceType.NotFound The ResourceType provided does not exist in our records. The specified resource type is not found.
404 InvalidRegionId.NotFound The specified RegionId does not exist. The specified region ID does not exist.

For a list of error codes, see Service error codes.