# Storage overview

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

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

S3-backed object storage on your project host at /storage/v1. Public and private buckets, direct browser uploads, metered downloads, and server-enforced quotas.

## How Storage is organized

Each project has buckets, and each bucket holds objects at logical paths such as `images/avatar.png`. Folders are path prefixes only — nothing is created for them. The catalog (buckets, objects, upload sessions, events) lives in a managed `storage` schema in your project’s PostgreSQL database. The file bytes live in the deployment’s private, encrypted S3 bucket under opaque platform-generated keys; your filenames never become S3 keys.

| Piece | Where it lives | Who can touch it |
| --- | --- | --- |
| Bucket and object metadata | Project database, `storage` schema | The engine only — not the Data API or SQL roles’ writes |
| File bytes | Private S3 bucket, encrypted at rest | The engine’s IAM role; clients via short-lived authorizations |
| Quota accounting | Central metadata database | The engine, atomically per upload and download |

## Authentication

Storage reuses the platform credentials. Every request carries the `apikey` header with the project’s publishable key. Writes and private reads additionally need an `Authorization: Bearer` token: either an end-user JWT from CubiBase Auth, or a secret API key (`cb_sec_…`) for trusted server code. Public-bucket reads need only the publishable key.

| Credential | Can do |
| --- | --- |
| Publishable key alone | Read objects in public buckets (metered) |
| Publishable key + user JWT | Upload, list, read, and delete according to bucket visibility and object ownership |
| Publishable key + secret API key | Full project-scoped access — still subject to every quota |
| Signed download token | Read exactly one object until the token expires |

> **important**: Secret API keys are server-side credentials. Never ship them in a browser or mobile bundle. Quotas, project isolation, and audit logging apply to them exactly like to any other caller.

## Route map

| Call | Purpose |
| --- | --- |
| `POST /storage/v1/buckets` | Create a bucket |
| `GET /storage/v1/buckets` | List buckets |
| `GET /storage/v1/buckets/{bucket}` | Bucket configuration |
| `PATCH /storage/v1/buckets/{bucket}` | Update visibility, size cap, MIME allowlist |
| `DELETE /storage/v1/buckets/{bucket}` | Delete the bucket and its objects |
| `POST /storage/v1/objects/upload` | Start an upload (reserves quota, returns the S3 policy) |
| `POST /storage/v1/uploads/{id}/complete` | Verify and finalize the uploaded object |
| `GET /storage/v1/uploads/{id}` | Upload session status |
| `GET /storage/v1/objects` | List objects by bucket, prefix, and search |
| `GET /storage/v1/objects/{id}` | Object metadata |
| `GET /storage/v1/objects/{id}/content` | Download (metered; Range supported) |
| `POST /storage/v1/objects/{id}/sign` | Short-lived signed download link |
| `GET /storage/v1/public/{bucket}/{path}` | Anonymous public-bucket read (metered) |
| `DELETE /storage/v1/objects/{id}` | Delete an object |
| `GET /storage/v1/usage` | This project’s storage and bandwidth consumption |

**List objects · prefix browsing**

```http
GET https://example-project.api.cubibase.com/storage/v1/objects?bucket=avatars&prefix=images/&delimiter=true&limit=50
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT_OR_SECRET_KEY>
```

## In the Console

Open a project and choose Storage. The overview shows project, account, and bandwidth quotas with warnings at 50%, 75%, 90%, and 100%. Buckets manages visibility and limits; Files is a prefix-based browser with drag-and-drop uploads, downloads, share links, and deletion. Console traffic passes through the same quota and event machinery as the API — there is no unmetered side door.

- [Buckets](https://cubibase.com/docs/storage/buckets) Create and configure public and private buckets.
- [Uploading files](https://cubibase.com/docs/storage/uploads) The three-step direct-to-S3 upload contract.
- [Downloads and sharing](https://cubibase.com/docs/storage/downloads) Public URLs, authorized reads, and signed links.
- [Quotas and errors](https://cubibase.com/docs/storage/quotas) Limits per plan and the machine-readable error codes.

## Additional resources

- [Storage security](https://cubibase.com/docs/storage/security) Isolation, path safety, and what public really means.
- [Object events](https://cubibase.com/docs/storage/events) The durable event contract and function triggers.
- [Storage feature page](https://cubibase.com/features/storage) The product-level overview.
