This page shows you how to list the Cloud Storage buckets in a project, which are ordered in the list lexicographically by name. For an overview of buckets, read the Key Terms.
To list the buckets in a project:
Console
Open the Cloud Storage browser in the Google Cloud Console.Open the Cloud Storage browser
Buckets that are part of the currently selected project appear in the browser list.
gsutil
Use the gsutil ls
command:
gsutil ls
The response looks like the following example:
gs://[BUCKET_NAME1]/ gs://[BUCKET_NAME2]/ gs://[BUCKET_NAME3]/ ...
Code samples
For more information, see the
Cloud Storage C++ API reference documentation
.
For more information, see the
Cloud Storage C# API reference documentation
.
For more information, see the
Cloud Storage Go API reference documentation
.
For more information, see the
Cloud Storage Java API reference documentation
.
For more information, see the
Cloud Storage Node.js API reference documentation
.
For more information, see the
Cloud Storage PHP API reference documentation
.
For more information, see the
Cloud Storage Python API reference documentation
.
For more information, see the
Cloud Storage Ruby API reference documentation
.
C++
C#
Go
Java
Node.js
PHP
Python
Ruby
REST APIs
JSON API
- Get an authorization access token from the OAuth 2.0 Playground. Configure the playground to use your own OAuth credentials.
Use
cURL
to call the JSON API with aGET
Service request:curl -X GET -H "Authorization: Bearer [OAUTH2_TOKEN]" \ "https://storage.googleapis.com/storage/v1/b?project=[PROJECT_NAME]"
Where:
[OAUTH2_TOKEN]
is the access token you generated in Step 1.[PROJECT_NAME]
is the name of the project containing the buckets you want to list. For example,my-project
.
You can use a
prefix=[PREFIX]
query string parameter to limit results to buckets that have the specified prefix.
XML API
- Get an authorization access token from the OAuth 2.0 Playground. Configure the playground to use your own OAuth credentials.
Use
cURL
to call the XML API with aGET
Service request:curl -X GET -H "Authorization: Bearer [OAUTH2_TOKEN]" \ -H "x-goog-project-id: [PROJECT_NAME]" \ "https://storage.googleapis.com"
Where:
[OAUTH2_TOKEN]
is the access token you generated in Step 1.[PROJECT_NAME]
is the name of the project containing the buckets you want to list. For example,my-project
.
You can use a
prefix=[PREFIX]
query string parameter to limit results to buckets that have the specified prefix.