CUBSTER Join the waitlist
DOCS / SDK

Uploads & SDK

@cubster/assets is a typed, framework-agnostic client — zero React in the core. A client is created with createCubsterClient() and exposes four namespaces plus a set of pure URL builders.

Namespace Methods
apiKeys create, list, revoke
workspaces list, create
uploads upload, createGrant, uploadWithGrant
assets list, get, update, delete
URL builders imageUrl, fileUrl, rawImageUrl, assetUrl, imageCascadePath, imageSrcSet, assetSrcSet, assetStorageKey
cubster.uploads

Direct uploads (server, with a key), plus a grant flow for third-party browser uploads.

const asset = await cubster.uploads.upload({
  file: new Blob([buffer], { type: 'image/png' }),
  filename: 'photo.png',
  tags: ['hero', 'landing'],
})
cubster.assets

List (with type/search/tag filters), get, update, or delete assets already uploaded.

const images = await cubster.assets.list({ type: 'image', tags: ['hero'], limit: 20 })
await cubster.assets.update(asset.id, { displayName: 'Hero (v2)' })
await cubster.assets.delete(asset.id)
cubster.apiKeys

Session-only (a key can't mint other keys). The full secret is only ever returned once, on create.

const created = await cubster.apiKeys.create({ label: 'CI' })
console.log(created.key) // the full secret — shown exactly once
cubster.workspaces

List or create workspaces you own — see the Workspaces concept page for the full management surface (rename, delete) exposed over REST.

URL builders (pure)

No client needed — these mirror the API's serve-URL cascade exactly. Presets: thumb, avatar, hero, small, medium, large. SVGs and generic files always serve as forced downloads from /f/:key.

import { imageUrl, fileUrl, assetUrl } from '@cubster/assets'
imageUrl('key.png', { preset: 'thumb' }) // /img/thumb/key.png
fileUrl('doc.pdf') // /f/doc.pdf
Errors

Every non-2xx response throws a typed CubsterError carrying the HTTP status and the API's { error } message.

Limits
  • Max file size: 25 MB
  • Per-workspace storage cap: 1 GB
  • Image types: png, jpeg, webp, gif, avif, svg+xml
  • File types: pdf, text/plain, csv, markdown, json, zip