Updated on 2026-03-06 GMT+08:00

Listing Buckets

Functions

You can perform this operation to list all buckets that you have created across all regions.

Constraints

  • Regardless of the endpoint you specified, a list of buckets spanning all regions is returned.
  • When creating a bucket, do not list buckets.
  • An account that has not passed real-name authentication cannot use the global domain name to list buckets. The global domain name does not contain any region ID, and its format is obs.myhuaweicloud.com.

Authorization Information

The account root user has the permissions to call all APIs, but other IAM users under the account must have the permission to list buckets before calling this API. You are advised to use IAM for authorization. You can use either role/policy-based authorization or identity policy-based authorization and configure the required permission:
  • If you use role/policy-based authorization (IAM v3 APIs in the old IAM version), you need to grant the obs:bucket:ListAllMyBuckets permission. For details, see Creating a Custom IAM Policy.
  • If you use identity policy-based authorization (IAM v5 APIs in the new IAM version), you need to grant the obs:bucket:listAllMyBuckets permission, as shown in the following table. For details, see Creating a Custom IAM Identity Policy.

    Action

    Access Level

    Resource Type (*: Required)

    Condition Key

    Alias

    Dependencies

    obs:bucket:listAllMyBuckets

    List

    bucket *

    -

    -

    -

    -

    • obs:EpochTime
    • obs:SourceIp
    • obs:TlsVersion
    • obs:CustomDomain

Request Syntax

1
2
3
4
GET / HTTP/1.1 
Host: obs.region.myhuaweicloud.com
Date: date
Authorization: authorization

Request Parameters

This request contains no parameters.

Request Headers

This request's message header is the same as that of a common request. For details, see Table 1. This request can contain additional headers. The following table describes the additional headers for this request.

Table 1 Additional request headers

Parameter

Mandatory (Yes/No)

Type

Description

x-obs-bucket-type

No

String

Definition:

This header specifies the type of buckets contained in the list.

Example: x-obs-bucket-type: POSIX

Constraints:

If this header is not carried, the list of all buckets and parallel file systems is obtained.

Range:

  • OBJECT: Obtain the list of all buckets.
  • POSIX: Obtain the list of all parallel file systems.

Default value:

If the request header is not carried, the default value is blank, indicating that both OBJECT and POSIX are carried.

Request Elements

The request does not use request elements.

Response Syntax

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
GET HTTP/1.1 status_code
Content-Type: type
Date: date
Content-Length: length

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<ListAllMyBucketsResult xmlns="http://obs.region.myhuaweicloud.com/doc/2015-06-30/"> 
    <Owner> 
        <ID>id</ID>
    </Owner> 
    <Buckets>
        <Bucket> 
            <Name>bucketName</Name> 
            <CreationDate>date</CreationDate>
            <Location>region</Location>
            <BucketType>buckettype</BucketType>
        </Bucket> 
        ... 
    </Buckets> 
</ListAllMyBucketsResult> 

Response Headers

The response to the request uses common headers. For details, see Table 1.

Response Elements

This response contains the XML list of buckets owned by the user. Table 2 describes the elements.

Table 2 Response elements

Parameter

Type

Description

ListAllMyBucketsResult

XML

Definition:

List of buckets. It is the parent node of Owner and Buckets.

Range:

None

Owner

XML

Definition:

Owner of the bucket.

Range:

For details, see Table 3.

Buckets

XML

Definition:

List of buckets returned.

Range:

For details, see Table 4.

Table 3 Owner parameters

Parameter

Type

Description

ID

String

Definition:

Domain ID (account ID) of the owner.

Range:

For details, see Domain ID.

Table 4 Buckets parameters

Parameter

Type

Description

Bucket

XML

Definition:

Detailed bucket information, including the bucket name and creation time.

Range:

For details, see Table 5.

Table 5 Bucket parameters

Parameter

Type

Description

Name

String

Definition:

Bucket name

Range:

The value is a string of 3 to 63 characters.

CreationDate

String

Definition:

Time (UTC) when the bucket is created. The date is in the ISO8601 format, for example, 2025-06-28T08:57:41.047Z.

Range:

The value is a string of 24 characters.

Location

String

Definition:

Region where a bucket is located

Range:

For more information about valid OBS regions and endpoints, see Regions and Endpoints.

BucketType

String

Definition:

Bucket type

Range:

  • OBJECT: object bucket
  • POSIX: parallel file system

Error Responses

No special error responses are returned. For details about error responses, see Table 2.

Sample Request

1
2
3
4
5
6
7
GET /
 HTTP/1.1
User-Agent: curl/7.29.0
Host: obs.region.myhuaweicloud.com
Accept: */*
Date: Mon, 25 Jun 2018 05:37:12 +0000
Authorization: OBS GKDF4C7Q6SI0IPGTXTJN:9HXkVQIiQKw33UEmyBI4rWrzmic= 

Sample Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: BF260000016435722C11379647A8A00A
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSGGDRUM62QZi3hGP8Fz3gOloYCfZ39U
Content-Type: application/xml
Date: Mon, 25 Jun 2018 05:37:12 GMT
Content-Length: 460

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ListAllMyBucketsResult xmlns="http://obs.ap-southeast-1.myhuaweicloud.com/doc/2015-06-30/">
  <Owner>
    <ID>783fc6652cf246c096ea836694f71855</ID>
  </Owner>
  <Buckets>
    <Bucket>
      <Name>examplebucket01</Name>
      <CreationDate>2018-06-21T09:15:01.032Z</CreationDate>
      <Location>region</Location>
      <BucketType>OBJECT</BucketType>
    </Bucket>
    <Bucket>
      <Name>examplebucket02</Name>
      <CreationDate>2018-06-22T03:56:33.700Z</CreationDate>
      <Location>region</Location>
      <BucketType>OBJECT</BucketType>
    </Bucket>
  </Buckets>
</ListAllMyBucketsResult>