Updated on 2026-04-17 GMT+08:00

Listing Buckets

Functions

This API is used to list all buckets that you have created across all regions. For more information, see Listing Buckets.

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

RegionID does not restrict the query result. No matter which region ID is entered, the query result returns the list of buckets in all regions. You can obtain the region ID from Supported Regions.

GET / HTTP/1.1 
Date: GMT Date
Authorization: SignatureValue

URI Parameters

The request of this API contains no URI parameters.

Request Headers

This API uses common request headers and additional request headers. Table 1 describes the common request headers. The following table describes the additional request headers.

Table 1 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 Body

This request contains no request body parameters.

Response Syntax

GET HTTP/1.1 status_code
Content-Type: type
Date: GMT Date
Content-Length: BodyLength

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

Response Headers

This response uses common headers. For details, see Table 1.

Response Body

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

Table 2 Response body parameters

Parameter

Type

Description

ListAllMyBucketsResult

XML

Definition

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

Range

N/A

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>

Using SDKs to Call APIs

You are advised to use OBS SDKs to call APIs. SDKs encapsulate APIs to simplify development. You can call SDK API functions to access OBS without manually calculating signatures.

Java

Python

C

Go

BrowserJS: not supported

.NET

Android

iOS

PHP

Node.js

References