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
| Method | Path | Notes |
|---|---|---|
POST | /api/auth/register | { username, password }; 404 while Accounts:Open is false; seeds the account's default widget library |
POST | /api/auth/login | PBKDF2 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/logout | revokes the session |
GET | /api/me | { kind, userId, username, plan, planStatus, readOnly, limits, entitlements, billing }; kind: "view" for a share session |
GET | /api/billing/plans | public plan catalogue, entitlements, provider and checkout availability |
POST | /api/billing/checkout | session; { 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/webhook | X-Billing-Secret; normalized provider event, idempotent by eventId |
GET | /api/tokens | session only; token metadata, never the secret |
POST | /api/tokens | session 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
| Method | Path | Notes |
|---|---|---|
GET | /api/spaces | dock 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}/duplicate | copies layout, widgets and wallpaper; counts against the plan |
GET | /api/spaces/{id} | joined document: layout + widget instances + missing flags + revs |
PUT | /api/spaces/{id}/layout | If-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}/copy | same 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}/wallpaper | multipart file, 2 MB, jpg/png/webp, Plus only |
GET | /api/spaces/{id}/wallpaper | streams the image, private, max-age=86400 |
GET | /api/spaces/{id}/export | planned, 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
| Method | Path | Notes |
|---|---|---|
GET | /api/widgets/installed | the 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}/settings | account-wide defaults for that type |
PUT | /api/widgets/{id}/settings | { settingsVersion, values }; instance props still win |
POST | /api/widgets/{id}/{version}/data | host proxy: { url } for modules or { vars } for declarative; declared origins only; JSON/text ≤256 KB |
POST | /api/widgets/{id}/{version}/frame-token | short-lived token for a module frame |
GET | /api/widgets/{id}/{version}/frame?t= | the sandboxed module document with its own CSP |
Studio
| Method | Path | Notes |
|---|---|---|
GET | /api/studio/publisher | the signed-in publisher profile |
PUT | /api/studio/publisher | create 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/notifications | the 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}/read | mark one notification read |
POST | /api/notifications/read-all | mark the feed read |
GET | /api/push/key | { publicKey, transport }; the VAPID application server key |
GET | /api/push/subscriptions | this 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/test | send one test notification to this account's browsers |
GET | /api/push/outbox | fake transport only (disposable storage): recorded encrypted bodies |
GET | /api/studio/widgets | publisher + drafts and release summaries |
GET | /api/studio/analytics | Publisher plan; aggregate installs and version spread for the publisher's widgets |
GET | /api/studio/widgets/{handle}/draft | the saved draft |
PUT | /api/studio/widgets/{handle}/draft | { manifest }; mutable, not yet a release |
POST | /api/studio/widgets/{handle}/icon | multipart 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-install | copies 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}/feedback | signed-in user sends { widgetId, message } to the publisher |
GET | /api/publishers/{handle}/feedback | the signed-in user's own threads with that publisher, including replies |
GET | /api/studio/feedback | the publisher's feedback threads |
POST | /api/studio/feedback/{id}/reply | developer reply |
PATCH | /api/studio/feedback/{id} | { status: "open" \| "closed" } |
GET | /api/publishers/{handle}/registry.json | the personal developer registry |
GET | /api/publishers/{handle}/widgets/{id}/{version}/manifest.json | immutable release bytes |
GET | /api/publishers/{handle}/widgets/{id}/icon | the 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:
- Browser session: a signed-in account listed in
Manage:Operators(or*in local - development) may call them. Writes also send
X-Manage-Session: 1as a CSRF guard. - Machine token: automation sends
X-Manage-TokenmatchingManage:Token.
With neither configured the endpoints are 404; a wrong machine token is 401; a signed-in non-operator is 403.
| Method | Path | Notes |
|---|---|---|
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/publishers | publisher 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/suggested | current curated WidgetMarket Suggested ids + the available catalog |
PUT | /api/manage/suggested | { widgets: [ids] }; built-ins or published release ids |
GET | /api/manage/reports | the operator report queue, open first |
PATCH | /api/manage/reports/{id} | { status: "resolved" \| "dismissed" }; notifies the reporter |
GET | /api/manage/market | every publisher release with its market/paused state |
PATCH | /api/manage/market/{handle}/{widgetId}/{version} | { market, paused }; operator delist/pause without rewriting |
GET | /api/manage/billing | provider, sandbox/live, key and webhook booleans, price ids, subscription and event counts; no secret |
POST | /api/manage/billing/verify | asks Paddle whether each configured price exists; 501 unless Paddle is the provider |
GET | /api/connectors | account connectors with hasToken and cached health; tokens never returned |
POST | /api/connectors | add { 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/health | cached { health, ttlSeconds }; never calls upstream |
POST | /api/connectors/health | check every connector now and return fresh rows |
POST | /api/connectors/{id}/test | call 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/pairing | session; { code, expiresAt }, one-time, ten minutes |
POST | /api/connectors/pair | anonymous 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/providers | configured OAuth providers { id, scopes, baseUrl } |
POST | /api/connectors/oauth/start | { provider } → { url }; the browser leaves for the provider |
GET | /api/connectors/oauth/callback | the provider's redirect; creates the connector and returns to /?oauth=connected |
GET | /api/registries | configured sources |
POST | /api/registries | add { url, name, kind }; kind is marketplace (default) or developer |
DELETE | /api/registries/{id} | remove a source |
GET | /api/registries/{id}/index | server-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/automations | profiles, rules and per-rule state; account only |
PUT | /api/automations | replace profiles/rules; 422 with errors[] |
POST | /api/automations/preview | deterministic decision for a supplied reading and clock |
POST | /api/automations/{ruleId}/run | run 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
| Method | Path | Notes |
|---|---|---|
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/webhook | the 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
| Method | Path | Notes |
|---|---|---|
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/exit | leave the view/display session and return to the normal account |
Public (no account)
| Method | Path | Notes |
|---|---|---|
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/me | returns { 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" } ] }
400malformed body ·401no session ·403plan limit ·404unknown409stalerev(body includes the current document) ·422invariant violation429rate limited (login, connect, proxy) withRetry-After
Rules
- The client never sends a profile id; the session determines it.
- The client never sends an entitlement; the server decides and echoes it.
- Layout writes are validated against the invariants in Storage
- before touching disk.
- Proxy calls are allowlisted by the widget manifest, capped at 5 s / 1 MB, no redirects to
- other schemes.
- Every
/apiresponse isCache-Control: no-store. Widget assets are the opposite: - immutable, one year.