Skip to Content

Scopes

Scopes provide multi-tenant data isolation. You model your organization as a hierarchy — for example Tenant → Department → Team — and every request runs in the context of a scope. Records in scope-enabled collections are then automatically filtered so each user only sees the data belonging to the scope(s) they are authorized for.

Scopes work alongside Roles & Policies (a role can be assigned at a specific scope) and Users (a user is granted access to one or more scopes). Navigate to /scopes in the DaaS Studio to manage them.

On the Buildpad Engine backend, a first-level scope item is a tenant. Each tenant has its own data model, users, roles, files and settings, in its own PostgreSQL schema. Items below the first level are filters inside their tenant, as on the Supabase backend. Each session belongs to one tenant. In the Studio, the Switch Scope dialog lists your tenants: choose an item in the current tenant to filter, or choose another tenant to switch the session to it. See Tenants and sub-scopes, and Host and Tenants for what a host administrator can do.

On the Supabase backend, every scope item, first level included, is a row filter in one set of tables.

How scopes work

Scopes are built from three pieces, configured in the three tabs of the Scopes page:

  1. Scope Types — the levels of your hierarchy (e.g. Tenant, Department, Team).
  2. Scope Items — the concrete instances of those levels (e.g. Acme Corp, Sales). Each item gets a canonical URI path built from UUIDs, one typeId:itemId segment per level — e.g. /1a2b…:9f8e…/3c4d…:7a6b…. Names are display-only; renaming an item never changes its URI path.
  3. Collection Config — declares which collections enforce scope filtering and how.

When a request comes in, the active scope is identified by its URI path. The server validates that the URI exists and that the user is authorized for it, then filters every scope-enabled collection according to that collection’s configuration.

The active scope is passed on each request via the X-Resource-Uri header (or the daas_resource_uri cookie). A request with no scope is treated as the root scope — see the missing_uri_mode option under Collection Config for how that is handled.

Scope Types

A scope type is one level of the hierarchy. Define types first — scope items reference them.

Scopes page, Scope Types tab with Organization and Department

FieldDescription
NameDisplay name of the level (e.g. Tenant).
Parent TypeThe level above this one. Leave empty to create a top-level (root) type.
NoteOptional description.
  • Create: click Add Type, enter a name, and optionally pick a parent type.
  • Edit: only the name and note can be changed.
  • Delete: fails if any scope items still exist under the type.

The parent type cannot be changed after creation — doing so would invalidate the URI paths of every scope item built from it. Plan your hierarchy before creating items.

Scope Items

A scope item is a concrete instance of a scope type — the actual tenant, department, or team. Items form the same tree as their types.

Scopes page, Scope Items tab with organizations and their departments

FieldDescription
NameDisplay name of the instance (e.g. Acme Corp).
Scope TypeWhich type this item belongs to.
Parent ItemRequired when the chosen type has a parent type. The selectable parents are limited to items of the parent type.
URI PathAuto-computed, immutable canonical path — one typeId:itemId UUID segment per level (e.g. /<tenantTypeId>:<acmeId>/<deptTypeId>:<salesId>). Not editable.

Worked example. With types Tenant → Department, create the item Acme Corp under Tenant, then create Sales under Department with Acme Corp as its parent item. The Sales item receives a URI path of the form /<tenantTypeId>:<acmeId>/<deptTypeId>:<salesId>.

  • Create: click Add Item, pick the scope type, and (when required) the parent item. The URI path is generated automatically. You must create at least one scope type first.
  • Edit: only the display name can be renamed — the URI path is immutable.
  • Delete: fails if the item has child items. Deleting the item that is your active scope is allowed: the header scope switcher then finds the scope gone, drops it and reloads the Studio at the root scope (another session that had it active does the same on its next page load). On the Buildpad Engine backend, a tenant’s first-level item is not deleted this way: its Delete is the tenant’s own flow, below.
  • The list supports search and is paginated (25 items per page).

Suspend, resume and delete a tenant

On the Supabase backend, a first-level scope item is a row filter like any other, and you delete it as above. There is no tenant to suspend.

On the Buildpad Engine backend, a host administrator manages a tenant from its first-level row on the Scope Items tab. The row shows a badge for every state but ready. For a suspended tenant, the badge shows when it was suspended, why, and from when it can be deleted. The row’s menu offers only what the Engine accepts in that state. This needs Buildpad Engine 0.1.0-dev.14 or later; on Buildpad Cloud, data service version 2026.11.04 or later.

Tenant stateThe row’s menu offers
Ready or failedSuspend tenant…. Delete tenant… is disabled: a tenant is suspended before it is deleted.
SuspendedResume tenant and Delete tenant…
DeletingDeletion progress
Provisioning or migratingDelete tenant… is disabled, with the reason.
  • Suspend tenant… ends every session in the tenant at once. Its people cannot sign in to it or switch to it, and its cron jobs, hooks, services and streams stop. Nothing is deleted: every record, file, role and setting is kept. You can give a reason of at most 500 characters. Host administrators see it on the row.
  • Resume tenant makes the tenant serve again, with everything it held when it was suspended. Sessions that the suspension ended stay ended: each person signs in again.
  • Delete tenant… removes the tenant’s data, files, roles and sessions. People who belong to no other tenant are forgotten. The tenant’s ID is never used again. You cannot undo a deletion.
    1. Suspend the tenant, then wait for the Engine’s grace period (TENANT_DELETE_GRACE, 30 days by default). Until it has passed, the dialog shows how long remains, and Delete tenant is disabled.
    2. Take a backup. The Engine makes none. You can record where the backup is in Backup reference.
    3. Paste the tenant’s URI path to confirm.
    4. If the tenant is a template, tick Also remove the template mark. Tenants created from the template are not affected.
    5. Click Delete tenant. The dialog shows the step the deletion is on, for example “Step 3 of 7”, and the counts when it is done. You can close the dialog: the deletion continues. While a tenant is deleting, the tab lists it above the table with Deletion progress.
  • If you hold a verified second factor, each of these asks for your code in the dialog, and then sends the request again. See MFA.

People in a suspended tenant are told why their session ended on the sign-in page. The Switch Scope dialog lists a suspended tenant apart, disabled. A suspended tenant that a person was added to and never entered can still be declined.

Collection Config

Collection configs declare which collections participate in scope filtering and how that filtering behaves. Adding a config wires the collection’s URI field to the scope hierarchy so reads and writes are scoped automatically.

Scopes page, Collection Config tab with the built-in system configs

FieldDescription
CollectionThe collection (table) to scope. Immutable after creation.
Field NameThe column on that collection holding the scope URI. Defaults to resource_uri.
Missing URI ModeWhat to do when a request has no X-Resource-Uri header: strict allows null (treats it as the root scope) — reject blocks the request.
Inheritance ModeHow reads are filtered: exact returns only records at exactly the active scope — down returns records at the active scope and all descendant scopes.
  • Create: click Add Config, enter the collection and field name, then choose the missing-URI and inheritance modes.
  • Edit: the field name and both modes can be changed; the collection name cannot.
  • Delete: only available for non-system collections.

The system collections daas_user_roles and daas_access come with built-in scope configs (marked system) and cannot be deleted.

Scope-aware access

Scopes integrate with access control. A role can be assigned to a user at a specific scope, and a user inherits the role assignments of their scope’s ancestors — so a role granted at a tenant’s scope also applies within that tenant’s departments. The data a user can see in a scope-enabled collection is the intersection of their permissions and the scope(s) they are authorized for.

Effective permissions are scope-aware too: GET /api/permissions/me resolves the caller’s permissions (and module access) at the active scope — taken from the X-Resource-Uri header or the daas_resource_uri cookie — and echoes the resolved scope back as meta.resource_uri. An invalid URI returns 400; a request with no scope at all keeps the flat, scope-unaware permission set for backward compatibility (data requests differ: omitting the scope there resolves at root scope — see Items API).

API endpoints

Scopes are fully manageable over the REST API:

GET /api/scope/available — scopes the current user can access GET /api/scope/types — list scope types POST /api/scope/types — create scope type (admin) GET /api/scope/items — list scope items (paginated, searchable) POST /api/scope/items — create scope item (admin) GET /api/scope/collection-config — list collection configs POST /api/scope/collection-config — enable scope filtering on a collection (admin)

Each resource also exposes /:id variants for fetching (GET), updating (PATCH), and deleting (DELETE) a single record. See the API Reference for full endpoint documentation.