Skip to content

JavaScript SDK API reference

CURRENT · 2.3.0

js
import { opencloud, OpenCloudError, isOpenCloudError } from "/_opencloud/sdk.js";
APIReturnsDetails
OPEN_CLOUD_SDK_VERSION"2.3.0"Deployment-pinned browser SDK version
opencloud.app.info()Promise<OpenCloudAppInfo>App metadata
opencloud.auth.currentUser()Promise<OpenCloudUser | null>Optional user
opencloud.auth.requireUser()Promise<OpenCloudUser>Required user
opencloud.auth.signInUrl()stringSafe same-origin sign-in link
opencloud.data.table(name)OpenCloudDataTableBounded row operations
opencloud.files.upload({ data, name?, contentType?, maxBytes?, onProgress? })Promise<OpenCloudFile>Managed upload
opencloud.files.info(fileOrId)Promise<OpenCloudFile>Current metadata
opencloud.files.download(fileOrId)Promise<OpenCloudFileDownload>Download
opencloud.files.save(fileOrId)Promise<void>Browser save dialog
opencloud.files.replace(fileOrId, { data, ... })Promise<OpenCloudFile>Replace managed contents
opencloud.files.remove(fileOrId)Promise<void>Idempotent removal
opencloud.files.attach({ data, table, values?, columns?, ... })Promise<{ file, record }>Upload plus metadata row
opencloud.functions.call(name, input?)Promise<Output>Parsed Function result
opencloud.functions.stream(name, input?)Promise<ReadableStream<Uint8Array>>Streaming Function result
opencloud.notifications.status()Promise<OpenCloudNotificationStatus>Support, permission, and subscription state
opencloud.notifications.subscribe()Promise<OpenCloudNotificationStatus>Enable this signed-in browser from a user action
opencloud.notifications.unsubscribe()Promise<OpenCloudNotificationStatus>Disable this signed-in browser
opencloud.realtime.subscribe(topic, handler)Promise<() => void>Private subscription
opencloud.realtime.publish(topic, event, payload)Promise<void>Private broadcast
opencloud.telemetry.summary()Promise<OpenCloudTelemetrySummary>Telemetry summary
opencloud.telemetry.increment(name, value?, options?)Promise<OpenCloudMetricWriteResult>Custom counter
opencloud.telemetry.gauge(name, value, options?)Promise<OpenCloudMetricWriteResult>Custom gauge
opencloud.dispose()voidRelease cached client state

OpenCloudDataTable provides list, getById, create, createMany, updateById, and deleteById.

The exact deployment declarations are served at /_opencloud/sdk.d.ts. See Errors and Versioning. The SDK never returns credentials, Storage paths, or raw platform responses. Provider integrations are available only inside Functions through the integrations context; see brokered integrations.

Self-hosted infrastructure for agent-built applications.