# Buckets

Source: https://cubibase.com/docs/storage/buckets

Also available: [Markdown version](https://cubibase.com/docs/storage/buckets.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt)

A bucket is a named container with a visibility mode, an optional file size cap, and an optional MIME allowlist. Names are unique within the project.

## Create a bucket

Bucket names are 2–63 characters: lowercase letters, digits, dots, dashes, and underscores, starting with a letter or digit. Creating, updating, and deleting buckets requires a secret API key (or a Console owner/admin session).

**POST /storage/v1/buckets**

```http
POST https://example-project.api.cubibase.com/storage/v1/buckets
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <SECRET_API_KEY>
Content-Type: application/json

{
  "name": "avatars",
  "public": true,
  "allowedMimeTypes": ["image/*"]
}
```

| Field | Type | Meaning |
| --- | --- | --- |
| `name` | string, required | Unique within the project |
| `public` | boolean, default `false` | `true` = anonymous read-only downloads |
| `fileSizeLimitBytes` | integer or null | Per-bucket cap; can only lower the plan maximum |
| `allowedMimeTypes` | string[] or null | Allowlist of exact types or `type/*` wildcards; null allows any |

## Public versus private

- Public: anyone with the publishable key can read published objects at `/storage/v1/public/{bucket}/{path}`. Reads are metered against bandwidth.
- Private: reads require an end-user JWT, a secret API key, or a signed download token. Listing private metadata always requires authorization.
- Neither mode allows anonymous uploads, overwrites, or deletions. Public is a read setting, not a write setting.
- Visibility can be flipped at any time with `PATCH`; existing signed links keep their expiry.

## Size cap and MIME allowlist

The effective maximum file size is the smaller of the plan limit and the bucket cap. The MIME allowlist is checked twice: against the declared type when the upload starts, and against the verified content type reported by S3 at completion — a client cannot sneak a disallowed type past it by lying in the request.

> **note**: Deleting a bucket deletes every object inside it from S3 and the catalog, and returns the bytes to your quota. The Console asks for confirmation; the API does not.

## Additional resources

- [Uploading files](https://cubibase.com/docs/storage/uploads) Start an upload into your new bucket.
- [Quotas and errors](https://cubibase.com/docs/storage/quotas) How the plan and bucket caps interact.
