---
title: List Buckets
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/python)

[R2](https://developers.cloudflare.com/api/python/resources/r2)

[Buckets](https://developers.cloudflare.com/api/python/resources/r2/subresources/buckets)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# List Buckets

r2.buckets.list(BucketListParams\*\*kwargs) -> [BucketListResponse](<https://developers.cloudflare.com/api/python/resources/r2#(resource)%20r2.buckets%20%3E%20(model)%20bucket_list_response%20%3E%20(schema)>)

GET/accounts/{account\_id}/r2/buckets

Lists a page of R2 buckets in the account and selected jurisdiction. Use the returned cursor to retrieve the next page.

##### Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. [Create a token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/).

**Example:**`Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY`

##### Accepted Permissions (at least one required)

`Workers R2 Storage Write``Workers R2 Storage Read`

##### ParametersExpand Collapse

account\_id: str

Cloudflare account ID that owns the R2 resource.

maxLength32

[Link to this property](<#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20account_id%20%3E%20(schema)>)

cursor: Optional\[str]

Pagination cursor received during the last List Buckets call. R2 buckets are paginated using cursors instead of page numbers.

[Link to this property](<#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20cursor%20%3E%20(schema)>)

<details>

<summary>

direction: Optional\[Literal\["asc", "desc"]]

Direction to order buckets.

</summary>

One of the following:

"asc"

<a href="#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20direction%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

"desc"

<a href="#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20direction%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

</details>

[Link to this property](<#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20direction%20%3E%20(schema)>)

name\_contains: Optional\[str]

Bucket names to filter by. Only buckets with this phrase in their name will be returned.

[Link to this property](<#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20name_contains%20%3E%20(schema)>)

order: Optional\[Literal\["name"]]

Field to order buckets by.

[Link to this property](<#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20order%20%3E%20(schema)>)

per\_page: Optional\[float]

Maximum number of buckets to return in a single call.

maximum1000

minimum1

[Link to this property](<#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20per_page%20%3E%20(schema)>)

start\_after: Optional\[str]

Bucket name to start searching after. Buckets are ordered lexicographically.

[Link to this property](<#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20start_after%20%3E%20(schema)>)

<details>

<summary>

cf\_r2\_jurisdiction: Optional\[Literal\["default", "eu", "us", 2 more]]

</summary>

One of the following:

"default"

<a href="#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20cf-r2-jurisdiction%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

"eu"

<a href="#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20cf-r2-jurisdiction%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

"us"

<a href="#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20cf-r2-jurisdiction%20%3E%20(schema)%20%3E%20(member)%202">Link to this property</a>

"fedramp"

<a href="#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20cf-r2-jurisdiction%20%3E%20(schema)%20%3E%20(member)%203">Link to this property</a>

"fedramp-high"

<a href="#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20cf-r2-jurisdiction%20%3E%20(schema)%20%3E%20(member)%204">Link to this property</a>

</details>

[Link to this property](<#(resource)%20r2.buckets%20%3E%20(method)%20list%20%3E%20(params)%20default%20%3E%20(param)%20cf-r2-jurisdiction%20%3E%20(schema)>)

##### ReturnsExpand Collapse

<details>

<summary>

class BucketListResponse: …

</summary>

<details>

<summary>

buckets: Optional\[List\[<a href="https://developers.cloudflare.com/api/python/resources/r2#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)">Bucket</a>]]

</summary>

creation\_date: Optional\[str]

Creation timestamp.

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20creation_date">Link to this property</a>

<details>

<summary>

jurisdiction: Optional\[Literal\["default", "eu", "us", 2 more]]

Jurisdiction where objects in this bucket are guaranteed to be stored.

</summary>

One of the following:

"default"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20jurisdiction%20%3E%20(member)%200">Link to this property</a>

"eu"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20jurisdiction%20%3E%20(member)%201">Link to this property</a>

"us"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20jurisdiction%20%3E%20(member)%202">Link to this property</a>

"fedramp"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20jurisdiction%20%3E%20(member)%203">Link to this property</a>

"fedramp-high"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20jurisdiction%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20jurisdiction">Link to this property</a>

<details>

<summary>

location: Optional\[Literal\["apac", "eeur", "enam", 3 more]]

Location of the bucket.

</summary>

One of the following:

"apac"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20location%20%3E%20(member)%200">Link to this property</a>

"eeur"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20location%20%3E%20(member)%201">Link to this property</a>

"enam"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20location%20%3E%20(member)%202">Link to this property</a>

"weur"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20location%20%3E%20(member)%203">Link to this property</a>

"wnam"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20location%20%3E%20(member)%204">Link to this property</a>

"oc"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20location%20%3E%20(member)%205">Link to this property</a>

</details>

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20location">Link to this property</a>

name: Optional\[str]

Name of the bucket.

maxLength64

minLength3

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

<details>

<summary>

storage\_class: Optional\[Literal\["Standard", "InfrequentAccess"]]

Storage class for newly uploaded objects, unless specified otherwise.

</summary>

One of the following:

"Standard"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20storage_class%20%3E%20(member)%200">Link to this property</a>

"InfrequentAccess"

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20storage_class%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket%20%3E%20(schema)%20%3E%20(property)%20storage_class">Link to this property</a>

</details>

<a href="#(resource)%20r2.buckets%20%3E%20(model)%20bucket_list_response%20%3E%20(schema)%20%3E%20(property)%20buckets">Link to this property</a>

</details>

[Link to this property](<#(resource)%20r2.buckets%20%3E%20(model)%20bucket_list_response%20%3E%20(schema)>)

### List Buckets

Python

HTTPTypeScriptPythonGoTerraform

```
import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
buckets = client.r2.buckets.list(
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(buckets.buckets)
```

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": {
    "buckets": [
      {
        "creation_date": "creation_date",
        "jurisdiction": "default",
        "location": "apac",
        "name": "example-bucket",
        "storage_class": "Standard"
      }
    ]
  },
  "success": true,
  "result_info": {
    "cursor": "1-JTdCJTIydiUyMiUzQTElMkMlMjJzdGFydEFmdGVyJTIyJTNBJTIyZGF2aWRwdWJsaWMlMjIlN0Q=",
    "per_page": 20
  }
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": {
    "buckets": [
      {
        "creation_date": "creation_date",
        "jurisdiction": "default",
        "location": "apac",
        "name": "example-bucket",
        "storage_class": "Standard"
      }
    ]
  },
  "success": true,
  "result_info": {
    "cursor": "1-JTdCJTIydiUyMiUzQTElMkMlMjJzdGFydEFmdGVyJTIyJTNBJTIyZGF2aWRwdWJsaWMlMjIlN0Q=",
    "per_page": 20
  }
}
```