/storage/buckets/{bucketId}/filesScope files.writeCreate 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.
Parameters
Section titled “Parameters”bucketId string required
Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.
fileId string required
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 required
Binary file. Owbase SDKs provide helpers to handle file input. Learn about file input.
permissions string[]
An array of permission strings. By default, only the current user is granted all permissions. Learn more about permissions.
folder string
Virtual folder to place the file in, for example “photos/2026”. Nest folders with /. Defaults to the bucket root.
onProgress (progress: UploadProgress) => void
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).
Responses
Section titled “Responses”201Success400Invalid or missing parameter401No session, no permission on the resource or key without the scope404Resource in the path not found429Rate limitEvery error comes as JSON with code, type and message: see Errors.
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});curl -X POST "https://cloud.owbase.dev/v1/storage/buckets/<BUCKET_ID>/files" \ -H "X-Owbase-Project: <PROJECT_ID>" \ -H "X-Owbase-Key: $OWBASE_API_KEY" \ -F "fileId=<FILE_ID>" \{ "$id": "5e5ea5c16897e", "bucketId": "5e5ea5c16897e", "$createdAt": "2020-10-15T06:38:00.000+00:00", "$updatedAt": "2020-10-15T06:38:00.000+00:00", "$permissions": [ "read(\"any\")" ], "name": "Pink.png", "folder": "photos/2026/", "key": "photos/2026/Pink.png", "signature": "5d529fd02b544198ae075bd57c1762bb", "mimeType": "image/png", "sizeOriginal": 17890, "sizeActual": 12345, "chunksTotal": 17890, "chunksUploaded": 17890, "encryption": true, "compression": "gzip"}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.