All Products
Search
Document Center

Object Storage Service:list-buckets (get-service)

Last Updated:Mar 20, 2026

Lists all buckets owned by the requester.

Usage notes

  • To run this command, you need the oss:ListBuckets(GetService) permission. For details, see Attach a custom policy to a RAM user.

  • Use --prefix, --marker, or --max-keys to filter results.

  • When all buckets fit in a single response, the XML output does not include Prefix, Marker, MaxKeys, IsTruncated, or NextMarker elements.

Syntax

ossutil api list-buckets [flags]
FlagTypeDescription
--prefixstringReturn only buckets whose names contain this prefix.
--markerstringReturn buckets whose names come after this value alphabetically.
--max-keysintMaximum number of buckets to return per request.
--resource-group-idstringReturn only buckets that belong to this resource group.
list-buckets maps to the ListBuckets(GetService) API operation. For global command-line options, see Global command-line options.

Examples

List all buckets:

ossutil api list-buckets

List all buckets in JSON format:

ossutil api list-buckets --output-format json

List all buckets in YAML format:

ossutil api list-buckets --output-format yaml

List buckets whose names start with example:

ossutil api list-buckets --prefix example

List the first 100 buckets:

ossutil api list-buckets --max-keys 100

List buckets after examplebucket alphabetically:

ossutil api list-buckets --marker examplebucket

List buckets in a specific resource group:

ossutil api list-buckets --resource-group-id rg-123