Buckets and files: upload, download, view and image previews.
Class Storage: 13 methods (8 in @owbase/web, 13 in @owbase/node). The examples use the object form of the parameters; replace the values between < and > with your own.
listBuckets
Section titled “listBuckets”List buckets
GET /storage/buckets · method page
SDK: @owbase/node only
Get a list of all the storage buckets. You can use the query params to filter your results.
| Parameter | Type | Required | Description |
|---|---|---|---|
queries |
string[] |
no | Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations, stripMetadata |
search |
string |
no | Search term to filter your list results. Max length: 256 chars. |
total |
boolean |
no | When set to false, the total count returned will be 0 and will not be calculated. |
Access: API key with the buckets.read scope.
import { Client, Storage } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secret API key
const storage = new Storage(client);
const result = await storage.listBuckets({ queries: [], // optional search: '<SEARCH>', // optional total: false, // optional});createBucket
Section titled “createBucket”Create bucket
POST /storage/buckets · method page
SDK: @owbase/node only
Create a new storage bucket.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Unique Id. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can’t start with a special char. Max length is 36 chars. |
name |
string |
yes | Bucket name |
permissions |
string[] |
no | An array of permission strings. By default, no user is granted with any permissions. Learn more about permissions. |
fileSecurity |
boolean |
no | Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. Learn more about permissions. |
enabled |
boolean |
no | Is bucket enabled? When set to ‘disabled’, users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. |
maximumFileSize |
number |
no | Maximum file size allowed in bytes. Maximum allowed value is 0B. |
allowedFileExtensions |
string[] |
no | Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. |
compression |
Compression |
no | Compression algorithm chosen for compression. Can be one of none, gzip, or zstd, For file size above 20MB compression is skipped even if it’s enabled Values: none, gzip, zstd. |
encryption |
boolean |
no | Is encryption enabled? For file size above 20MB encryption is skipped even if it’s enabled |
antivirus |
boolean |
no | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it’s enabled |
transformations |
boolean |
no | Are image transformations enabled? |
description |
string |
no | Optional description for the bucket. |
stripMetadata |
boolean |
no | Remove metadata such as location, device and capture time from uploaded images. The color profile and orientation are kept. For file size above 20MB metadata is not removed even if it’s enabled. |
Access: API key with the buckets.write scope.
import { Client, Storage, Permission, Role, Compression } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secret API key
const storage = new Storage(client);
const result = await storage.createBucket({ bucketId: '<BUCKET_ID>', name: '<NAME>', permissions: [Permission.read(Role.any())], // optional fileSecurity: false, // optional enabled: false, // optional maximumFileSize: 1, // optional allowedFileExtensions: [], // optional compression: Compression.None, // optional encryption: false, // optional antivirus: false, // optional transformations: false, // optional description: '<DESCRIPTION>', // optional stripMetadata: false, // optional});getBucket
Section titled “getBucket”Get bucket
GET /storage/buckets/{bucketId} · method page
SDK: @owbase/node only
Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Bucket unique ID. |
Access: API key with the buckets.read scope.
import { Client, Storage } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secret API key
const storage = new Storage(client);
const result = await storage.getBucket({ bucketId: '<BUCKET_ID>',});updateBucket
Section titled “updateBucket”Update bucket
PUT /storage/buckets/{bucketId} · method page
SDK: @owbase/node only
Update a storage bucket by its unique ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Bucket unique ID. |
name |
string |
yes | Bucket name |
permissions |
string[] |
no | An array of permission strings. By default, the current permissions are inherited. Learn more about permissions. |
fileSecurity |
boolean |
no | Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. Learn more about permissions. |
enabled |
boolean |
no | Is bucket enabled? When set to ‘disabled’, users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. |
maximumFileSize |
number |
no | Maximum file size allowed in bytes. Maximum allowed value is 0B. |
allowedFileExtensions |
string[] |
no | Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. |
compression |
Compression |
no | Compression algorithm chosen for compression. Can be one of none, gzip, or zstd, For file size above 20MB compression is skipped even if it’s enabled Values: none, gzip, zstd. |
encryption |
boolean |
no | Is encryption enabled? For file size above 20MB encryption is skipped even if it’s enabled |
antivirus |
boolean |
no | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it’s enabled |
transformations |
boolean |
no | Are image transformations enabled? |
description |
string |
no | Optional description for the bucket. |
stripMetadata |
boolean |
no | Remove metadata such as location, device and capture time from uploaded images. The color profile and orientation are kept. For file size above 20MB metadata is not removed even if it’s enabled. By default, the current setting is kept. |
Access: API key with the buckets.write scope.
import { Client, Storage, Permission, Role, Compression } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secret API key
const storage = new Storage(client);
const result = await storage.updateBucket({ bucketId: '<BUCKET_ID>', name: '<NAME>', permissions: [Permission.read(Role.any())], // optional fileSecurity: false, // optional enabled: false, // optional maximumFileSize: 1, // optional allowedFileExtensions: [], // optional compression: Compression.None, // optional encryption: false, // optional antivirus: false, // optional transformations: false, // optional description: '<DESCRIPTION>', // optional stripMetadata: false, // optional});deleteBucket
Section titled “deleteBucket”Delete bucket
DELETE /storage/buckets/{bucketId} · method page
SDK: @owbase/node only
Delete a storage bucket by its unique ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Bucket unique ID. |
Access: API key with the buckets.write scope.
import { Client, Storage } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secret API key
const storage = new Storage(client);
const result = await storage.deleteBucket({ bucketId: '<BUCKET_ID>',});listFiles
Section titled “listFiles”List files
GET /storage/buckets/{bucketId}/files · method page
SDK: @owbase/web and @owbase/node
Get a list of all the user files. You can use the query params to filter your results.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration. |
queries |
string[] |
no | Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, folder, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded |
search |
string |
no | Search term to filter your list results. Max length: 256 chars. |
total |
boolean |
no | When set to false, the total count returned will be 0 and will not be calculated. |
Access: API key with the files.read scope or user session, or even no session (the resource’s permissions apply).
import { Client, Storage } from '@owbase/web';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = await storage.listFiles({ bucketId: '<BUCKET_ID>', queries: [], // optional search: '<SEARCH>', // optional total: false, // optional});
console.log(result);import { Client, Storage } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setSession(''); // The user session to authenticate with
const storage = new Storage(client);
const result = await storage.listFiles({ bucketId: '<BUCKET_ID>', queries: [], // optional search: '<SEARCH>', // optional total: false, // optional});createFile
Section titled “createFile”Create file
POST /storage/buckets/{bucketId}/files · method page
SDK: @owbase/web and @owbase/node
Create a new file. Before using this route, you should create a new bucket resource using either a server integration API or directly from your Owbase console.
Larger files should be uploaded using multiple requests with the content-range header to send a partial request with a maximum supported chunk of 5MB. The content-range header values should always be in bytes.
When the first request is sent, the server will return the File object, and the subsequent part request must include the file’s id in x-owbase-id header to allow the server to know that the partial upload is for the existing file and not for a new one.
If you’re creating a new file using one of the Owbase SDKs, all the chunking logic will be managed by the SDK internally.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration. |
fileId |
string |
yes | File ID. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can’t start with a special char. Max length is 36 chars. |
file |
File (in node, also InputFile) |
yes | Binary file. Owbase SDKs provide helpers to handle file input. Learn about file input. |
permissions |
string[] |
no | An array of permission strings. By default, only the current user is granted all permissions. Learn more about permissions. |
folder |
string |
no | Virtual folder to place the file in, for example “photos/2026”. Nest folders with /. Defaults to the bucket root. |
onProgress |
(progress: UploadProgress) => void |
no | Callback called after each uploaded chunk with the upload progress ($id, progress in percent, sizeUploaded, chunksTotal, chunksUploaded). |
Access: API key with the files.write scope or user session, or even no session (the resource’s permissions apply).
import { Client, Storage, Permission, Role } from '@owbase/web';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = await storage.createFile({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>', file: document.getElementById('uploader').files[0], permissions: [Permission.read(Role.any())], // optional folder: 'photos/2026', // optional});
console.log(result);import { Client, Storage, Permission, Role } from '@owbase/node';import { InputFile } from '@owbase/node/file';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setSession(''); // The user session to authenticate with
const storage = new Storage(client);
const result = await storage.createFile({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>', file: InputFile.fromPath('/path/to/file', 'filename'), permissions: [Permission.read(Role.any())], // optional folder: 'photos/2026', // optional});getFile
Section titled “getFile”Get file
GET /storage/buckets/{bucketId}/files/{fileId} · method page
SDK: @owbase/web and @owbase/node
Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration. |
fileId |
string |
yes | File ID. |
Access: API key with the files.read scope or user session, or even no session (the resource’s permissions apply).
import { Client, Storage } from '@owbase/web';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = await storage.getFile({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>',});
console.log(result);import { Client, Storage } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setSession(''); // The user session to authenticate with
const storage = new Storage(client);
const result = await storage.getFile({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>',});updateFile
Section titled “updateFile”Update file
PUT /storage/buckets/{bucketId}/files/{fileId} · method page
SDK: @owbase/web and @owbase/node
Update a file by its unique ID. Only users with write permissions have access to update this resource.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Bucket unique ID. |
fileId |
string |
yes | File ID. |
name |
string |
no | File name. |
permissions |
string[] |
no | An array of permission strings. By default, the current permissions are inherited. Learn more about permissions. |
Access: API key with the files.write scope or user session, or even no session (the resource’s permissions apply).
import { Client, Storage, Permission, Role } from '@owbase/web';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = await storage.updateFile({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>', name: '', // optional permissions: [Permission.read(Role.any())], // optional});
console.log(result);import { Client, Storage, Permission, Role } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setSession(''); // The user session to authenticate with
const storage = new Storage(client);
const result = await storage.updateFile({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>', name: '', // optional permissions: [Permission.read(Role.any())], // optional});deleteFile
Section titled “deleteFile”Delete file
DELETE /storage/buckets/{bucketId}/files/{fileId} · method page
SDK: @owbase/web and @owbase/node
Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration. |
fileId |
string |
yes | File ID. |
Access: API key with the files.write scope or user session, or even no session (the resource’s permissions apply).
import { Client, Storage } from '@owbase/web';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = await storage.deleteFile({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>',});
console.log(result);import { Client, Storage } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setSession(''); // The user session to authenticate with
const storage = new Storage(client);
const result = await storage.deleteFile({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>',});getFileDownload
Section titled “getFileDownload”Get file for download
GET /storage/buckets/{bucketId}/files/{fileId}/download · method page
SDK: @owbase/web and @owbase/node
Get a file content by its unique ID. The endpoint response return with a ‘Content-Disposition: attachment’ header that tells the browser to start downloading the file to user downloads directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Storage bucket ID. You can create a new storage bucket using the Storage service server integration. |
fileId |
string |
yes | File ID. |
token |
string |
no | File token for accessing this file. |
Access: API key with the files.read scope or user session, or even no session (the resource’s permissions apply).
import { Client, Storage } from '@owbase/web';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = storage.getFileDownload({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>', token: '<TOKEN>', // optional});
console.log(result);import { Client, Storage } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setSession(''); // The user session to authenticate with
const storage = new Storage(client);
const result = await storage.getFileDownload({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>', token: '<TOKEN>', // optional});getFilePreview
Section titled “getFilePreview”Get file preview
GET /storage/buckets/{bucketId}/files/{fileId}/preview · method page
SDK: @owbase/web and @owbase/node
Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration. |
fileId |
string |
yes | File ID |
width |
number |
no | Resize preview image width, Pass an integer between 0 to 4000. |
height |
number |
no | Resize preview image height, Pass an integer between 0 to 4000. |
gravity |
ImageGravity |
no | Image crop gravity. Can be one of auto,center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right Values: auto, center, top-left, top, top-right, left, right, bottom-left, bottom, bottom-right. |
quality |
number |
no | Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. |
borderWidth |
number |
no | Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0. |
borderColor |
string |
no | Preview image border color. Use a valid HEX color, no # is needed for prefix. |
borderRadius |
number |
no | Preview image border radius in pixels. Pass an integer between 0 to 4000. |
opacity |
number |
no | Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1. |
rotation |
number |
no | Preview image rotation in degrees. Pass an integer between -360 and 360. |
background |
string |
no | Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. |
output |
ImageFormat |
no | Output format type (jpeg, jpg, png, gif and webp). Values: jpg, jpeg, png, webp, heic, avif, gif. |
token |
string |
no | File token for accessing this file. |
Access: API key with the files.read scope or user session, or even no session (the resource’s permissions apply).
import { Client, Storage, ImageGravity, ImageFormat } from '@owbase/web';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = storage.getFilePreview({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>', width: 0, // optional height: 0, // optional gravity: ImageGravity.Auto, // optional quality: -1, // optional borderWidth: 0, // optional borderColor: 'FFFFFF', // optional borderRadius: 0, // optional opacity: 0, // optional rotation: -360, // optional background: 'FFFFFF', // optional output: ImageFormat.Jpg, // optional token: '<TOKEN>', // optional});
console.log(result);import { Client, Storage, ImageGravity, ImageFormat } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setSession(''); // The user session to authenticate with
const storage = new Storage(client);
const result = await storage.getFilePreview({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>', width: 0, // optional height: 0, // optional gravity: ImageGravity.Auto, // optional quality: -1, // optional borderWidth: 0, // optional borderColor: 'FFFFFF', // optional borderRadius: 0, // optional opacity: 0, // optional rotation: -360, // optional background: 'FFFFFF', // optional output: ImageFormat.Jpg, // optional token: '<TOKEN>', // optional});getFileView
Section titled “getFileView”Get file for view
GET /storage/buckets/{bucketId}/files/{fileId}/view · method page
SDK: @owbase/web and @owbase/node
Get a file content by its unique ID. This endpoint is similar to the download method but returns with no ‘Content-Disposition: attachment’ header.
| Parameter | Type | Required | Description |
|---|---|---|---|
bucketId |
string |
yes | Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration. |
fileId |
string |
yes | File ID. |
token |
string |
no | File token for accessing this file. |
Access: API key with the files.read scope or user session, or even no session (the resource’s permissions apply).
import { Client, Storage } from '@owbase/web';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = storage.getFileView({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>', token: '<TOKEN>', // optional});
console.log(result);import { Client, Storage } from '@owbase/node';
const client = new Client() .setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setSession(''); // The user session to authenticate with
const storage = new Storage(client);
const result = await storage.getFileView({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>', token: '<TOKEN>', // optional});The descriptions on this page come from the server API specification (BSD-3-Clause license), and the examples come from the SDK generator (MIT license). The full notices are in the NOTICE file of the @owbase/web and @owbase/node packages.