b2_create_bucket
Create a new B2 bucket with optional CORS, lifecycle, encryption, and Object Lock settings. Use for initial provisioning; duplicate names are rejected.
Instructions
Create a persistent B2 bucket with optional metadata, CORS, lifecycle, default encryption, and Object Lock enablement. Use for initial provisioning with a key that has writeBuckets; use b2_update_bucket for later settings changes and s3_head_bucket to check S3 reachability. Bucket names are globally unique, case-insensitive, 6-63 characters, letters/digits/hyphens/periods, and cannot start with 'b2-', begin/end with a period, contain '..', or look like an IPv4 address. Because names are unique across all of B2, requesting a name already in use (by this or any other account) fails with a duplicate-name error instead of returning the existing bucket; reuse the existing bucket only if it belongs to your own account, otherwise choose a different globally unique name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| corsRules | No | CORS rules: <=100. allowedOrigins/allowedOperations require 1-100 non-empty strings; allowedHeaders/exposeHeaders allow <=100. Strings <=999 chars. Per-rule UTF-8 total <1,000. Names unique. Omit to create the bucket without CORS rules. | |
| bucketInfo | No | Custom metadata: <=10 pairs. Keys: 1-50 UTF-8 bytes, chars A-Z a-z 0-9 . _ ` ~ ! # $ % ^ & * ' | + -, no b2- prefix. Values total <=10,000 UTF-8 bytes. Omit to create the bucket without custom metadata. | |
| bucketName | Yes | Globally unique bucket name: 6-63 characters, letters/digits/hyphens/periods, case-insensitive, no b2- prefix, no leading/trailing period, no '..', and not an IPv4 address. | |
| bucketType | Yes | Visibility for file downloads: allPrivate requires authorization; allPublic makes objects world-readable by URL. | |
| lifecycleRules | No | Optional B2 lifecycle rules applied after creation. Use for automatic hiding, deletion of hidden versions, or cancellation of unfinished large-file uploads; use s3_put_bucket_lifecycle only when you need the S3 lifecycle API shape. | |
| fileLockEnabled | No | Enable Object Lock (file lock) on the bucket at creation. (Object Lock can also be enabled later on an existing bucket via b2_update_bucket.) Must be true before any retention or legal hold can be applied to files in this bucket. | |
| defaultServerSideEncryption | No | Optional default server-side encryption for new files in this bucket. Omit to create the bucket without a bucket default encryption setting. |