Storage

Buckets

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
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/*"]
}
FieldTypeMeaning
namestring, requiredUnique within the project
publicboolean, default falsetrue = anonymous read-only downloads
fileSizeLimitBytesinteger or nullPer-bucket cap; can only lower the plan maximum
allowedMimeTypesstring[] or nullAllowlist 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.

Additional resources