All Products
Search
Document Center

Object Storage Service:get-object-tagging

Last Updated:Mar 20, 2026

Retrieves the tags of an object in a bucket.

Usage notes

  • By default, an Alibaba Cloud account has permission to query object tags. A RAM user or Security Token Service (STS) credential requires the oss:GetObjectTagging permission. For details, see Attach a custom policy to a RAM user.

  • By default, the command retrieves the tags of the current version of an object. Specify --version-id to query a specific version.

Command syntax

ossutil api get-object-tagging --bucket <value> --key <value>
                               [--version-id <value>]
                               [flags]
  • Parameters without brackets are required.

  • Parameters in brackets [ ] are optional.

The get-object-tagging command maps to the GetObjectTagging API operation. For supported global flags, see Command-line options.

Parameters

ParameterTypeRequiredDescription
--bucketstringYesBucket name.
--keystringYesFull path of the object, for example, dir/example.txt.
--version-idstringNoVersion ID of the object. If omitted, the current version is queried.

Examples

Query the tags of an object:

ossutil api get-object-tagging --bucket examplebucket --key exampleobject

Query the tags and display the output in JSON format:

ossutil api get-object-tagging --bucket examplebucket --key exampleobject --output-format json

Query the tags and display the output in YAML format:

ossutil api get-object-tagging --bucket examplebucket --key exampleobject --output-format yaml