Storage
Store and serve files in buckets.
Create buckets in the dashboard under the database's Storage page. Public buckets serve files to anyone; private buckets need a key, a user token, or a signed URL. Storage policies control which users can read and write.
Base URL: https://api.clouzark.com/storage/<database ref>
| Request | Does |
|---|---|
POST /object/<bucket>/<path> | Upload (raw body). Add x-upsert: true to overwrite |
PUT /object/<bucket>/<path> | Upload or replace |
GET /object/<bucket>/<path> | Download |
DELETE /object/<bucket>/<path> | Delete |
GET /list/<bucket>?prefix=&limit=100&offset=0 | { objects } |
GET /public/<bucket>/<path> | Download from a public bucket, no key needed |
POST /sign/<bucket>/<path> { expiresIn } | { signedUrl, expiresAt }, a temporary link to a private file |
await fetch(`https://api.clouzark.com/storage/my-app-db/object/avatars/${userId}.png`, {
method: 'PUT',
headers: { apikey: ANON_KEY, Authorization: `Bearer ${token}`, 'Content-Type': 'image/png' },
body: file,
});