This page shows you how get information on the metadata of your Cloud Storage buckets, excluding IAM policies and ACLs.
To learn how to get the IAM policy of your bucket, see View the IAM policy for a bucket.
Required roles
In order to get the required permissions for getting the metadata of a Cloud Storage bucket, ask your administrator to grant you the Storage Admin (roles/storage.admin) role on the bucket.
This role contains the permissions required to get the metadata of a bucket. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
- storage.buckets.get
- storage.buckets.list- This permission is only needed if you plan on using the Google Cloud console to perform the task on this page.
 
You might also be able to get these permissions with other predefined roles or custom roles.
For instructions on granting roles on buckets, see Set and manage IAM policies on buckets.
Display a bucket's metadata
Console
- In the Google Cloud console, go to the Cloud Storage Buckets page.
 
- In the bucket list, click the name of the bucket whose metadata you want to view. 
- Click the Configuration tab to view bucket details such as the included regions, storage class, permissions, and replication type. 
Command line
Use the gcloud storage buckets describe command:
gcloud storage buckets describe gs://BUCKET_NAME
Where:
- BUCKET_NAMEis the name of the bucket whose metadata you want to view. For example,- my-awesome-bucket.
If successful, the response looks similar to the following example:
defaultEventBasedHold: false etag: CAE= iamConfiguration: bucketPolicyOnly: enabled: true ...
Client libraries
   For more information, see the Cloud Storage C++ API reference documentation.   To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.   For more information, see the Cloud Storage C# API reference documentation.   To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.   For more information, see the Cloud Storage Go API reference documentation.   To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.   For more information, see the Cloud Storage Java API reference documentation.   To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.   For more information, see the Cloud Storage Node.js API reference documentation.   To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.   For more information, see the Cloud Storage PHP API reference documentation.   To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.   For more information, see the Cloud Storage Python API reference documentation.   To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.   For more information, see the Cloud Storage Ruby API reference documentation.   To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries. C++
 C#
 Go
 Java
 Node.js
 PHP
 Python
 Ruby
 
Terraform
You can use a Terraform resource to view a bucket's metadata.
REST APIs
JSON API
- Have gcloud CLI installed and initialized, which lets you generate an access token for the - Authorizationheader.
- Use - cURLto call the JSON API with a- GETBucket request:- curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/storage/v1/b/BUCKET_NAME" - Where - BUCKET_NAMEis the name of the relevant bucket. For example,- my-bucket.- Optionally, you can narrow down the metadata results by using the - fieldsquery string parameter. For example:- curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/storage/v1/b/BUCKET_NAME?fields=FIELD1%2CFIELD2" - Where - FIELD#is a bucket property you want to include in the result. For example,- projectNumberand- storageClass.
The response looks like the following example:
{ "projectNumber": "123456789012", "storageClass": "STANDARD" }
XML API
- Have gcloud CLI installed and initialized, which lets you generate an access token for the - Authorizationheader.
- Use - cURLto call the XML API with a- GETBucket request:- curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/BUCKET_NAME?QUERY_PARAMETER" - Where: - BUCKET_NAMEis the name of the relevant bucket. For example,- my-bucket.
- QUERY_PARAMETERis the metadata field you want to return. For example,- storageClassfor getting the bucket's storage class. You can only use one query parameter at a time with the XML API. For a list of metadata fields supported by the XML API, see the- GETBucket reference page.
 - The response looks like the following example: - <StorageClass>STANDARD</StorageClass>.
What's next
- Read the bucket metadata overview.
- List the objects in your bucket.
- Get the size of your bucket.
- Get object metadata.
- Change the default storage class for your bucket.
Try it for yourself
If you're new to Google Cloud, create an account to evaluate how Cloud Storage performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
Try Cloud Storage free