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
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /api/roles | Every role with its sections, IdP groups and member count, and the section catalog |
| GET | /api/roles/:id/members | The users who have the role, through their built-in role or an assignment |
| POST | /api/roles | Create a custom role |
| PUT | /api/roles/:id | Change a role; built-in roles take only description and permissions |
| DELETE | /api/roles/:id | Delete a custom role |
| GET | /api/roles/user/:userId | The custom roles assigned to a user |
| PUT | /api/roles/user/:userId | Replace 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": ["…"] }
nameis required, trimmed, up to 100 characters, and unique in any letter case; it cannot be the name of a built-in role (admin,release_manager,approver,user).descriptionis up to 500 characters.permissionsholds keys from the catalog: the sectionssection:configuration,section:change,section:schema,section:governance,section:adminandsection:overview, andaudit:read, which lets the holder read and export the audit trail. Only theadminrole can includesection:admin, and theadminrole always has every section.idpGroupsis up to 50 group names of up to 200 characters each, for custom roles only. Repeated values are saved once.roleIdsmay name custom roles only; a user’s built-in role is changed withPUT /api/db-devops/users/:id.
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
| Status | Code | Meaning |
|---|---|---|
| 400 | INVALID_ROLE | A name, description, section or group is missing or invalid, or the change is not allowed for this role; the message names it |
| 400 | INVALID_ROLE_ASSIGNMENT | roleIds is not a list of role ids, or names a built-in role |
| 403 | SECTION_REQUIRED | A change in a section none of the caller’s roles include |
| 404 | ROLE_NOT_FOUND | No such role, a malformed id, or an unknown id in roleIds |
| 404 | USER_NOT_FOUND | No such user, or a malformed id |
| 409 | ROLE_NAME_TAKEN | Another role, or a built-in role, has that name |
| 409 | BUILT_IN_ROLE | Renaming or deleting a built-in role, or changing the admin role’s sections |
| 500 | ROLE_CHANGE_FAILED, ROLES_UNREADABLE | The change or the read failed; the server log has the cause |