Orkestia
Blog
Build apps

Workspaces

A workspace is a tenant inside your app — a farm, a company, an office — that members join with a role, so data can belong to a group instead of one person.

An end-user owns their own rows. A workspace lets a group of end-users share rows: a farm, a company, an accounting office. A workspace lives inside one Identity app. It is not an Orkestia organization, which is a paying customer.

What you can do

ActionWorkflow
Create a workspace (name, unique slug, optional kind)identity.app-organization.create
Add an existing end-user with a roleidentity.app-organization.add-member
Invite someone by email, pending until acceptedidentity.app-organization.invite
Change a member's roleidentity.app-organization.assign-role
List workspaces and membersidentity.app-organization.query
Move the signed-in user to another workspaceidentity.end-user.organization.switch

A role is an access group (group_slug) you have defined for the app. It maps to capabilities such as {namespace}:{verb}.

Let people switch workspaces in your app

Your app's users can only start workflows you expose to the app, so they can't call identity.end-user.organization.switch themselves. Publish a composition with one step that wraps it, and expose that composition:

  • Give the composition an input with any name except app_organization_uuid, for example workspace_uuid, and map it to the step's app_organization_uuid. A user's input may not use app_organization_uuid as a key: the active workspace comes from the server, so the platform refuses such a start with PRINCIPAL_OVERRIDE_REJECTED.
  • The switch checks that the user is a member of the workspace they asked for. Your app doesn't need to check it again.

From then on, the user's runs and workspace rows use the new workspace.

If your app has turned on end-user authoring, it already has this composition: composer-workspace-switch-<app12>, with the input workspace_uuid.

Sessions bound to a workspace

A session token can be bound to one workspace: send app_organization_uuid when you exchange the code or refresh the token at POST /api/auth/end-user/token. With a bound token, starting a workflow while the user's active workspace is a different one fails with 403 and code: "WORKSPACE_MISMATCH". The reason field says why:

reasonMeaning
active_workspace_differsThe user switched to another workspace after this token was issued.
no_active_workspaceThe user has no active workspace now, for example because they were removed from it.

After a switch, refresh the token with the new app_organization_uuid, switch back to the token's workspace, or use an unbound token. An unbound token always follows the active workspace.

Automations in a workspace

People in a workspace can build, check, publish, run and schedule their own compositions there. Each composition belongs to the workspace, and the person's role there decides what they may do. By default, members draft and run; admins and owners also publish. See End-user authoring.

People without an email

An end user who only uses WhatsApp has a verified phone number and no email (see People who only use WhatsApp). Add them with identity.app-organization.add-member and their end_user_uuid. Invites go out by email, so identity.app-organization.invite and the in-app identity.end-user.organization.invite-member cannot reach them.

Data in a workspace

Declare a table with organization ownership and its rows belong to the user's active workspace. See Ownership. The active workspace comes from the server, not from the request, so a caller cannot choose another one.

Workspace-scoped rows are checked against the member's capabilities. Whether a feature is switched on for the app is a separate control; see Modules and feature flags.