All Products
Search
Document Center

:TagResources

Last Updated:Aug 28, 2026

Adds tags to a resource.

Operation description

Note

API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.

Attaches tags to resources in ApsaraMQ for RocketMQ. You can use tags to classify resources for easier aggregation and search.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

mq:TagResources

update

*All Resource

*

None
  • mq:QueryInstanceBaseInfo

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

No

The ID of the ApsaraMQ for RocketMQ instance that contains the resource to which you want to attach tags.

Note

This parameter is required when you attach tags to a topic or a group.

MQ_INST_188077086902****_BXSuW61e

ResourceType

string

Yes

The type of the resource to which you want to attach tags. Valid values:

  • INSTANCE

  • TOPIC

  • GROUP

TOPIC

Tag

array<object>

Yes

The tags that you want to attach to the resource.

object

No

Key

string

Yes

The tag key. If you set this parameter, you must also set the Value parameter.

  • The value of this parameter cannot be an empty string.

  • A tag key must be 1 to 128 characters in length and cannot contain http:// or https://. A tag key cannot start with acs: or aliyun.

FinanceDept

Value

string

Yes

The tag value. If you set this parameter, you must also set the Key parameter.

  • The value of this parameter can be an empty string.

  • A tag value must be 1 to 128 characters in length and cannot contain http:// or https://. A tag value cannot start with acs: or aliyun.

FinanceJoshua

ResourceId

array

Yes

The resource IDs.

TopicA

string

No

The ID of the resource to which you want to attach a tag.

  • If the resource is an ApsaraMQ for RocketMQ instance, specify the instance ID.

  • If the resource is a topic, specify the topic name.

  • If the resource is a group, specify the ID of the group.

TopicA

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID, which is used for troubleshooting.

301D2CBE-66F8-403D-AEC0-82582478****

Examples

Success response

JSON format

{
  "RequestId": "301D2CBE-66F8-403D-AEC0-82582478****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.