View source on GitHub
How It Works
A super admin is a user whose instance-level role isadmin. It is separate from the owner, admin and member roles inside an org. It carries the permissions to create orgs, invite people into orgs it is not a member of, and grant or revoke the role itself.
Every instance should already have a super admin. Migration 138 promotes the oldest user if none exists, ordered by first_login_at, then accepted_tos. That is usually the person who installed OHE, but it is chosen by timestamp, so check.
Prerequisites
- An OHE install, and an API key for a user. Create one in the app under Settings > API Keys.
- To list super admins through the API, one of:
- the key belongs to a super admin, or
- Enable OEM User Creation Flow is on (see Enabling the Feature). It sets
USER_PROVISIONING_ENABLED, which lets any signed-in user list super admins on OHE 1.62.0 or later. Earlier versions return 403 to everyone but super admins, even with the toggle on.
- To grant the role or create orgs, the key must belong to a super admin.
pip install requests
Run It
Set the server and your key. With no subcommand the tool runs a read-only preflight.--yes. It prints the request and sends nothing.
1
Promote Another Super Admin
The user must have signed in at least once. Granting twice is harmless. Revoking refuses to remove the last super admin.Only a current super admin can do this. Finding the super admin does not give you its permissions, so the super admin has to run the command or hand you a key.
2
Create a Team Org
3
Add the First Owner
Pick one of the two.
- Invite
- Provision
Works for people who already have accounts. An existing user is added at their next login. If they were on their personal org, they land in the new one, and the personal org is still there. When no email provider is configured the tool prints the invite link to share.
Enabling the Feature
The endpoint is registered only when the operator turns it on. Both install types setUSER_PROVISIONING_ENABLED=true on the app server:
When it is disabled, POST /api/organizations/provision-user returns 404. Org creation and superadmin management are always available.
Find the Super Admin Without the API
The API route is blocked until you have a super admin key or the OEM flag. The database does not need either.138 to see who would be picked: the oldest user by COALESCE(first_login_at, accepted_tos).
Things to Know
- Listing orgs only shows memberships.
GET /api/organizationsreturns orgs the caller belongs to. Keep the id fromcreate-org, because a super admin cannot list the orgs it created. - Personal orgs are not touched. Nothing here moves or hides personal data.
- The default-org flags change what a team org means. If exactly one team org exists when
default_openhands_org_enabledis later turned on, it is adopted as the default org, and with auto-add every user who signs in joins it. With more than one team org, the default-org bootstrap does nothing. - Unclaimed git events follow the same rule. They fall back to the default org only while exactly one team org exists.
- Org creation is for super admins only. The chart value
openOrgCreation.enabledis meant to open it up, but thePOST /api/organizationsroute checks the super-admin permission and does not read it.
APIs Used
Related
provision-users
Script the same org and user provisioning from your own system, including idempotent re-runs and API key reissue

