Roles API

Roles and their assignment live under /api/roles, any active license, admin only (403 otherwise). Errors are JSON with error and code.

Routes

MethodEndpointPurpose
GET/api/rolesEvery role with its sections, IdP groups and member count, and the section catalog
GET/api/roles/:id/membersThe users who have the role, through their built-in role or an assignment
POST/api/rolesCreate a custom role
PUT/api/roles/:idChange a role; built-in roles take only description and permissions
DELETE/api/roles/:idDelete a custom role
GET/api/roles/user/:userIdThe custom roles assigned to a user
PUT/api/roles/user/:userIdReplace a user’s custom roles

Roles

{ "id": "…", "name": "Auditors", "description": "Reads the audit", "is_system": false,
  "permissions": ["audit:read"], "idp_groups": ["audit-team"], "member_count": 3, "created_by": "admin@example.com" }

POST /api/roles
{ "name": "Auditors", "description": "Reads the audit", "permissions": ["audit:read"], "idpGroups": ["audit-team"] }

PUT /api/roles/:id
{ "permissions": ["section:governance", "section:schema"] }

PUT /api/roles/user/:userId
{ "roleIds": ["…"] }

Sections on other routes

A non-admin’s POST, PUT, PATCH and DELETE requests need the section the route belongs to in one of their roles: Configuration for environments, groupings, DB DevOps connections, Repo Sources and object consumers; Change Management for scripts, releases, approvals, executions, deployments, decision snapshots and shadow runs; Schema for schema operations, seed data, lint and preflight; Governance for compliance rules and AI agent runs. Reads are not refused.

403 { "error": "Your roles do not include Change Management, so you cannot make changes there. Ask an admin to add it to one of your roles.", "code": "SECTION_REQUIRED" }

Audit

Changes are recorded under the signed-in admin as CREATE_ROLE, UPDATE_ROLE (old and new values of what changed, with sections_added, sections_removed, idp_groups_added and idp_groups_removed), DELETE_ROLE (what the role granted and its members) and ASSIGN_ROLES (the user’s email and the roles added and removed).

Error codes

StatusCodeMeaning
400INVALID_ROLEA name, description, section or group is missing or invalid, or the change is not allowed for this role; the message names it
400INVALID_ROLE_ASSIGNMENTroleIds is not a list of role ids, or names a built-in role
403SECTION_REQUIREDA change in a section none of the caller’s roles include
404ROLE_NOT_FOUNDNo such role, a malformed id, or an unknown id in roleIds
404USER_NOT_FOUNDNo such user, or a malformed id
409ROLE_NAME_TAKENAnother role, or a built-in role, has that name
409BUILT_IN_ROLERenaming or deleting a built-in role, or changing the admin role’s sections
500ROLE_CHANGE_FAILED, ROLES_UNREADABLEThe change or the read failed; the server log has the cause