All Products
Search
Document Center

ENS:ListObjects

Last Updated:Mar 27, 2026

Queries the information about all objects in a bucket.

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

ens:ListObjects

list

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

BucketName

string

Yes

The name of the bucket.

test

EncodingType

string

No

The encoding type of the object names in the response. Only URL encoding is supported.

url

Marker

string

No

The position from which the list operation starts. If this parameter is specified, objects whose names are alphabetically greater than value of Marker are returned. The Marker parameter is used to list the returned objects by page, and its value must be smaller than 1,024 bytes in length.

Even if the value specified for Marker does not exist in the list during a conditional query, the list starts from the object whose name is alphabetically greater than the value of Marker.

a

MaxKeys

integer

No

The maximum number of objects to return. Valid values: 0 to 1000. Default value: 100.

100

Prefix

string

No

The prefix that must be included in the names of objects you want to list. If you specify a prefix to query objects, the returned object names contain the prefix.

The value of the parameter must be less than 1,000 bytes in length.

b

ContinuationToken

string

No

The token used in this list operation. If the number of objects exceeds the value of MaxKeys, the NextContinuationToken is included in the response as the token for the next list operation.

test1.txt

StartAfter

string

No

The position from which the list operation starts. If this parameter is specified, objects whose names are alphabetically greater than the value of StartAfter are returned. The StartAfter parameter is used to list the returned objects by page, and its value must be less than 1,000 bytes in length. Even if the value specified for StartAfter does not exist in the list during a conditional query, the list starts from the object whose name is alphabetically greater than the value of StartAfter.

b

Response elements

Element

Type

Description

Example

object

CommonPrefixes

array

If the delimiter parameter is specified in the request, the response contains CommonPrefixes. Objects whose names contain the same string from the prefix to the next occurrence of the delimiter are grouped as a single result element in CommonPrefixes.

string

If the delimiter parameter is specified in the request, the response contains CommonPrefixes. Objects whose names contain the same string from the prefix to the next occurrence of the delimiter are grouped as a single result element in CommonPrefixes.

Not applicable

NextContinuationToken

string

The token used in the next list operation.

CgJiYw--

ContinuationToken

string

The token used in this list operation.

test1.txt

Delimiter

string

The character used to group objects by name.

/

EncodingType

string

The encoding type of the object names in the response.

Not applicable

Prefix

string

The prefix contained in the names of returned objects.

b

Marker

string

The position from which the list operation starts.

ceshi.txt1617853707991

BucketName

string

The name of the bucket.

test

Contents

array<object>

The list of object metadata.

object

Key

string

The name of the object.

ceshi.txt1617853706546

LastModified

string

The time when the object was last modified.

2021-04-08T03:48:47.488Z

ETag

string

The entity tag (ETag). When an object is created, an ETag is created to identify the content of the object.

  • For an object that is created by calling the PutObject operation, the ETag value of the object is the MD5 hash of the object content.

  • For an object that is not created by calling the PutObject operation, the ETag value of the object is the UUID of the object content.

  • The ETag of an object can be used to check whether the object content is modified. However, we recommend that you use the MD5 hash of an object rather than the ETag value of the object to verify data integrity.

5B3C1A2E053D763E1B002CC607C5****

Size

integer

The size of the returned object. Unit: bytes.

15

IsTruncated

boolean

Indicates whether the listed objects are truncated. Valid values:

  • false

  • true

true

KeyCount

integer

The number of keys returned for this request.

10

NextMarker

string

The position from which the next list operation starts.

ceshi.txt1617853707991

MaxKeys

integer

The maximum number of objects returned.

10

RequestId

string

The ID of the request.

4833C4AC-9396-458C-8F25-1D701334E560

Examples

Success response

JSON format

{
  "CommonPrefixes": [
    "Not applicable"
  ],
  "NextContinuationToken": "CgJiYw--",
  "ContinuationToken": "test1.txt",
  "Delimiter": "/",
  "EncodingType": "Not applicable",
  "Prefix": "b",
  "Marker": "ceshi.txt1617853707991",
  "BucketName": "test",
  "Contents": [
    {
      "Key": "ceshi.txt1617853706546",
      "LastModified": "2021-04-08T03:48:47.488Z",
      "ETag": "5B3C1A2E053D763E1B002CC607C5****",
      "Size": 15
    }
  ],
  "IsTruncated": true,
  "KeyCount": 10,
  "NextMarker": "ceshi.txt1617853707991",
  "MaxKeys": 10,
  "RequestId": "4833C4AC-9396-458C-8F25-1D701334E560"
}

Error codes

HTTP status code

Error code

Error message

Description

400 Invalid%s Specified parameter %s is not valid
400 InvalidBucketName Specified parameter BucketName is not valid. The specified BucketName parameter is invalid.
400 InvalidPrefix Specified parameter Prefix is not valid.
400 InvalidStartAfter Specified parameter StartAfter is not valid.
400 InvalidMarker Specified parameter Marker is not valid.
400 InvalidDelimiter Specified parameter Delimiter is not valid.
400 NoPermission Permission denied.
400 InvalidParameter.%s The specified field %s invalid. Please check it again.
400 InvalidArgument Specified parameter ContinuationToken is incorrect. The ContinuationToken parameters set are incorrect.
500 InternalError The request processing has failed due to some unknown error.
403 AccessDenied auth is not valid
403 UserDisable The user has been disabled due to arrears. The user has been disabled due to arrears.
404 NoSuchBucket The specified bucket does not exist. The requested bucket does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.