Create Bucket
r2.buckets.create(BucketCreateParams**kwargs) -> Bucket
POST/accounts/{account_id}/r2/buckets
Creates a new R2 bucket.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
Accepted Permissions (at least one required)
Create Bucket
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
bucket = client.r2.buckets.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
name="example-bucket",
)
print(bucket.creation_date){
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
"string"
],
"result": {
"creation_date": "creation_date",
"jurisdiction": "default",
"location": "apac",
"name": "example-bucket",
"storage_class": "Standard"
},
"success": true
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
"string"
],
"result": {
"creation_date": "creation_date",
"jurisdiction": "default",
"location": "apac",
"name": "example-bucket",
"storage_class": "Standard"
},
"success": true
}