## List Buckets `r2.buckets.list(BucketListParams**kwargs) -> BucketListResponse` **get** `/accounts/{account_id}/r2/buckets` Lists all R2 buckets on your account. ### Parameters - `account_id: str` Account ID. - `cursor: Optional[str]` Pagination cursor received during the last List Buckets call. R2 buckets are paginated using cursors instead of page numbers. - `direction: Optional[Literal["asc", "desc"]]` Direction to order buckets. - `"asc"` - `"desc"` - `name_contains: Optional[str]` Bucket names to filter by. Only buckets with this phrase in their name will be returned. - `order: Optional[Literal["name"]]` Field to order buckets by. - `"name"` - `per_page: Optional[float]` Maximum number of buckets to return in a single call. - `start_after: Optional[str]` Bucket name to start searching after. Buckets are ordered lexicographically. - `jurisdiction: Optional[Literal["default", "eu", "fedramp"]]` Jurisdiction where objects in this bucket are guaranteed to be stored. - `"default"` - `"eu"` - `"fedramp"` ### Returns - `class BucketListResponse: …` - `buckets: Optional[List[Bucket]]` - `creation_date: Optional[str]` Creation timestamp. - `jurisdiction: Optional[Literal["default", "eu", "fedramp"]]` Jurisdiction where objects in this bucket are guaranteed to be stored. - `"default"` - `"eu"` - `"fedramp"` - `location: Optional[Literal["apac", "eeur", "enam", 3 more]]` Location of the bucket. - `"apac"` - `"eeur"` - `"enam"` - `"weur"` - `"wnam"` - `"oc"` - `name: Optional[str]` Name of the bucket. - `storage_class: Optional[Literal["Standard", "InfrequentAccess"]]` Storage class for newly uploaded objects, unless specified otherwise. - `"Standard"` - `"InfrequentAccess"` ### Example ```python 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) ``` #### Response ```json { "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 } } ```