Skip to content

Groups API

The groups API manages user groups and group-based access grants on knowledge spaces (projects). Assigning access at the group level (rather than per user) is the foundation for directory-driven provisioning and role mapping.

All endpoints require an authenticated admin session (aig_admin cookie). The group endpoints additionally require the ki_manager, tenant_admin or admin role. The two org-share endpoints at the bottom of this page are the exception: any project owner may use them, including a plain member. The base URL is https://ai-api-admin.myra.eu/admin/v1.

A ki_manager (the three-tier "Fachbereich" role between member and tenant_admin) may create groups and read all groups in its tenant, but may mutate (rename, delete, change membership, grant/revoke) only the groups it created (created_by). tenant_admin and admin manage all groups in scope. This keeps a ki_manager from churning the membership of a group it does not own — which would confer/revoke access on resources granted to that group.

Every group, membership, and grant is tenant-scoped: a tenant_admin only ever sees and mutates groups in their own tenant. A platform admin may operate across tenants by passing an explicit tenant_id on create/list. A reference to a resource (group id, user, project) in another tenant is rejected with 404 — the API does not confirm the existence of out-of-tenant resources.

A non-platform caller that holds the route's permission but whose account belongs to no tenant is refused 403 { "error": "forbidden", "code": "caller_has_no_tenant" } on every /admin/v1/groups/{id}… route before any group is read (a caller without the route's permission gets 403 permission_required first); such an account never reaches a group of another tenant. Only a platform admin addresses a group of any tenant by id.

Group grants resolve through membership: a project's effective role for a user is MAX(direct member role, best group-grant role) (owner > editor > viewer). Removing a user from a group immediately revokes the group-derived access; it never downgrades a higher direct role.

Every create / update / delete / grant / revoke is written to the audit log.

Each create, update, delete, role mapping, member change, project or org share grant / revoke and gateway grant / revoke commits together with its audit row, in one transaction: either the change and its row are both stored, or neither is. A request that is refused or finds nothing to change writes no audit row: a duplicate group name, adding a user who is already a member, removing a user who is not a member, a refused last-owner or identity-provider-managed change, a gateway that is not found, and a group that disappeared. (A PATCH that sends unchanged values, or a bulk department change to the department a user already has, is still a change request and writes its row.) PATCH /admin/v1/groups/{id} (rename, description or role_id) and DELETE /admin/v1/groups/{id} answer 404 { "error": "not found" } for a group that disappeared while the request was running; the audit row records the group as it was when the change was applied.


Groups

List groups

Cross-origin reads follow the single admin policy: see Cross-origin requests (CORS).

GET /admin/v1/groups

Returns the groups in the caller's tenant. Each row carries id, tenant_id, name, description, created_by, created_at and updated_at (Unix seconds), plus a member_count, member_budget_mode (inherit, none or amount), member_budget_usd (omitted unless the mode is amount) and idp_managed (boolean, true when the group has an identity-provider (SCIM) mapping). A platform admin must pass ?tenant_id=<ID>, one canonical tenant UUID: an omitted one is 400 with code tenant_id_required, a repeated or bare one 400 with code bad_param, and a non-UUID string 400 { "code": "bad_param" } — none reaches the database. (On POST the platform admin's tenant_id is a body field: absent or "" is 400 tenant_id_required; null, a non-string or a non-UUID string is 400 invalid_tenant_id; a well-formed UUID that names no tenant, or a deleted one, is 404 tenant_not_found and nothing is created.) Every other caller is pinned to its own tenant (any ?tenant_id it sends is ignored; a caller whose account has no tenant is 403). ?mine=1 (or ?mine=true) limits the list to the groups the caller created (created_by); ?mine=0/false or no parameter lists all groups in the tenant; any other value (or a repeated parameter) is refused with 400 invalid_mine. A database fault returns 503, never an empty list. GET /admin/v1/groups/{id} returns the same fields and additionally attaches the group's members and grants arrays.

IdP-managed groups

A group with an identity-provider (SCIM) mapping is managed there. The admin API refuses to rename it (PATCH with a name that differs from the stored name), delete it (DELETE), add members to it (POST .../members) or list its add-member candidates with 409 { "error": "group is managed by the identity provider (SCIM); change it there", "code": "idp_managed" }, and refuses to remove a member whose source is scim (DELETE .../members/{user_id}, same 409). Nothing is written and no audit row is recorded. A refused rename writes nothing else either, even when the same request also carries description or role_id. Manually added members of such a group can still be removed. Reads and project grants/revocations are not affected. Authorization is checked first: a caller who may not manage the group still gets 403/404.

PATCH refuses only a rename. description and role_id stay editable on an IdP-managed group, with the same checks as on any other group (role_id still needs ROLE_MANAGE, else 403). Sending the stored name byte-identically (case and whitespace count) does not count as a rename; it is accepted and not rewritten. A rename is refused before any other field check, so a request that renames and also sets role_id answers 409 idp_managed even for a caller without ROLE_MANAGE.

Creating a group

POST /admin/v1/groups

Field Type Required
name string yes — a non-empty string, valid UTF-8, at most 255 characters (Unicode code points); unique per tenant. An absent, "" or nothing visible (only invisible characters such as NBSP or zero-width spaces) name returns 400 name_required, a JSON null name 400 invalid_name. A clash returns 409 group_name_taken. An over-long value returns 400 name_too_long, a malformed-UTF-8 or non-string value 400 invalid_name. Validated fail-closed at the write boundary so a too-long/garbage value never reaches the column as an opaque 500.
description string no — when present, valid UTF-8 and at most 2000 characters (code points); send JSON null or omit to leave it empty. Rejections: 400 description_too_long / 400 invalid_description (non-string or malformed UTF-8).
tenant_id string only for a platform admin caller (400 if omitted, null, or not one canonical tenant UUID). Ignored for every other caller (the caller's own tenant is used).

The body must be a JSON object: a JSON scalar, array or null body returns 400 invalid_body and nothing is created. An absent body is read as an empty object and answers 400 name_required.

Returns 201 with { "id": "<group id>" }.

Get a group

GET /admin/v1/groups/{id}

Returns the group plus its members and grants arrays. A group in another tenant returns 404. An IdP-managed group also carries idp_group_id (string): the identity provider's id of the bound group (the SCIM externalId). The field is omitted for a local group.

Updating a group

PATCH /admin/v1/groups/{id}

Body { "name"?, "description"?, "role_id"? }. A supplied name or description is validated exactly as on create (code-point cap + valid UTF-8, fail-closed 400 <field>_too_long / invalid_<field>). A name clash returns 409 group_name_taken; an empty name ("") or one with nothing visible returns 400 invalid_name; a null name is treated as omitted. Omit a field to leave it unchanged; the preserved (already-stored) value is not re-validated.

The body must be a JSON object: a JSON scalar, array or null body returns 400 invalid_body (invalid request body) and nothing is written. An absent body keeps today's answer (it is read as an empty object).

Mapping a group to a role (role_id)

role_id makes the group confer a role on its identity-provider members (memberships synced by SCIM, the SAML group claim or the OIDC group claim; a manually added member confers nothing). Three different answers: key absent = unchanged, JSON null = clear the mapping, a string = set it. Anything else is rejected, never coerced.

Input Result
not a string, "", longer than 36 characters 400 invalid_role_id
unknown role, or a custom role of another tenant 400 unknown_role
sys:admin, any system role other than sys:tenant_admin / sys:ki_manager, or a custom role carrying a platform-level permission 400 role_not_mappable
caller lacks ROLE_MANAGE (for example a ki_manager editing a group it created), or sets / clears a sys:tenant_admin mapping without being a tenant admin or platform admin 403 tenant_admin_only for the sys:tenant_admin mapping case; 403 otherwise

Accepted targets: the base roles sys:tenant_admin and sys:ki_manager, or a custom role of the group's own tenant. A mapping only ever affects users of the tenant that owns the group; the IdP can never grant or revoke a platform role.

How the role is applied (re-derived in the same transaction as the membership change, the mapping change or the group delete):

  • Base role: the highest base role among the user's mapped groups applies, also lowering a manually set role. Leaving all mapped groups resets the user to member. A platform admin is never changed. Every change is audited (user.role_changed_by_group, before/after role, source idp).
  • Last admin: a change that would leave the tenant without an active admin is refused softly: the role is kept, user.role_group_sync_refused is audited, and the membership change itself (and the SCIM call) still succeeds.
  • Custom role: its permissions are added to the member's effective permissions on the next request and are gone once the membership or the mapping is removed.
  • Setting or clearing a mapping (group.role_mapped audit row) and deleting a mapped group re-derive the roles of the group's IdP members. A user whose role is group-derived cannot be edited by hand: PATCH /admin/v1/users/{id} with a different role returns 409 role_managed_by_idp (also when the role comes from a role target); the user list and detail carry role_from_idp.

Role targets in the group mapping (SAML, OIDC, SCIM)

A group_mapping value may also name a role directly, { "kind": "role", "id": "<role id>" }, without a group in between. id is a system role id (sys:tenant_admin, sys:ki_manager, sys:member, sys:finance, sys:viewer, sys:demouser) or a custom role of the same tenant. The platform role sys:admin, an unknown role and a custom role of another tenant are refused with 400 when the mapping is saved (nothing is stored). The grant is stored as IdP provenance (separate from manual role assignments) and derived at the next SAML / OIDC sign-in and on SCIM create / update:

  • System role: the highest-ranked role among the user's mapped groups and role targets applies. When every mapping is lost the user falls back to the organisation's default role (member unless configured otherwise).
  • Custom role: its permissions are added on the next request and gone once the value leaves the claim.
  • Claim handling: an absent claim (SAML / OIDC) changes nothing. A malformed claim, an empty mapping result, or a SCIM user without a department value clears the roles this lane granted.
  • Each lane (saml_claim, oidc_claim, scim_attr) owns only its own rows. A role changed for a custom role is audited as user.custom_role_changed_by_idp; a system-role change as user.role_changed_by_group.

Saving a mapping that adds, removes or changes a role target, changing group_attribute, or saving any change to the SSO / SAML config (any field: issuer, certificates, client id and secret, domains, name-id format, Entra tenant id, subject claim, guest sign-in, trusted emails, scopes, enabled, metadata URL, …; an identical re-save is not a change) while the stored or the new mapping holds role targets, and deleting the SSO / SAML config that holds role targets, all require the tenant admin (or platform admin) role. Anyone else gets 403 (tenant_admin_only). A group target whose group carries a role_id counts as a role target of that role, in every rule above (adding, removing or re-pointing it, and every other config change or delete while it is stored). A group without a role_id is not one. If the group's role cannot be read the save answers 503 and nothing is written; a 400 is always answered before any 403. With a role target present, two mapping keys that are equal after trimming whitespace are rejected with 400 (group_mapping keys '<a>' and '<b>' collide after trimming). Creating or revoking the tenant's SCIM credential also needs that role while the mapping holds role targets, because the SCIM credential drives the department value that grants them.

Whoever controls an IdP group or claim value that is mapped to tenant_admin controls who is a tenant administrator of that tenant. Map only groups your identity provider guards accordingly.

Deleting a group

DELETE /admin/v1/groups/{id}

Hard-deletes the group; its memberships and grants are removed with it. Returns 200. Returns 409 idp_managed for an IdP-managed group. Deleting a group that carries a member limit (its mode is anything other than inherit) frees its members from that limit, so it also needs TENANT_SETTINGS_MANAGE; a caller with only the group permission gets 403. Returns 409 last_owner (see Project ownership guarantee) when the group is the only owner of a project, 503 if the write could not be completed (nothing was deleted).


Group member budget

PUT /admin/v1/groups/{id}/member-budget — needs TENANT_SETTINGS_MANAGE.

Sets the per-member spend limit that applies to every member of the group (spend limits only; no rate limits). Body:

Field Type Required
mode string yes — exactly inherit, none (no limit) or amount.
budget_usd number with amount only: 0 (freeze) or 0.000001 to 1000000 USD. Absent or null otherwise.

Returns 200 { "id", "member_budget_mode", "member_budget_usd" }. Rejected with 400: a body that is not a JSON object or an absent body (both invalid_body), a missing mode (mode_required; an invalid budget_usd on a body without mode is reported first, as invalid_budget_usd) or unknown mode (invalid_mode, case-sensitive), amount without budget_usd (budget_usd_required), a wrong-typed, negative, NaN or over-range amount (invalid_budget_usd), and budget_usd together with inherit or none (invalid_budget_usd). 404 for a group of another workspace or one that no longer exists, 403 without the permission, 409 user_budget_not_on_trial on a free-trial workspace, 503 if the write could not be completed. The change and its audit row (group.member_budget_changed) commit together.

Resolution (see Budgets): member, then the groups, then department, then workspace. Across several groups the highest amount wins and none dominates. A group row stored in an unreadable form refuses the member's requests (fail closed) instead of lifting the limit.

Members

List members

GET /admin/v1/groups/{id}/members

List add-member candidates

GET /admin/v1/groups/{id}/members/candidates

Returns the users of the group's tenant who are not already members — the data source for the add-member picker's browsable list. Each entry is { id, email, name } (no role/login/status metadata). The server excludes, and the client cannot broaden: soft-deleted users, platform admin users (a non-admin caller cannot add an admin target, so they are never offered), and existing members. Rows are ordered by email.

Query parameter Meaning
q Optional substring filter on email or name (case-insensitive; %, _ and ! match literally). Absent or empty = no filter. At most 254 characters (Unicode code points) of valid UTF-8 without control characters, and given once; otherwise 400 { "code": "invalid_q" }.
limit Page size, 1-1000, default 1000. A value above 1000 is clamped to 1000; anything that is not a plain non-negative integer (abc, -1, 0) → 400 invalid_limit.
offset Rows to skip, 0-1000000, default 0. A larger value is clamped; a bad shape → 400 invalid_offset.

A request with too many query arguments → 400 too_many_params.

Breaking change: the response is now { "items": [{ "id", "email", "name" }, ...], "truncated": false } instead of a bare array. truncated is true when more matching users exist beyond the returned page; the add-member picker then shows Showing the first 1000 users - type to search all. and searches the whole tenant roster by q as you type. Clients that read the old array must read items.

Authorized like the add-member mutation, not the members-list read: require_ki_manager and can_manage_group (admin ∨ tenant_admin ∨ the group's creator). A ki_manager who does not manage the group → 403 group_not_manageable; a caller in another tenant → 404 (no existence oracle). Because a group-managing ki_manager can read this, the endpoint effectively exposes the tenant's non-admin user roster (email + name) to that trusted intra-tenant tier — this is the intended, minimal consequence of an in-tenant "browse existing members" picker.

Adding a member

POST /admin/v1/groups/{id}/members

Field Type Required
user_id string yes — 1–36 printable ASCII characters, no spaces (not necessarily a UUID), and it must belong to the same tenant as the group (an unknown user, another tenant's user or a deleted user → 404 { "error": "not found" }, recorded as one access.denied event for every caller, platform admins included: status 404, no entity, the route path only, the body user_id is not stored; see group and role ids). A caller who is not a platform admin and names a same-tenant platform-admin user gets 403 { "error": "forbidden", "code": "target_outranks_caller" }, not the recorded 404. Absent → 400 user_id_required; present but not that shape (0, true, null, an object, "", over 36 bytes, a control character, a space, a non-ASCII character) → 400 { "error": "invalid user_id", "code": "invalid_user_id" }.

The body must be a JSON object: a JSON scalar, array or null body returns 400 invalid_body (invalid request body) and nothing is written. An absent body keeps today's answer (it is read as an empty object).

Returns 201 when the member is added. Re-adding an existing member (whatever its source) returns 200 { "ok": true, "unchanged": true }, changes nothing and is not audited. Returns 409 idp_managed for an IdP-managed group. On a group that carries a member limit (mode other than inherit) the caller additionally needs TENANT_SETTINGS_MANAGE, else 403.

Removing a member

DELETE /admin/v1/groups/{id}/members/{user_id}

Idempotent — removing a non-member, an unknown user id, or a spelling variant of a member's id (different case, trailing space, invisible or full-width characters) returns 200 { "ok": true, "unchanged": true }, changes nothing and writes no audit event; a variant never removes the real member's membership. The member id is matched byte-exact against the stored id. A group {id} that is only a spelling variant of the real group id answers the same audited 404 as an unknown group. On a group that carries a member limit the caller additionally needs TENANT_SETTINGS_MANAGE, else 403. On an IdP-managed group, removing a member whose source is scim returns 409 idp_managed. On any group a membership that comes from the identity provider (scim, saml_claim, scim_attr, oidc_claim) cannot be removed here: 409 membership_managed_by_idp (remove the user in the IdP); the body lists the affected user in user_ids. Adding an IdP member by hand keeps its IdP source. If a user is already a manual member, the identity provider does not take the membership over: it stays manual and confers no role until it is removed and the IdP adds the user again. Returns 409 last_owner (details) when the member's removal would leave a project without an owner, 503 if the write could not be completed (nothing was removed).


Grants (group → resource)

A grant gives every member of the group a role on a resource. Creating a grant additionally requires can_share: the caller must be the owner of the resource, a tenant_admin, or a platform admin. A non-owner attempting to grant a resource they do not own returns 403 project_role_insufficient.

List a group's grants

GET /admin/v1/groups/{id}/grants

Creating a grant

POST /admin/v1/groups/{id}/grants

Field Type Required
resource_type project yes — absent → 400 resource_type_required, any other value, including null → 400 invalid_resource_type. (Agent grants are a planned addition.)
resource_id string yes — a string of 1–36 printable ASCII characters, no spaces; absent → 400 resource_id_required, present but not that shape (a number, true, null, an object, "", over 36 bytes, a control character, a space, a non-ASCII character) → 400 invalid_resource_id. It must be a resource in the same tenant as the group (a project you cannot see — other tenant, unknown, malformed or no role — → 404, recorded as access.denied, see projects).
role owner | editor | viewer yes — absent → 400 role_required, any other value, including null → 400 invalid_role.

The body must be a JSON object: a JSON scalar, array or null body returns 400 invalid_body (invalid request body) and nothing is written. An absent body keeps today's answer (it is read as an empty object).

Returns 201. Re-granting the same group on the same resource updates the role (idempotent). A group granted owner confers the resource's owner powers (including deletion) on every member; group-conferred owners count toward the resource's last-owner protection. Changing an existing owner grant to editor or viewer is refused with 409 last_owner (details) when it would leave the project without an owner; 503 if the write could not be completed (the grant is unchanged).

Revoke a grant

DELETE /admin/v1/groups/{id}/grants/{resource_type}/{resource_id}

Returns 200 (idempotent). Returns 409 last_owner (details) when revoking an owner grant would leave the project without an owner; 503 if the write could not be completed (the grant is kept).


Gateway grants (group → gateway)

A group can grant its members extra gateways. For each member the effective set of allowed gateways is the member's department set plus every gateway granted to any of their groups — unless the department is locked, in which case the department set alone applies. A user without a department stays unrestricted. Grants are tenant-scoped, only production gateways of the group's tenant can be granted, and an expired grant stops counting at once. A grant never changes a project's gateway pin or lock, which stay department-only.

These routes need the DEPARTMENTS_MANAGE permission (not the group role), because they widen routing.

Route Purpose
GET /admin/v1/groups/{id}/gateways 200 { "gateways": [ { "gateway_id", "name", "expires_at" } ], "reach": { "departments": [ { "department_id", "name", "locked", "members" } ], "no_department", "unresolved" } } (expires_at is Unix seconds or null; name is null if the gateway no longer exists). reach says who the grants reach — see below.
PUT /admin/v1/groups/{id}/gateways/{gateway_id} Grant or update. Body { "expires_at": <integer> \| null }; an absent body or an absent key means no expiry. Returns 200 { "gateway_id", "expires_at" }. Idempotent. Audit group.gateway_granted. The gateway_id in the URL is accepted in any letter case; the stored grant, the response and the audit row carry the gateway's own id, never the spelling sent.
DELETE /admin/v1/groups/{id}/gateways/{gateway_id} Revoke. 204; 404 if there was no such grant. Audit group.gateway_revoked (records the gateway's own id).

reach counts the group's live members by their effective department (an explicit assignment, else the tenant default unless the member is pinned to "no department" — the same rule routing uses). It carries department names and counts only, never budgets or spend.

  • departments[]: one entry per department of the group's tenant, ordered by name. locked is true unless the stored lock is exactly 0 — any other stored value reads as locked, exactly as the routing policy reads it.
  • no_department: members without a department (routing leaves them unrestricted; group grants add nothing).
  • unresolved: members bound to a department that no longer exists or belongs to another tenant (routing restricts them to no gateway). A storage row whose "no department" flag is not exactly 1 counts here too.
  • If any bucket's member count is not a positive integer, the summary is withheld: reach is null (logged) and the grants are still listed — never a partial count that could read as "reaches nobody". A failed summary read answers 503 for the whole request.

expires_at must be a JSON integer Unix time in the future and no later than 4102444800 (2100-01-01), or null. A float, string, boolean, past, out-of-range or non-finite value is 400 invalid_expires_at; a body that is present but not a JSON object (an array, a scalar, null) is 400 invalid_body — a malformed body is never read as "no expiry".

Input Rejected when Status
gateway_id empty or over 36 characters 400 gateway_id_invalid
gateway_id not a gateway of the group's tenant / not a production gateway 400 gateway_not_in_tenant / gateway_not_production
{id} unknown, malformed, a spelling variant of the stored id, or in another tenant 404, recorded as one access.denied event (see group and role ids)
any route caller lacks DEPARTMENTS_MANAGE 403
a read or write fault 503 (retry), nothing written

Delegate rules. A DEPARTMENTS_MANAGE holder below tenant_admin may not change a group that grants gateways if they are a member of it (403 department_self_management), or if any member outranks them — is a tenant admin or platform admin (403 department_target_outranks). The same rules guard adding or removing members of, and deleting, a group that holds gateway grants: a target who is the caller is department_self_management, a target who outranks the caller is department_target_outranks. A failed membership or role read is 503 (retry), never "nobody outranks". Tenant admins and platform admins are not restricted by these rules. Deleting a group removes its grants; deleting a gateway removes the grants that name it.

Identity-provider writers. Group membership can be written by the identity provider, and for a group with gateway grants that is a routing decision made outside the admin API: SCIM user provisioning with a mapped department attribute (scim_attr), the SCIM Groups API, SAML claim sync through group_mapping (saml_claim), and OIDC group claims (oidc_claim). These writers are not subject to the delegate rules above. Treat the IdP group as part of the gateway policy: whoever can edit its membership in the IdP can widen a user's gateways.


Project ownership guarantee

A project always keeps at least one effective owner (a direct owner, or a member of a group holding an owner grant, counted per person). The four group writes that can remove an owner — revoking an owner grant, downgrading it, removing a member of an owner group and deleting an owner group — are refused when they would leave a project that has an owner with none:

{ "error": "would leave a project without an owner", "code": "last_owner",
  "projects": [ { "id": "<project id>", "name": "<project name>" } ] }

Status 409. Clients should branch on code, not the message; projects lists every project the write would orphan. A refused write changes nothing and records no audit event. The check and the write are one transaction under the project row lock, so concurrent owner changes cannot both pass. If the database is busy or a lock wait times out the answer is 503 (retry) and nothing was written. A project that already has no effective owner is not blocked by this rule. Make another person an owner of the project first, then repeat the change. The four admin writes above refuse; identity-provider group sync (SCIM group member remove / replace / unlink, SAML claim sync, SCIM department sync) cannot be refused by the admin, so it instead hands a project it would leave ownerless to a live admin of the project's tenant (one project.owner_handed_over audit row per project, actor type system). With no live tenant admin the project is kept ownerless, a warning is logged and a project_without_owner alert fires after the commit. A sync that cannot acquire the project lock answers 503 with nothing written, so the IdP retries; on a SAML sign-in a lock wait does not block the sign-in, and the user keeps the previous claim memberships until the next sign-in. Identity-provider group sync also covers projects in the trash (a trashed project is handed over too), while the refusal of the admin writes above covers live projects only. OIDC sign-in now syncs the configured group claim as well (reason oidc_claim_sync), with the same hand-over rule.


Identity-provider group claim sync

When a tenant sets Group attribute and Group mapping (group_attribute, group_mapping on the SSO or SAML config), every sign-in syncs the claim into the user's group memberships. OIDC memberships carry the source oidc_claim, SAML memberships saml_claim. The two lanes never touch each other, and a manual or SCIM membership is never changed. Only values listed in the mapping grant membership, and only for groups of the user's own tenant.

What the sign-in carries Result
The claim is absent The user keeps their memberships. A missing claim is not a statement that the user has no groups.
The Entra overage marker (OIDC: _claim_names / _claim_sources, or hasgroups; SAML: the groups.link attribute while the configured attribute is absent) Myra asks Microsoft Graph for the user's groups (see below) and replaces the lane with exactly the mapped groups. If the lookup is not possible or fails in any way, the user keeps their memberships.
A well-formed list, possibly empty The lane is replaced by exactly the mapped groups. An empty list clears the lane.
A malformed claim (not a list, or a list with any non-string value) The lane is cleared and no claim-derived group is granted. One non-string value withholds all claim-derived groups until a well-formed sign-in.
A stored mapping that is corrupt The lane is kept and an error is logged (SAML, OIDC and SCIM alike).

Sign-in is never blocked by a group-sync outcome. A SAML assertion with an empty AttributeValue has the empty value dropped by the validator: a mixed list ["g1", ""] syncs g1, a list of only empty values is the empty list and clears the lane.

Entra overage lookup: when the sign-in carries the overage marker, Myra calls Microsoft Graph (GET /users/{oid}/transitiveMemberOf) with the application's own client credentials and maps the returned group GUIDs through Group mapping. The lookup needs the Entra directory ID and the client ID and secret saved on the tenant's OIDC configuration, an application permission with admin consent (see Microsoft Entra ID), and an attribute that is the Entra groups claim (groups for OIDC, http://schemas.microsoft.com/ws/2008/06/identity/claims/groups for SAML). Graph returns all transitive groups of the user regardless of the groups-claim filter configured in Entra, so Group mapping stays the allow-list: only mapped GUIDs grant membership. The lookup is bounded (10 pages, 10 seconds). A Graph error, a timeout, a permission failure, a malformed answer or a missing credential never wipes and never grants: the user keeps their memberships and a warning is logged. An empty but well-formed Graph answer means the user has no groups and clears the lane.

Revocation trade-off: because an absent claim (or an overage whose Graph lookup failed) keeps memberships, a user whose groups were removed at the identity provider keeps the claim-derived memberships (and any role the mapped group confers) until a sign-in carries a well-formed claim. A claim-derived membership is IdP-managed and cannot be removed in Myra (DELETE /admin/v1/groups/{id}/members/{user_id} answers 409 membership_managed_by_idp). To revoke at once, make the IdP send the claim (on Entra, assign fewer than the overage threshold of groups, for example by scoping the app's groups claim to groups assigned to the application).


Rejected input summary

Input Rejected when Status
any group route caller is not ki_manager/tenant_admin/admin 403 (shared-gate code, e.g. permission_required; see the admin gates)
any route no signed-in user resolves 401 unauthenticated
group create body a JSON scalar, array or null (an absent body answers name_required) 400 invalid_body
PATCH /groups/{id}, POST …/members, POST …/grants, POST /projects/{id}/org-share body a JSON scalar, array or null (an absent body keeps today's answer) 400 invalid_body
org-share routes caller is viewer/demouser, or has no/unknown role 403 (shared-gate code; see the admin gates)
org-share routes caller is not the project owner (nor tenant_admin/admin) 403 (project visible to the caller) / 404 recorded as access.denied (cross-tenant, unknown, malformed or no role; see projects)
{id} group is in another tenant / unknown / malformed 404 { "error": "not found" }, recorded as one access.denied event (see group and role ids)
{id} the group lookup itself fails (a database fault) 503 — retry; never a 404 that would read as "no such group"
name absent, "" or with nothing visible on create 400 name_required
name JSON null on create, "" or with nothing visible on rename 400 invalid_name
name duplicate within the tenant, over 255 code points, malformed UTF-8, or non-string 400 (name_too_long / invalid_name) / 409 group_name_taken (on an IdP-managed group, a name that differs from the stored one gets 409 idp_managed first)
description over 2000 code points, malformed UTF-8, or non-string 400 (description_too_long / invalid_description)
tenant_id omitted by a platform admin on create/list 400 tenant_id_required; on create a null, non-string or non-UUID body value: invalid_tenant_id; on create a well-formed UUID of no live tenant (unknown or deleted): 404 tenant_not_found; on list a malformed or repeated query value: bad_param
{id} (mutations) the group is IdP-managed (rename to a different name, delete, add member, candidates, remove a scim member; description / role_id edits are allowed) 409 idp_managed
members.user_id absent / present but not 1–36 printable ASCII characters, no spaces (0, true, null, "", an object, over 36 bytes) 400 user_id_required / invalid_user_id
members.user_id well-formed but unknown, deleted, or in a different tenant than the group (an id that differs from a real user id only in letter case, a trailing space or an invisible character counts as unknown: ids are matched byte-exact) 404, recorded as one access.denied event (a malformed id stays 400 and a storage fault 503, neither recorded)
grants.resource_type absent / not project 400 resource_type_required / invalid_resource_type
grants.resource_id absent / present but not 1–36 printable ASCII characters, no spaces 400 resource_id_required / invalid_resource_id
grants.resource_id well-formed but unknown, or a project you cannot see 404, recorded as access.denied (see projects); a project you can see but that lies outside the group's tenant (platform admin, legacy cross-tenant owner) is a plain 404
grants.role absent (role_required) / null or not owner/editor/viewer 400 role_required / invalid_role
grant create/revoke caller cannot can_share the resource (not owner, nor tenant_admin/admin) 403 project_role_insufficient (project visible) / 404 recorded as access.denied (project not visible)
any mutation a ki_manager mutating a group it did not create 403 group_not_manageable
gateway-grant routes caller lacks DEPARTMENTS_MANAGE; see Gateway grants 403
expires_at not an integer in the future up to 4102444800, or null 400 invalid_expires_at

Every refusal above carries a top-level code (see Typed codes on the org admin routes). A plain 404 { "error": "not found" }, the 5xx storage faults and gateway_id_invalid keeps its published spelling. A non-string group name answers invalid_name (see the field table above).

A database fault on a group, member or grant write (create, update, delete, add / remove member, grant / revoke project or org share) answers the sanitised 500 { "error": "internal error", "request_id": "…" } — never the database's own error text. A failed read (the group list, a group's members or grants, the member candidates) answers 503 { "error": "temporarily unavailable; retry later" } — send it again (see Storage faults).

A write answers 503 { "error": "temporarily unavailable; retry later" } when it could not take its lock, including a lock that stayed held for longer than 5 seconds: nothing was written, no change and no audit row, and it is safe to send the request again. One exception: a PATCH /admin/v1/groups/{id} that sends name or description and a changed role_id runs two separate units, first the rename / description change with its group.updated row, then the role mapping with its group.role_mapped row. If the second unit fails with 503 or 500, the first may already be stored; send the same body again, which is safe. The sanitised 500 means the change was not applied, or its outcome is unknown; check the group before repeating a non-idempotent request. A change is never stored without its audit row.


Org-share

Org-share makes a project accessible to the whole tenant. It is a tenant capability that an admin/tenant_admin can deactivate: PATCH /admin/v1/tenants/{id} with { "org_share_enabled": 0 | 1 } (audited). When the capability is 0, no new org-share can be created and every existing org-share stops granting access at resolve time — retroactive, with no deny rows. The toggle and a project's org_grant surface via GET /admin/auth/me (tenant_org_share_enabled) and GET /admin/v1/projects/{id} (org_grant).

GET /admin/v1/projects/{id} additionally returns org_access — a server-derived VIEW of whether the org grant actually resolves to access, for the Members surface. It is { "role": "editor" | "viewer" } only when a grant row exists and the tenant capability is on; it is absent otherwise. This is distinct from org_grant (the raw grant row that drives the share/unshare toggle): when the capability is switched off, the grant row — and thus org_grant — is unchanged, but org_access disappears, because no tenant user has org access at resolve time. The role in org_access is read from the same facts the access resolver reads, so it can never claim access the resolver would not grant; a grant that fails to resolve to a recognised role yields no org_access (fail closed).

Share a project with the organization

POST /admin/v1/projects/{id}/org-share — body { "role": "editor" | "viewer" }. An absent role answers 400 role_required; any other value, including null, answers 400 invalid_role. The body must be a JSON object: a JSON scalar, array or null body returns 400 invalid_body (invalid request body) and nothing is written; an absent body keeps today's answer (read as an empty object).

The admin UI sends viewer. Its control is a single toggle with no role picker, so whatever it sends is what every project owner grants without being asked — and editor is not a read role: it is the level that gates creating, uploading, moving and deleting a project's knowledge files. A share meant to let colleagues see a project must not hand the whole tenant delete rights on its documents. editor remains accepted for a deliberate, API-driven share.

Gated by require_author AND can_share (owner ∨ tenant_admin ∨ admin) AND the project's tenant org_share_enabled = 1.

This is available to any project owner, including a plain member — it is no longer restricted to ki_manager/tenant_admin/admin. The reason is consistency with the per-user path: POST /admin/v1/projects/{id}/members has always been owner-gated with no manager-role requirement and accepts role: "owner", so an owner could already grant more, one colleague at a time. require_author still refuses the read-only roles (viewer, demouser) and fails closed on an absent or unrecognised role. Ownership may be direct or inherited from a group that was granted the owner role on the project.

Role is capped at editor/viewer — never owner (an org-owner would make every tenant user a project owner and could be laundered into a non-revocable group grant). Returns 403 org_share_disabled (also the code) when the capability is off, 503 if the capability could not be read because of a transient fault (safe to retry), a plain 404 if the project's tenant no longer exists (a caller who can see the project but whose tenant no longer exists, e.g. a platform admin), and 400 for role: "owner" or any non-editor/viewer value. A transient failure to read the project itself is likewise a 503, never a misleading permanent 404. Idempotent (re-share updates the role — including upgrading an existing viewer org grant to editor).

Stop sharing

DELETE /admin/v1/projects/{id}/org-share — gated by require_author AND can_share (but not the capability flag, so cleanup works when it is off). Available to any project owner, like sharing. Returns 200 (idempotent).


Role → capability matrix

ki_manager is the three-tier role between member and tenant_admin ("Fachbereich" manager). Least-privilege: it adds group management to member-level capabilities, nothing more. (Org-share used to be part of that step up; it was moved to project ownership, so it is no longer what distinguishes a ki_manager.)

Capability admin tenant_admin ki_manager member finance viewer demouser
Manage groups (own / created) all all own only – – – –
Org-share a project (owned) yes yes yes yes – – –
Gateways / Users / Tenants / Providers / MCP admin yes yes (scoped) – – – – –
Analytics (/stats) scope tenant-wide tenant-wide own data own data own data own data own data
Create projects / agents, run inference yes yes yes yes inference only – –
Assign roles all up to ki_manager – – – – –

finance is a cost-console role: it can run inference but cannot author (create projects, agents, or workflows) or administer anything. Its distinct surface is Settings → Costs → User Costs (/finance) and the tenant billing/cost console.

Scope: "Anwender" = the tenant / operating organization; org-share deactivation is tenant-scoped, enforced at grant-create AND at the resolver. The additive model has no per-individual opt-out. "Erweiterte Agentenkonfig" is delivered via agent sharing.

Superseded: an earlier reading additionally treated org-sharing as making "mit Org teilen" a KI-Manager Fachbereich capability, and gated the endpoints accordingly so that a plain member could not org-broadcast even a project they owned. Real user demand contradicted that reading — a project owner with no manager role had no way to share their project and was adding members one by one — so the gate is now project ownership plus the tenant capability flag. The tenant-scoped deactivation requirement is unchanged and remains the admin control. Note that agent org-share (api-reference/agents.md) is still ki_manager-gated, so the two resources currently differ.