Organization Units
Organization units (OUs) let you organize users and groups to match your organization's structure. You can use OUs to model departments, teams, regions, or even separate tenants.
Root organization units are the top-level nodes that represent major segments of your organization. Child organization units are nested under root OUs. Together they form a tree-like structure that reflects your organizational hierarchy.
OUs can be nested to any depth. Common patterns include:
- By Department
- By Region
engineering/
frontend/
backend/
platform/
sales/
hr/
americas/
us/
latam/
emea/
apac/
Organization Units and User Types
All users belong to an OU and each user also has a user type. A user type defines:
-
the attributes in the user's profile.
-
validation rules for those attributes.
-
whether users can self-register.
ThunderID ships with two default organization units, each with a predefined user type.
| Organization Unit | Default User Type | Purpose |
|---|---|---|
| Default | Person | Administrator-managed users |
| Customers | Customer | Self-registering end users |
Each user type belongs to a single OU and inherited by its child OUs. This means, a user of a certain type can only exist in that OU or its descendants. For example, the default Customers OU has a Customer user type. A user of Customer type can only exist in the Customers OU or its descendants.
Organization Handles
Every OU has a handle, a short, URL-safe identifier used to reference the OU in the hierarchy. Handles must be unique within the same parent.
ThunderID's two default OUs have fixed handles:
| Organization Unit | Handle |
|---|---|
| Default | default |
| Customers | customers |
Handles compose into hierarchical paths by joining each OU's handle with a forward slash /. For example:
| Path | Description |
|---|---|
engineering | The root OU with handle engineering |
engineering/frontend | The frontend OU nested under engineering |
engineering/frontend/ui | The ui OU nested under engineering/frontend |
Hierarchical paths let you navigate directly to any OU in the tree without knowing its UUID, which is useful in API calls and CLI operations.
Handles must be unique within the same parent. Two sibling OUs cannot share the same handle. Handles at different levels of the hierarchy can be the same, only siblings conflict.
Create an Organization Unit
- Navigate to Organization units in the ThunderID Console. On the control plane, open the project the OU belongs to and select Organization units under Identities.
- To create a root OU, click Add root organization unit.
- To create a child OU, expand the parent OU and click Add child organization unit.
- Enter a Name - the human-readable display name for the OU.
- Enter a Handle - a short, URL-safe identifier. Use lowercase letters, numbers, and hyphens (for example,
engineeringorfrontend-team). - Optionally enter a Description.
- The Parent organization unit field shows where the OU will be created. For root OUs this displays Root organization unit; for child OUs it shows the selected parent.
- Click Create.
When creating an OU through the API on the control plane, set projectId to the project the OU belongs to. See Organization Units in Projects.
When creating an OU through the API, you can also provide the following optional branding and policy fields:
| Field | Description |
|---|---|
themeId | Identifier of the theme to apply to the OU. |
layoutId | Identifier of the layout to apply to the OU. |
logoUrl | URL of the logo to display for the OU. |
tosUri | URL of the Terms of Service page. |
policyUri | URL of the Privacy Policy page. |
cookiePolicyUri | URL of the Cookie Policy page. |
Example: create an OU with branding:
curl -kL -X POST "https://localhost:8090/organization-units" \
-H 'Authorization: Bearer <access-token>' \
-H 'Content-Type: application/json' \
-d '{
"name": "Engineering",
"handle": "engineering",
"parent": null,
"projectId": "<project-id>",
"logoUrl": "https://example.com/logo.png",
"tosUri": "https://example.com/tos"
}'
View an Organization Unit
Navigate to Organization units in the ThunderID Console to see all OUs. On the control plane, open the project first and select Organization units under Identities. Click the three-dot menu on any OU and select Edit to view its details:
- Details - name, handle, description, and parent OU.
- Child organization units - nested OUs directly under this OU.
- Users - all users belonging to this OU.
- Groups - all groups belonging to this OU.
When using the Organization Unit APIs, each OU response also includes system metadata:
- isReadOnly - indicates whether the OU is immutable (for example, because it is defined declaratively and cannot be modified at runtime).
- createdAt - UTC timestamp when the OU was created.
- updatedAt - UTC timestamp when the OU was last updated.
To retrieve an OU by its ID:
curl -kL "https://localhost:8090/organization-units/{id}" \
-H 'Authorization: Bearer <access-token>'
To retrieve an OU by its hierarchical handle path:
curl -kL "https://localhost:8090/organization-units/tree/{path}" \
-H 'Authorization: Bearer <access-token>'
Update an Organization Unit
- Navigate to Organization units in the ThunderID Console. On the control plane, open the OU's project first and select Organization units under Identities.
- Click the three-dot menu on the OU you want to update and select Edit.
- Update the Name, Handle, or Description as needed.
- Click Save.
To update an OU using the API by its ID:
curl -kL -X PUT "https://localhost:8090/organization-units/{id}" \
-H 'Authorization: Bearer <access-token>' \
-H 'Content-Type: application/json' \
-d '{"name": "Engineering Team", "handle": "engineering", "parent": null}'
To update by hierarchical path:
curl -kL -X PUT "https://localhost:8090/organization-units/tree/{path}" \
-H 'Authorization: Bearer <access-token>' \
-H 'Content-Type: application/json' \
-d '{"name": "Engineering Team", "handle": "engineering", "parent": null}'
The request body accepts the same fields as the create request, including the optional branding and policy fields.
List and Filter Organization Units
The Organization Unit API returns paginated results on all list endpoints. Append a filter query parameter to narrow results.
Supported Endpoints
Filtering applies to the following list endpoints:
| Endpoint | Description |
|---|---|
GET /organization-units | List all root-level organization units |
GET /organization-units/{id}/ous | List child organization units by parent ID |
GET /organization-units/tree/{path}/ous | List child organization units by hierarchical path |
Filter Expression Syntax
A filter expression can contain one or more conditions joined by AND or OR:
attribute operator "value" [AND|OR attribute operator "value" ...]
- attribute: the OU field to filter on.
- operator: the comparison operator (
eq,gt, orlt). - value: the value to compare against. Enclose string values in double quotes.
- AND / OR: logical connectors between conditions.
ANDhas higher precedence thanOR, matching standard SQL behaviour.
Supported Operators
| Operator | Meaning |
|---|---|
eq | Equals (case-insensitive for text attributes) |
gt | Greater than |
lt | Less than |
Filterable Attributes
| Attribute | Type | Notes |
|---|---|---|
name | text | Case-insensitive equality |
handle | text | Case-insensitive equality |
description | text | Case-insensitive equality |
createdAt | timestamp | Compared lexicographically; use ISO 8601 format |
updatedAt | timestamp | Compared lexicographically; use ISO 8601 format |
Filter Examples
Filter by exact name:
curl -kL "https://localhost:8090/organization-units?filter=name%20eq%20%22Engineering%22" \
-H 'Authorization: Bearer <access-token>'
Filter with AND, both conditions must match:
curl -kL "https://localhost:8090/organization-units?filter=name%20eq%20%22Engineering%22%20AND%20handle%20eq%20%22engineering%22" \
-H 'Authorization: Bearer <access-token>'
Filter with OR, either condition may match:
curl -kL "https://localhost:8090/organization-units?filter=name%20eq%20%22Engineering%22%20OR%20name%20eq%20%22Sales%22" \
-H 'Authorization: Bearer <access-token>'
Filter children by timestamp range:
curl -kL "https://localhost:8090/organization-units/<parent-id>/ous?filter=createdAt%20gt%20%222024-01-01T00:00:00Z%22" \
-H 'Authorization: Bearer <access-token>'
Combine filter with pagination:
curl -kL "https://localhost:8090/organization-units?filter=name%20eq%20%22Engineering%22&limit=10&offset=0" \
-H 'Authorization: Bearer <access-token>'
Filter Error Responses
| Error Code | HTTP Status | Cause |
|---|---|---|
OU-1014 | 400 | The filter expression is malformed, uses an unsupported connector, or references an unsupported attribute |
OU-1013 | 400 | The result count exceeds the limit supported in the current store configuration |
OU-1028 | 400 | The request combines filter with placement=true, which can't be filtered |
List Users in an Organization Unit
Using Organization Unit ID
curl -kL "https://localhost:8090/organization-units/{id}/users" \
-H 'Authorization: Bearer <access-token>'
Using Hierarchical Path
curl -kL "https://localhost:8090/organization-units/tree/{path}/users" \
-H 'Authorization: Bearer <access-token>'
Append include=display to include a human-readable display name for each user:
curl -kL "https://localhost:8090/organization-units/{id}/users?include=display" \
-H 'Authorization: Bearer <access-token>'
The response includes pagination fields (totalResults, startIndex, count) and a users array. The array lists the users the OU owns first, followed by the users shared with it. Each user entry contains an id, a type, and an isOwnedByOU field that is true for a user the OU owns and false for a shared user. It also contains a display name when include=display is requested.
To get the same users as full user objects, filter the users API on the OU ID. If you can't list users in that OU, this request returns an empty list instead of an error:
curl -kL -G "https://localhost:8090/users" \
--data-urlencode 'filter=ouId eq "{id}"' \
-H 'Authorization: Bearer <access-token>'
To check one user, read the user with the OU ID. The request returns the user when the OU owns it or it is shared with the OU, under that OU's ID and with isOwnedByOU set. It returns 404 for a user the OU can't see, and 403 if you can't read users in that OU:
curl -kL "https://localhost:8090/users/{userId}?ouId={id}" \
-H 'Authorization: Bearer <access-token>'
List Groups in an Organization Unit
Using Organization Unit ID
curl -kL "https://localhost:8090/organization-units/{id}/groups" \
-H 'Authorization: Bearer <access-token>'
Using Hierarchical Path
curl -kL "https://localhost:8090/organization-units/tree/{path}/groups" \
-H 'Authorization: Bearer <access-token>'
The response includes pagination fields and a groups array. Each group entry contains an id and name.
To get the same groups as full group entries, filter the groups API on the OU ID:
curl -kL -G "https://localhost:8090/groups" \
--data-urlencode 'filter=ouId eq "{id}"' \
-H 'Authorization: Bearer <access-token>'
Delete an Organization Unit
- Open the OU from the Organization units list. On the control plane, open the OU's project first and select Organization units under Identities.
- Click Delete and confirm.
Deletion fails if the OU still contains users, groups, roles, applications, agents, resource servers, notification templates, credential configurations, presentation definitions, user types, agent types, connections, flows, or child OUs. Delete or reassign all contained resources before deleting the OU. An agent type can be deleted only when no agent is of that type and no application, agent, or flow lists it in its allowed agent types. See Agent Schema.
To delete an OU using the API by its ID:
curl -kL -X DELETE "https://localhost:8090/organization-units/{id}" \
-H 'Authorization: Bearer <access-token>'
To delete by hierarchical path:
curl -kL -X DELETE "https://localhost:8090/organization-units/tree/{path}" \
-H 'Authorization: Bearer <access-token>'
Manage the Organization Units Beneath Your Own
On a Data Plane, a token that holds org or org:ou, and not system, acts for the OU its ouId claim names. It manages the OUs directly beneath that OU, and nothing further:
| Request | Allowed for |
|---|---|
List the root OUs (GET /organization-units) | system only |
List child OUs (GET /organization-units/{id}/ous) | The token's own OU |
View an OU (GET /organization-units/{id}) | The token's own OU and its direct children |
Create an OU (POST /organization-units) | A direct child of the token's own OU |
| Update or delete an OU | The direct children of the token's own OU |
Every other OU is refused with 403 Forbidden, including the token's own OU for an update or delete, a grandchild, a sibling and the parent. An update that moves a child under another parent, or to the root, is refused too, because a move needs the permission to create an OU beneath the new parent. org:ou:view allows the views and child listing only.
A request by hierarchical path, such as /organization-units/tree/{path}, resolves to the last OU in the path and is allowed as the same request by ID is. For such a token, a path that names no OU is refused with 403 Forbidden too, so a path does not reveal which OUs exist outside its reach. A token that holds system gets 404 Not Found for it.
A token that holds system manages every OU in the deployment. A control plane bounds no permission to an OU.
Organization Units in Projects
On the control plane, every OU except the system OU belongs to a project. The system OU, with the handle default, is shared by every project and belongs to none.
- Create: set
projectIdin the request body ofPOST /organization-units. A request withoutprojectIdfails withOU-1023, and a project that does not exist fails withOU-1022. - Parent: an OU in a project is a root OU, a child of the system OU, or a child of another OU in the same project. A parent in another project fails with
OU-1024. - List:
GET /organization-units?projectId=<project-id>returns the top OUs of the project: its root OUs and the OUs it placed under the system OU. List the rest under their parent. A project that does not exist returns an empty list. A caller who can list only some OUs gets every OU of the project they can list, at any level, as the list withoutprojectIddoes. - Placement:
GET /organization-units?projectId=<project-id>&placement=truelists where a resource of the project can be placed: the system OU first, markedisSystem, then the project's top OUs. The system OU is listed without its children, since they belong to other projects too. List the rest of the project's OUs under their parent. A project that does not exist returns an empty list. Combiningplacementwithfilterfails withOU-1028. Addwithin=<ou-id>to keep only the placements in that OU's subtree, such as the ones a user type or agent type allows: within the system OU, the system OU and the project's OUs directly under it; within an OU of the project, that OU and its subtree; within any other OU, none. - Update: an update without
projectIdkeeps the OU in its current project. A differentprojectIdmoves the OU and all its descendant OUs to that project. If a descendant is defined in a declarative resource file, nothing moves and the request fails withOU-1012. An OU leaves a project only while neither it nor a descendant holds a resource, such as a user, group, role, application, or child OU's resource. Otherwise nothing moves and the request fails withOU-1027. An OU that belonged to no project, such as one from before projects, moves into a project with its resources. - System OU: setting
projectIdon the system OU fails withOU-1025. - Resources in a project: a resource in a project that belongs to an OU, such as an application, agent, user, group, role, resource server, flow, notification template, credential configuration, or presentation definition, is placed in the system OU or in one of the project's OUs. Without
ouId, it goes to the system OU. An OU of another project, or of no project, fails the request. - User types: a user in an OU must be of a user type in that OU or in one of its ancestors. An OU under the system OU can use the user types of the system OU. A project's root OU has no such ancestor, so create the user types its users need in it.
- Delete a project: a project that still has OUs cannot be deleted. The request fails with
409(PRJ-1013) until its OUs are deleted or moved to another project. The API cannot delete or move an OU defined in a declarative resource file, so remove it from the file or set a differentprojectIdthere, and reload the configuration.
In the control plane Console, open a project and select Organization units under Identities to see the OUs of that project. When the project has OUs, creating a resource in the project asks where it belongs: the system OU, selected by default, or one of the project's OUs. For a user or an agent, the choices are narrowed to the OUs its type allows, and a type that can't be used in the project is reported before the user or agent is created. When it has none, the Console places the resource in the system OU without asking.
A server without projects, such as the all-in-one server, does not require a project and keeps the projectId it receives without checking it, but refuses one longer than 36 characters with OU-1022.
On the control plane, a declarative OU file must set projectId, except for the system OU. A file without it stops the server from starting. Export and import keep projectId.
Related Guides
- User Types - User types are scoped to an organization unit
- Users - Each user belongs to an organization unit
- Groups - Each group belongs to an organization unit
- Connections - Each connection belongs to an organization unit
- Sign Users In to Organization Units - Each sign-in lands in one organization unit