---
title: Hierarchy and Namespaces
description: >-
  Which parts of the organization, workspace and group hierarchy are fixed, how
  to model your own resource structure inside it, and which product, service and
  resource names are reserved.
canonical_url: 'https://saaslayer.com/docs/permissions/hierarchy-and-namespaces/'
last_updated: '2026-11-15T00:13:40-08:00'
---
# Hierarchy and Namespaces

SaaSLayer Permissions has a small, fixed platform hierarchy: organizations, workspaces and groups. Your app's own
structure, such as projects, folders and documents, is modeled with scopes and resource names that you choose. This page
explains the supported hierarchy, how to model your app within it, and the current limits.

## The fixed platform hierarchy

| Container | Public API | Allowed parent | Notes |
|---|---|---|---|
| Organization | `/orgs` | none | Organizations never nest. |
| Workspace | `/workspaces` (ids `tnt_…`) | an organization (`orgId` is required) | Workspaces never nest. |
| Group | `/groups` | a workspace, an organization, another group, or none (a root group) | Groups nest, with a depth limit. |

These three container types are the whole platform hierarchy. You cannot add a fourth container type, put an
organization inside another organization, or put a workspace inside a workspace; the service refuses those edges.
Container types in the public API are `ORG`, `WORKSPACE` and `GROUP`.

### Group nesting depth

A group can sit at most four levels below the top of its chain:

| Chain starts at | Group levels allowed | Example |
|---|---|---|
| Workspace | 3 | org → workspace → group → group → group |
| Organization | 4 | org → group → group → group → group |
| Root group | 5 (the root plus 4) | group → group → group → group → group |

A deeper group is refused with `resulting depth 5 exceeds max depth 4 for GROUP`. Cycles are also refused.

### Moving things

* A group can move to a new parent with `PUT /groups/{id}/parent`, inside the same organization. Moves across
  organizations are refused.
* Workspaces and organizations cannot be moved. Not supported today.

## Principals and membership

The principals that hold permissions are `USER`, `AGENT` and `SERVICE_ACCOUNT`. Organizations, workspaces, groups and
roles are containers or policy attachment points, never acting principals. A group cannot be a member of another
group; group nesting is structural only.

Membership follows the hierarchy:

* Joining a workspace requires membership in its organization.
* Joining a group requires membership in the nearest workspace above it, or its organization when there is no
  workspace. Joining a group does not make you a direct member of its parent groups.

Without that parent membership the request fails with `PARENT_MEMBERSHIP_REQUIRED`, unless the caller asks for the
parent membership to be created as well.

Membership alone grants nothing. Access comes from roles and policies (see [Core Concepts](https://saaslayer.com/docs/permissions/core-concepts)).

All principal types share one permission domain: `identity:principal` (`create`, `read`, `update`, `delete`,
`import`) covers users, agents and service accounts alike. There is no per-type variant.

## Where permissions apply

A role assignment carries one scope string, and a check is made at one scope. A check sees:

1. global permissions, which aren't restricted to one scope,
2. when the scope is a typed scope `<kind>:<orgId>:<id>`, the entries of the organization `<orgId>`,
3. the entries assigned at exactly that scope.

A deny from any of them wins.

| Assigned at | Applies to a check at |
|---|---|
| **Global** (no scope restriction) | every scope in the deployment |
| `org_acme` | `org_acme`, and every typed scope `<kind>:org_acme:<id>` |
| `project:org_acme:proj_1` | `project:org_acme:proj_1` only |
| a workspace id, e.g. `tnt_123` | `tnt_123` only |

A global assignment still grants only the actions and resources allowed by its
role. Global describes where those rules apply, not permission to do everything.

A workspace id is not a typed scope, so organization-wide assignments do not flow into a check made at a workspace
scope. Check at the organization scope too when a workspace resource should honor organization-wide roles.

### How the API represents Global

To assign a role globally, omit `scope` from the assignment request:

```json
{ "roleId": "role-viewer" }
```

To restrict the assignment to one workspace, include its ID:

```json
{ "roleId": "role-viewer", "scope": "ws-acme-prod" }
```

The API returns a global assignment with `"scope": null`. Here, `null` means
there is no scope value restricting the assignment; it isn't a scope named
“null.” **Global** is the concept, and `null` is its current JSON representation.

Don't substitute `"scope": "*"` for this API convention. Wildcards have separate
meanings in resource patterns and legacy formats; they aren't a consistent
replacement for an omitted assignment scope.

An assignment and a check are different: a global assignment can contribute to
checks at any scope, but a **check without a scope uses global permissions only**.
It doesn't combine the separate permissions from every workspace.

### Policies attached to containers

| Policy attached to | Applies at |
|---|---|
| A workspace | that workspace's scope |
| A group in a workspace, directly or nested under other groups there | that workspace's scope |
| An organization | the organization scope and its typed scopes |
| A group under an organization with no workspace above it, directly or nested under other groups | the organization scope and its typed scopes |
| A group with no parent | every scope |

A member of several organizations gets an organization's policies only when acting in that organization; a check
without a scope never gets them. Attach a policy to a group with no parent only when it should apply at every scope.

## Modeling your own hierarchy

Your product's structure belongs in scopes and resources, not in new platform containers.

### Typed scopes for areas inside an organization

Use a typed scope `<kind>:<orgId>:<id>` for an app-defined area inside one organization, such as `project:org_acme:proj_1`
or `folder:org_acme:folder_9`. You choose `kind`. The second segment is always the owning organization, which is how
the service identifies that organization without needing to understand your app's projects or folders. Segments are non-empty
and contain no `:`, `#` or control characters. The SDK helpers are `typedScope(kind, orgId, id)`
and `parseTypedScope(scope)`.

Your backend is responsible for proving that `<id>` exists inside that organization before granting at it.

Typed scopes are one level deep. `folder:org_acme:folder_9` does not inherit grants from `project:org_acme:proj_1`,
even if your app stores that folder inside that project. If you need that, check each level your product cares about,
or assign at the organization.

### Resource names

A resource is a type plus an optional id, for example `document` or `document/doc-123`. The full form is an XRN:

```text
xrn:<product>:<service>:<region>:<scope>:<resourceType>/<resourceId>
xrn:acme:core:us-west-1:org_acme:document/proj-1%2Fdoc-9
```

The id is opaque to the service. Matching supports `*` and a trailing prefix wildcard per segment, so the pattern
`xrn:acme:core:*:org_acme:document/proj-1%2F*` matches documents in that organization whose decoded id starts with `proj-1/`. Prefix matching is string
matching, not a parent/child relationship.

## Product, service and action names

Permissions are named `<service>:<resource>:<action>` for SaaSLayer's own services (for example
`orgs:workspace:create`) and `<product>:<service>:<resource>:<action>` for your product (for example
`acme:core:document:read`).

Reserved names:

| Name | Reserved as |
|---|---|
| `saaslayer` | product |
| `scopes`, `register`, `registry` | product names in catalog routes |
| `orgs`, `roles`, `policies`, `identity`, `keys`, `onboarding`, `permissions`, `audit`, `catalog`, `ops`, `users`, `deployer` | service names, under any product |

Other rules:

* A service belongs to exactly one product. Registering a service another product owns is refused with
  `ServiceOwnedByOtherProduct`.
* A catalog manifest's service name matches `^[a-z0-9][a-z0-9-]{0,63}$`, and its role ids are `<product>:<name>`.
* Catalog `grantableScopes` currently accepts the exact values `account` (organization) and `site` (a built-in
  typed-scope label). Here, `site` is an API value; your app doesn't need to model websites or physical locations.
  Custom kinds such as `project` work for directly assigned roles, but not as catalog `grantableScopes`.

## Not supported today

| Request | Status |
|---|---|
| Extra platform levels (nested organizations or workspaces, a new container type) | Not supported. Model the level as a typed scope or a group. |
| Groups deeper than the limits above | Not supported. |
| Moving a workspace or an organization | Not supported. |
| Groups as members of other groups | Not supported. Nest groups structurally instead. |
| Inheritance between typed scopes (project → folder) | Not supported. Check each level. |
| Bring-your-own hierarchy (customer-defined container types and parent rules) | Not supported. It would be built only against a concrete customer requirement. |
| Cedar `principal is User in Group::"admins"` (typed hierarchy scopes) | Future work. The Cedar compiler parses it, but permission rebuilds do not apply the principal-type filter. |
| Catalog `grantableScopes` beyond `account` and `site` | Not supported. |
