Documentation Index
Fetch the complete documentation index at: https://docs.emergence.ai/llms.txt
Use this file to discover all available pages before exploring further.
Organizations
Organizations are the top-level tenant boundary in CRAFT. Each organization maps 1:1 to a Keycloak realm, providing full identity isolation between tenants. When you create an organization, the platform provisions a complete identity and authorization environment automatically.Every resource in the platform is scoped to an organization via
organization_id. The org ID is never supplied by the client in request bodies — it is always extracted from the JWT token’s issuer claim, which identifies the Keycloak realm.How Organizations Work
Creating an organization triggers a coordinated setup across three systems:Keycloak Realm Creation
A new Keycloak realm is created using the organization ID as the realm name. This realm holds all users, groups, and identity provider configurations for the tenant.
Default Group Provisioning
Default groups are created within the realm to establish the role hierarchy:
org-owners— Full organization controlorg-admins— Administrative access (user and project management)org-members— Standard membership with read access
OpenFGA Permission Setup
Permission tuples are written to OpenFGA mapping each group to its corresponding relation:
org-owners->ownerrelation on the organizationorg-admins->adminrelation on the organizationorg-members->memberrelation on the organization
org-admins in Keycloak automatically inherits admin permissions across the platform.Organization ID in JWT
The organization ID is derived from the Keycloak realm embedded in the token’siss (issuer) claim. When a user authenticates against a realm, the platform extracts the realm name as the org_id:
- The
org_idis cryptographically bound to the token (it comes from the issuer verified by JWKS signature) - Clients cannot forge or override the organization context
- Users in the
masterrealm (platform developers) haveorg_id = null
API Reference
The Organizations API is part of the Governance service (port 8001).POST /governance/organizations
POST /governance/organizations
Creates a new organization with Keycloak realm, default groups, and OpenFGA permissions.Access: Platform developers only (master realm)The
Request Body
id must follow Keycloak realm naming rules: alphanumeric characters, hyphens, and underscores only.When create_users is true, default users are created and added to the appropriate groups for immediate access.Response (201 Created)
GET /governance/organizations/{org_id}
GET /governance/organizations/{org_id}
Retrieves organization details by ID.Access: Users with
can_read permission on the organization (owners, admins, or members).Response (200 OK)
DELETE /governance/organizations/{org_id}
DELETE /governance/organizations/{org_id}
Deletes an organization and cascades to all its projects. Removes OpenFGA permission tuples, the Keycloak realm (including all users and groups), and database records.Access: Platform developers only (master realm). Idempotent: returns 204 whether the organization was deleted or was already absent.
Bootstrap Organization
During first startup, the Governance service automatically bootstraps a default organization:create_admin_user is true (the default), a user named emergence is created with:
- Username:
emergence - Password:
emergence(change immediately in production) - Group:
org-admins - OpenFGA relation:
adminon the organization
Organization Permissions
Organizations define the following computed permissions in the OpenFGA schema:| Permission | Owner | Admin | Member |
|---|---|---|---|
can_read | Yes | Yes | Yes |
can_write | Yes | — | — |
can_delete | Yes | — | — |
can_manage_projects | Yes | Yes | — |
can_manage_users | Yes | Yes | — |
can_read_secrets | Yes | Yes | Yes |
can_manage_secrets | Yes | Yes | — |
can_read_metadata | Yes | Yes | Yes |
can_manage_metadata | Yes | Yes | — |
Next Steps
Projects
Learn how projects scope resources within organizations.
Multi-Tenancy
Understand the full tenant isolation architecture.
Authentication
See how Keycloak realms power the authentication flow.
Authorization
Explore the OpenFGA permission model in depth.

