Public and private buckets
A bucket is a named container for objects, unique within the project. Each bucket is public or private, can cap the file size below the plan maximum, and can restrict uploads to an allowlist of MIME types such as image/* or application/pdf.
- Public means anonymous read-only access to published files. Uploads, overwrites, and deletions always require authorization.
- Private buckets require a project API key, an end-user session, or a short-lived signed download link.
- Folders are path prefixes, not real directories: images/avatar.png is a logical path, while the stored object uses an opaque generated key.
- Bucket metadata lives in a managed storage schema in the project database — customer code cannot read or write it directly.
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/*"]
}
Direct uploads, verified completion
An upload takes three steps. Your client starts an upload session; CubiBase reserves the bytes against the project and account quotas and returns a short-lived presigned POST pinned to one upload and the exact declared size. The client posts the file directly to storage. Then the client completes the session: CubiBase checks the stored object’s exact size and MIME type, publishes it at its path, and turns the reservation into committed usage.
Completion is idempotent, expired sessions release their reservations automatically, and a failed upload never becomes a downloadable object or emits a creation event. Overwriting an existing path requires an explicit opt-in and accounts for the net change in bytes.
Upload
- 1Start the upload
POST /storage/v1/objects/uploadChecks the bucket rules and reserves quota. - 2Send the bytes
POST <presigned URL>The client uploads straight to object storage. - 3Complete it
POST /storage/v1/uploads/{id}/completeVerifies the object and records it in the catalog.
Read
- Public bucket
GET /storage/v1/public/{bucket}/{path} - Private object
GET /storage/v1/objects/{id}/content - Signed link
POST /storage/v1/objects/{id}/sign
POST https://example-project.api.cubibase.com/storage/v1/objects/upload
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT_OR_SECRET_KEY>
Content-Type: application/json
{
"bucket": "avatars",
"path": "images/mika.png",
"sizeBytes": 182344,
"mimeType": "image/png",
"overwrite": false
}
POST https://example-project.api.cubibase.com/storage/v1/uploads/<UPLOAD_ID>/complete
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT_OR_SECRET_KEY>
Metered downloads and signed links
Every download — public or private, API or Console — counts against the account’s monthly bandwidth quota. HTTP Range requests are supported and metered byte-accurately; a canceled download counts only the bytes actually delivered. There are no unrestricted download URLs that could bypass the meter.
For sharing, CubiBase issues a signed download token scoped to a single object with a short expiry. Public objects also have a stable public URL.
POST https://example-project.api.cubibase.com/storage/v1/objects/<OBJECT_ID>/sign
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <SECRET_API_KEY>
Content-Type: application/json
{}
GET https://example-project.api.cubibase.com/storage/v1/public/avatars/images/mika.png
apikey: cb_pub_EXAMPLE_ONLY
GET https://example-project.api.cubibase.com/storage/v1/objects/<OBJECT_ID>/content
apikey: cb_pub_EXAMPLE_ONLY
Authorization: Bearer <USER_JWT_OR_SECRET_KEY>
Quotas enforced on the server
Storage limits come from the same subscription as the rest of the platform, shared across your organization: Free includes 2 GB of object storage, Pro 100 GB, Business 250 GB, with 15 GB/500 GB/750 GB of monthly total bandwidth shared by API responses and file delivery (API bandwidth is a sublimit of that total) and a 50 MB/1 GB/5 GB maximum file size. Capacity is checked atomically before any upload authorization is issued, so concurrent uploads cannot race past it.
- At a storage limit, new uploads are blocked; downloads, deletions, and upgrades keep working.
- When bandwidth is exhausted, downloads are refused until the billing cycle resets; metadata management stays available.
- Downgrading below current usage preserves every file and blocks uploads until usage fits the new plan.
- No automatic overage charges: by default a quota is a hard stop, not a bill. Paid plans can opt in to metered additional usage with a spending limit.
HTTP/1.1 402 Payment Required
{
"error": {
"code": "STORAGE_PROJECT_QUOTA_EXCEEDED",
"message": "Project storage limit reached…",
"details": { "quota": "storage_project_bytes", "limit": 1073741824, "used": 1073741824 }
}
}
Durable object events and function triggers
Every finalized upload, overwrite, and deletion records a versioned storage.object.created, storage.object.updated, or storage.object.deleted event in the same database transaction as the catalog change. Events carry the project, bucket, object, path, size, and actor identity — never file contents or credentials.
CubiBase Functions consume these events through storage triggers: generate thumbnails, process PDFs, clean up expired files. Configure a bucket, event types, and an optional key prefix in the Console — no polling infrastructure of your own. Function-created objects count toward the same quotas through the same service, and invocation-depth tracking bounds recursive loops.
{
"schemaVersion": 1,
"eventId": "3f7a…",
"eventType": "storage.object.created",
"projectId": "4c8d…",
"bucketId": "a11b…",
"objectId": "9b1e…",
"path": "images/mika.png",
"sizeBytes": 182344,
"mimeType": "image/png",
"actorId": "user_mika",
"source": "storage-api",
"correlationId": "f2c6…",
"timestamp": "2026-11-20T10:05:00.000Z"
}