Retrieves an object's metadata — ETag, size, and last modified time — without downloading the object itself.
This command corresponds to the GetObjectMeta API operation.
Prerequisites
Before you begin, ensure that you have:
ossutil installed and configured with a valid endpoint and credentials
The
oss:GetObjectpermission on the target bucket (required for RAM users and Security Token Service (STS) users)
Alibaba Cloud account owners have this permission by default.
Syntax
ossutil api get-object-meta --bucket <bucket-name> --key <object-key> [flags]Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
--bucket | string | Yes | Name of the bucket |
--key | string | Yes | Full path of the object (object key) |
--version-id | string | No | Version ID of the object. Use this to retrieve metadata for a specific version in a versioning-enabled bucket. |
For additional flags (such as --output-format), run ossutil api --help.
Examples
Get metadata for an object
ossutil api get-object-meta --bucket examplebucket --key exampleobjectGet metadata in JSON format
ossutil api get-object-meta --bucket examplebucket --key exampleobject --output-format jsonGet metadata for a specific version
ossutil api get-object-meta --bucket examplebucket --key exampleobject --version-id 123Output fields
The response includes the following fields:
| Field | Description |
|---|---|
ETag | Entity tag that identifies a specific version of the object. |
Size | Object size in bytes. |
LastModified | Date and time when the object was last modified. |
get-object-meta returns only these three fields and does not return the object body. For the full set of object metadata, use the GetObjectMeta API reference.Usage notes
Symbolic links: If the object is a symbolic link, the command returns metadata for the symbolic link itself, not the target object.
Permissions: RAM users and STS users require the
oss:GetObjectpermission.Versioning: Without
--version-id, the command retrieves metadata for the current version of the object.
What's next
GetObjectMeta API reference — Underlying API documentation and full response schema