Bento Spaces docs

Bento Spaces documentation

API

Minimal APIs, JSON in / JSON out, cookie sessions. Every write validates server-side; the client is never trusted for entitlements, geometry or share identity.

Auth

MethodPathNotes
POST/api/auth/register{ username, password }; 404 while Accounts:Open is false; seeds the account's default widget library
POST/api/auth/loginPBKDF2 verify, sets httpOnly session cookie, throttled
POST/api/auth/password{ currentPassword, newPassword }; verifies the old password, revokes other sessions and keeps the current one
POST/api/auth/logoutrevokes the session
GET/api/me{ kind, userId, username, plan, planStatus, readOnly, limits, entitlements, billing }; kind: "view" for a share session
GET/api/billing/planspublic plan catalogue, entitlements, provider and checkout availability
POST/api/billing/checkoutsession; { plan } → { url }; fake provider only on disposable storage
GET/api/billing/fake/checkout/{token}dev/test fake provider; activates the plan for the signed-in owner
POST/api/billing/webhookX-Billing-Secret; normalized provider event, idempotent by eventId
GET/api/tokenssession only; token metadata, never the secret
POST/api/tokenssession only; { name, readOnly?, expiresInDays? } → { token, secret }; the secret is returned once
DELETE/api/tokens/{id}session only; revoke a token

Every account route also accepts Authorization: Bearer bt_… instead of the cookie. A read-only token can only read (GET/HEAD); writes return 403 token_read_only. Token management itself always requires the browser session, so a leaked token cannot mint or revoke tokens.

Spaces

MethodPathNotes
GET/api/spacesdock metadata only (no layouts)
POST/api/spaces{ name, letter, color, wallpaper?, widgetTint? }; rejects past the plan limit
PUT/api/spaces/{id}rename / letter / colour / wallpaper / widgetTint / order
DELETE/api/spaces/{id}refuses if it is the last space
POST/api/spaces/{id}/duplicatecopies layout, widgets and wallpaper; counts against the plan
GET/api/spaces/{id}joined document: layout + widget instances + missing flags + revs
PUT/api/spaces/{id}/layoutIf-Match: rev; positions only
PUT/api/spaces/{id}/widgets/{containerId}If-Match: rev; type/version/props
POST/api/spaces/{id}/widgets/{containerId}/move{ toSpaceId, x?, y?, w?, h? }; edits both layouts, keeps values
POST/api/spaces/{id}/widgets/{containerId}/copysame body; new instance id with cloned props
DELETE/api/spaces/{id}/widgets/{containerId}empties the container, keeps it; instance goes to trash
POST/api/spaces/{id}/wallpapermultipart file, 2 MB, jpg/png/webp, Plus only
GET/api/spaces/{id}/wallpaperstreams the image, private, max-age=86400
GET/api/spaces/{id}/exportplanned, not implemented yet: self-contained HTML (Phase 6)

GET /api/spaces/{id} is the only place the join happens:

{
  "layout": { "rev": 12, "containers": [ … ] },
  "widgets": {
    "c_7f3a": { "rev": 4, "type": "clock", "version": "1.2.0", "props": {…}, "missing": false }
  },
  "meta": { "name": "Work", "letter": "W", "color": "#7c9cff", "widgetTint": "auto" }
}

Widgets and registries

MethodPathNotes
GET/api/widgets/installedthe library: enabled built-ins + downloaded manifests; a view session may read the owner's
POST/api/widgets/install{ registryId, widgetId, version }; registryId: "builtin" re-enables a built-in, otherwise verifies sha256; restores every existing placement
GET/api/widgets/{id}/usage{ total, spaces: [{ id, name, count }] }; where the type is placed
DELETE/api/widgets/{id}/{version}uninstall the type only; a built-in is disabled in the library; placements and their values stay
GET/api/widgets/{id}/settingsaccount-wide defaults for that type
PUT/api/widgets/{id}/settings{ settingsVersion, values }; instance props still win
POST/api/widgets/{id}/{version}/datahost proxy: { url } for modules or { vars } for declarative; declared origins only; JSON/text ≤256 KB
POST/api/widgets/{id}/{version}/frame-tokenshort-lived token for a module frame
GET/api/widgets/{id}/{version}/frame?t=the sandboxed module document with its own CSP

Studio

MethodPathNotes
GET/api/studio/publisherthe signed-in publisher profile
PUT/api/studio/publishercreate or update { handle, displayName, bio, website }; handle is permanent
POST/api/studio/verification{ note, evidence }; up to 3 http(s) links, requests operator verification
GET/api/notificationsthe signed-in user's event feed, unread count and settings.muted groups
PUT/api/notifications/settings{ muted: [groups] }; groups are feedback, publisher, marketplace or automation
POST/api/notifications/{id}/readmark one notification read
POST/api/notifications/read-allmark the feed read
GET/api/push/key{ publicKey, transport }; the VAPID application server key
GET/api/push/subscriptionsthis account's browser endpoints and devices
POST/api/push/subscribe{ endpoint, keys: { p256dh, auth }, device }; https endpoint only
DELETE/api/push/subscribe{ endpoint }; forget one browser
POST/api/push/testsend one test notification to this account's browsers
GET/api/push/outboxfake transport only (disposable storage): recorded encrypted bodies
GET/api/studio/widgetspublisher + drafts and release summaries
GET/api/studio/analyticsPublisher plan; aggregate installs and version spread for the publisher's widgets
GET/api/studio/widgets/{handle}/draftthe saved draft
PUT/api/studio/widgets/{handle}/draft{ manifest }; mutable, not yet a release
POST/api/studio/widgets/{handle}/iconmultipart file; PNG/JPEG/WebP under 128 KB
POST/api/studio/widgets/{handle}/releases{ version, notes }; validates, namespaces, hashes, auto-lists
PATCH/api/studio/widgets/{handle}/releases/{version}{ market, paused }; unlist from WidgetMarket or pause everywhere
POST/api/studio/widgets/{handle}/releases/{version}/test-installcopies that release into the developer's own library
GET/api/publishers/{handle}public profile; tier is the public badge, so it reads unverified unless the Publisher plan is active
POST/api/publishers/{handle}/feedbacksigned-in user sends { widgetId, message } to the publisher
GET/api/publishers/{handle}/feedbackthe signed-in user's own threads with that publisher, including replies
GET/api/studio/feedbackthe publisher's feedback threads
POST/api/studio/feedback/{id}/replydeveloper reply
PATCH/api/studio/feedback/{id}{ status: "open" \| "closed" }
GET/api/publishers/{handle}/registry.jsonthe personal developer registry
GET/api/publishers/{handle}/widgets/{id}/{version}/manifest.jsonimmutable release bytes
GET/api/publishers/{handle}/widgets/{id}/iconthe widget icon

A module manifest may also carry module.assets: up to five { name, text } files (1–32 KB each, 96 KB total) stored inside the immutable release. They are injected into the sandboxed frame and exposed to the module as ctx.asset(name); nothing is fetched at runtime. | GET | /api/market/icons/{id} | the WidgetMarket icon | | GET | /api/market/registry.json | all auto-published releases + suggested built-ins | | GET | /api/market/releases/{handle}/{id}/{version}/manifest.json | WidgetMarket release bytes | | POST | /api/market/reports | signed-in reader reports { widgetId, version, reason, message? }; reason is broken, misleading, unsafe, spam or other | | GET | /marketplace/registry.json | market index at its static path (the API mirrors it in single-host) | | GET | /marketplace/icons/{id} | market icon at its static path | | GET | /marketplace/releases/{handle}/{id}/{version}/manifest.json | market release at its static path |

Studio routes need the normal user session. Public registry and manifest routes are fetched server-side by Bento Spaces and carry no user credentials.

Manage

Operator endpoints for the manage console have two auth paths:

With neither configured the endpoints are 404; a wrong machine token is 401; a signed-in non-operator is 403.

MethodPathNotes
GET/api/manage/session{ isOperator, username, machine } for the current operator session
GET/api/manage/defaults{ widgets, builtins }; the default set for new accounts
PUT/api/manage/defaults{ widgets: [ids] }; unknown ids are 422; existing accounts keep their library
PUT/api/manage/accounts/{username}/plan{ plan, status?, renewsAt?, note? }; changes entitlements immediately
GET/api/manage/publisherspublisher profiles with widget counts, verification evidence/history and available tiers
PUT/api/manage/publishers/{handle}{ tier, note? }: unverified, verified, trusted or official; records the decision
POST/api/manage/publishers/{handle}/verification{ action: "reject", note? }; rejects the pending request
POST/api/manage/publishers/{handle}/status{ status }: active, suspended or banned
GET/api/manage/suggestedcurrent curated WidgetMarket Suggested ids + the available catalog
PUT/api/manage/suggested{ widgets: [ids] }; built-ins or published release ids
GET/api/manage/reportsthe operator report queue, open first
PATCH/api/manage/reports/{id}{ status: "resolved" \| "dismissed" }; notifies the reporter
GET/api/manage/marketevery publisher release with its market/paused state
PATCH/api/manage/market/{handle}/{widgetId}/{version}{ market, paused }; operator delist/pause without rewriting
GET/api/manage/billingprovider, sandbox/live, key and webhook booleans, price ids, subscription and event counts; no secret
POST/api/manage/billing/verifyasks Paddle whether each configured price exists; 501 unless Paddle is the provider
GET/api/connectorsaccount connectors with hasToken and cached health; tokens never returned
POST/api/connectorsadd { name, url, kind?, auth?, authName?, username?, token? }; auth is bearer (default), header, basic, query or none; the credential is encrypted
DELETE/api/connectors/{id}remove a connector, its token and its cached health
GET/api/connectors/healthcached { health, ttlSeconds }; never calls upstream
POST/api/connectors/healthcheck every connector now and return fresh rows
POST/api/connectors/{id}/testcall the bridge health path (/api/ for Home Assistant); a success updates the cache
POST/api/connectors/{id}/request{ method, path, body? } through the proxy
POST/api/connectors/pairingsession; { code, expiresAt }, one-time, ten minutes
POST/api/connectors/pairanonymous bridge self-registration { code, url, name?, token?, kind? }
POST/api/connectors/bridge-config{ devices?, tunnel?, code?, bentoUrl? } → compose, devices, env, steps
GET/api/connectors/oauth/providersconfigured OAuth providers { id, scopes, baseUrl }
POST/api/connectors/oauth/start{ provider } → { url }; the browser leaves for the provider
GET/api/connectors/oauth/callbackthe provider's redirect; creates the connector and returns to /?oauth=connected
GET/api/registriesconfigured sources
POST/api/registriesadd { url, name, kind }; kind is marketplace (default) or developer
DELETE/api/registries/{id}remove a source
GET/api/registries/{id}/indexserver-side fetch + 60 s cache (no CORS)
GET/api/live/feed?url=RSS/Atom for built-in widgets; account-only, public hosts only, ≤3 re-checked redirects, ≤512 KB
GET/api/automationsprofiles, rules and per-rule state; account only
PUT/api/automationsreplace profiles/rules; 422 with errors[]
POST/api/automations/previewdeterministic decision for a supplied reading and clock
POST/api/automations/{ruleId}/runrun one rule now against its connector

A lapsed paid plan reports readOnly: true; content writes return 403 subscription_read_only until it is renewed. Authentication, tokens, notification read state, billing and operator routes stay available, and existing data is never deleted.

Billing

MethodPathNotes
GET/api/billing/plans{ provider, checkout, plans }; entitlements per plan
POST/api/billing/checkout{ plan: "plus" \| "publisher" } → { url }; a hosted checkout when Paddle is configured, a local page for the fake
GET/api/billing/fake/checkout/{token}fake only; consumes a 30-minute token and activates the plan
GET/api/billing/portal{ url, cancelUrl }: a short-lived Paddle customer-portal link for invoices, payment details and cancellation; 501 without Paddle, 404 no_subscription before a first purchase
POST/api/billing/webhookthe provider's own body; Paddle signs it with Paddle-Signature, the fake uses X-Billing-Secret

/api/billing/checkout is 501 billing_not_configured when no merchant of record is configured. A configured provider returns an absolute https:// URL and the client navigates to it; a fake checkout returns a same-origin path the client fetches.

The webhook is the only route that changes a plan without an operator. It is unauthenticated but authenticated by signature, and the normalized event is idempotent by eventId. POST /api/billing/webhook answers 404 when no provider is usable — the fake is deliberately hidden on non-disposable storage — and 503 billing_webhook_not_configured when Paddle is selected but its webhook secret is missing, so the provider records a real failed delivery.

Sharing

MethodPathNotes
GET/api/views?spaceId=links for a space (no tokens in clear)
POST/api/views{ spaceId, idle, wake, actions, pin?, display? } → { view, url }; the owner sets the PIN. display: true creates a read-only pairing (actions forced false, no PIN, never idle-locks, 30-day session)
DELETE/api/views/{id}revoke
POST/api/view/unlock{ pin } for the active view session; throttled
POST/api/view/exitleave the view/display session and return to the normal account

Public (no account)

MethodPathNotes
GET/v/{token}exchanges a share link for a read-only, 12 h session cookie (30 days for a display), then serves the shell
GET/display/{token}the same exchange for a paired display; serves the shell with kiosk chrome
GET/api/mereturns { kind: "view", spaceId, idle, wake, actions, display } for that session
GET/api/spaces/{id}allowed only for the space the view belongs to

Errors

{ "errors": [ { "path": "layout.containers[3].w", "message": "must be >= 1" } ] }

Rules

  1. The client never sends a profile id; the session determines it.
  2. The client never sends an entitlement; the server decides and echoes it.
  3. Layout writes are validated against the invariants in Storage
  4. before touching disk.
  5. Proxy calls are allowlisted by the widget manifest, capped at 5 s / 1 MB, no redirects to
  6. other schemes.
  7. Every /api response is Cache-Control: no-store. Widget assets are the opposite:
  8. immutable, one year.