reference

Storage API

Upload, download, list, and manage files using the Postbase Storage API and SDK.

Published: March 22, 2026Updated: March 22, 2026

Storage API

Postbase Storage is an S3-compatible file storage layer built on MinIO (or AWS S3 / Cloudflare R2). It organises files into buckets and objects.

Bucket Endpoints

  • GET /api/storage/v1/bucket — List all buckets

  • POST /api/storage/v1/bucket — Create a bucket

  • GET/PUT/DELETE /api/storage/v1/bucket/:id — Get, update, or delete a bucket

  • POST /api/storage/v1/bucket/:id/empty — Delete all objects in a bucket

Object Endpoints

  • POST /api/storage/v1/object/:bucket/:path — Upload (create new)

  • PUT /api/storage/v1/object/:bucket/:path — Upsert (create or overwrite)

  • GET /api/storage/v1/object/:bucket/:path — Download (requires API key)

  • DELETE /api/storage/v1/object/:bucket — Delete multiple objects (body: {"prefixes": [...]})

  • POST /api/storage/v1/object/list/:bucket — List objects with prefix and pagination

  • POST /api/storage/v1/object/sign/:bucket/:path — Generate a pre-signed URL

  • POST /api/storage/v1/object/move — Move / rename an object

  • POST /api/storage/v1/object/copy — Copy an object

  • GET /api/storage/v1/object/public/:bucket/:path — Serve a public object (no auth required)

Bucket Options

  • public: boolean — If true, objects are accessible without authentication via the public endpoint

  • allowedMimeTypes: string[] — Restrict uploads to specific MIME types

  • fileSizeLimit: number — Maximum file size in bytes

SDK Example

// Upload
const { data, error } = await postbase.storage
  .from('avatars')
  .upload('user-123.png', file, { contentType: 'image/png' })

// Get public URL
const { data: { publicUrl } } = postbase.storage
  .from('avatars')
  .getPublicUrl('user-123.png')

// List
const { data: files } = await postbase.storage
  .from('avatars')
  .list('folder/', { limit: 20 })

// Delete
await postbase.storage.from('avatars').remove(['user-123.png'])

Pre-signed URLs

const { data } = await postbase.storage
  .from('documents')
  .createSignedUrl('report.pdf', 3600) // expires in 1 hour

console.log(data.signedUrl)