Object storage is in beta.
Create a bucket
- Open Object storage in the sidebar and select Create bucket.
- Enter a name: 3 to 63 lowercase letters, digits and hyphens, unique in the workspace.
- The bucket is private by default. To make it public, open the bucket’s Settings tab and turn on public access.
Work with files in the dashboard
Inside a bucket you can:- upload files with Upload or by dragging them onto the list;
- create folders (a folder appears once a file is uploaded into it);
- download, copy a public link (public buckets), and delete files or whole folders.
Public and private buckets
Uploading and deleting always require a key, also for public buckets.
Public file links
Every file in a public bucket has its own link:Private files
Private files are read through the API with a key. Never put a key in browser code; read the file on your server and send it to the visitor, or keep the bucket private and serve files through your app.Connect a bucket to your app
The easiest way to use object storage from an app is to connect a bucket in the app’s settings. Servbase then adds the configuration to the app for you.- Open your app and go to Settings, then Object storage.
- Choose the bucket and the access: Read and write, or Read only.
- Select Connect bucket.
A running app restarts automatically so it picks up the new variables. A static site reads them on its next deployment.
- Change switches to another bucket or access level; the old key is revoked.
- Disconnect revokes the key and removes the variables.
- Only the workspace owner can connect or disconnect a bucket, because it creates an API key.
- The key appears on the API page as
App storage: <app domain>. If you delete it there, the settings page shows that the connection stopped working.
Use the bucket in your code
Every request sends the key as a bearer token. Paths below are relative toSERVBASE_STORAGE_ENDPOINT.
Example: show uploaded images from a public bucket
When the connected bucket is public, build image links fromSERVBASE_STORAGE_PUBLIC_URL instead of downloading the files:
Express
Example: serve a private file to signed-in users
Flask
Use the API without connecting an app
For scripts or CI, create an API key on the API page with the storage scopes it needs (storage:read, storage:write, storage:delete, and storage:buckets to create or change buckets), for all buckets or only specific ones. Every endpoint, with examples, is in the Object storage API reference:
