View the [folders](https://docs.cloud.google.com/storage/docs/folders-overview.md.txt) within a bucket with hierarchical namespace enabled.

## Required permissions

The authenticated user must have the `storage.folders.list`
IAM permission to use this method.

## Request

### HTTP request

```
GET https://storage.googleapis.com/storage/v1/b/bucket/folders
```

In addition to [standard query parameters](https://docs.cloud.google.com/storage/docs/json_api/v1/parameters.md.txt#query),
the following parameters apply to this method.

To see an example of how to include query parameters in a request, see the
[JSON API Overview](https://docs.cloud.google.com/storage/docs/json_api.md.txt#query_parameters) page.

### Parameters

| Parameter name | Value | Description |
|---|---|---|
| **Path parameters** |||
| `bucket` | `string` | The parent bucket of the folder. |
| **Optional query parameters** |||
| `prefix` | `string` | Filter results to folders whose names begin with this prefix. If not set or set to an empty string, the method lists all folders in the bucket. If set to a non-empty string, the value must end with a `/`. |
| `maxResults` | `unsigned integer` | The maximum number of folders to return in a single response. The service may return fewer results than `maxResults` so the presence of `nextPageToken` should always be checked. |
| `pageToken` | `string` | A previously-returned page token representing part of the larger set of results to view. The `pageToken` is an encoded field containing the name of the last item (a folder) in the returned list. In a subsequent request using the `pageToken`, items that come after the `pageToken` are shown (up to `maxResults`). If you start a listing and then create a folder before using a `pageToken` to continue listing, you will not see the new folder in subsequent listing results if it is in part of the folder namespace already listed. |
| `delimiter` | `string` | Returns results in a directory-like mode, with `/` being the only supported value for the delimiter. If set, the method returns folders that exactly match the prefix or are one level below the given prefix. The folder matching the prefix is also returned as part of the response. |
| `startOffset` | `string` | Filter results to folders whose names are lexicographically equal to or after `startOffset`. If `endOffset` is also set, the folders listed have names between `startOffset` (inclusive) and `endOffset` (exclusive). |
| `endOffset` | `string` | Filter results to folders whose names are lexicographically before `endOffset`. If `startOffset` is also set, the folders listed have names between `startOffset` (inclusive) and `endOffset` (exclusive). |

### Request body

Don't supply a request body with this method.

## Response

If successful, this method returns a response body with the following structure, where the list
of folders are included in the `items` attribute and sorted alphabetically by
order:

```yaml
{
  "kind": "storage#folders"
  "nextPageToken": string,
  "items": [
    Folder resources
  ]
}
```

| Property name | Value | Description | Notes |
|---|---|---|---|
| `kind` | `string` | The kind of item this is. For lists of folders, this is always `storage#folders`. |   |
| `nextPageToken` | `string` | The continuation token. Provide this value as the `pageToken` of a subsequent request in order to return the next page of results. Note that the next page may be empty. If this is the last page of results, then no continuation token is returned. The presence of this parameter in the response should always be checked to ensure a complete listing of all the results. <br /> The `nextPageToken` is the name of the last folder in the returned list. In a subsequent list request using the `pageToken`, items that come after the token are shown (up to `maxResults`). |   |
| `items[]` | `list` | The list of [folders](https://docs.cloud.google.com/storage/docs/json_api/v1/folders.md.txt). |   |

For information about status and error codes returned by this API, see the
[reference page](https://docs.cloud.google.com/storage/docs/json_api/v1/status-codes.md.txt).

## Try it!


Use the APIs Explorer below to call this method on live data and see the response.