# Manage roles and inheritance

Query and maintain roles, role lifecycles, and inheritance relationships. Check permissions, ownership, and deletion impact before deleting or changing roles. This page does not bind roles to specific users.

## Prerequisites

Prepare credentials that can access the target workspace and the target role ID. For service endpoints, authentication, and general request formats, see [Prepare to call an API](../../api-call-basics.md).

Before changing inheritance or deleting a role, query the role list, inheritance relationships, and related impact information.

## Call sequence

1. First [list roles](../../../../reference/api/ai-studio/users-and-permissions/roles/list-roles.md) to identify the target role.
2. To understand current relationships, query inheritance relationships, the inheritance graph, and the permission view.
3. After adding or removing inheritance, query inheritance relationships again. After updating a role or lifecycle, query the role list to confirm the result.
4. Before deletion, query deletion and ownership impact, then confirm conditions and results on the action page.

## API operations

### Query roles, relationships, and impact

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Query roles | [List roles](../../../../reference/api/ai-studio/users-and-permissions/roles/list-roles.md) | Select a target role or confirm a change. |
| Query role inheritance | [List role inheritance](../../../../reference/api/ai-studio/users-and-permissions/roles/list-role-inheritance.md) | View inheritance relationships before or after changes. |
| Query the role inheritance graph | [Get the role inheritance graph](../../../../reference/api/ai-studio/users-and-permissions/roles/get-role-inheritance-graph.md) | View the inheritance relationship graph. |
| Query the role permission view | [Get the role permission view](../../../../reference/api/ai-studio/users-and-permissions/roles/get-role-permission-view.md) | Confirm role permissions before changes. |
| Query role audit events | [List role audit events](../../../../reference/api/ai-studio/users-and-permissions/roles/list-role-audit-events.md) | View role audit events. |
| Query role deletion impact | [Get role deletion impact](../../../../reference/api/ai-studio/users-and-permissions/roles/get-role-delete-impact.md) | Confirm deletion impact before deleting a role. |
| Query role ownership impact | [Get role ownership impact](../../../../reference/api/ai-studio/users-and-permissions/roles/get-role-ownership-impact.md) | Confirm ownership impact before deletion or changes. |

### Update roles and inheritance

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Update a role | [Update a role](../../../../reference/api/ai-studio/users-and-permissions/roles/update-role.md) | You have the role ID and need to modify it. |
| Update a role lifecycle | [Update a role lifecycle](../../../../reference/api/ai-studio/users-and-permissions/roles/update-role-lifecycle.md) | Adjust a target role's lifecycle. |
| Add role inheritance | [Add role inheritance](../../../../reference/api/ai-studio/users-and-permissions/roles/add-role-inheritance.md) | You identified two roles and need to create an inheritance relationship. |
| Remove role inheritance | [Remove role inheritance](../../../../reference/api/ai-studio/users-and-permissions/roles/remove-role-inheritance.md) | Confirm the target inheritance relationship before removing it. |

### Delete a role

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Delete a role | [Delete a role](../../../../reference/api/ai-studio/users-and-permissions/roles/delete-role.md) | You confirmed deletion and ownership impact. |

## Confirm the result

After updating a role or inheritance, use [List roles](../../../../reference/api/ai-studio/users-and-permissions/roles/list-roles.md) and [List role inheritance](../../../../reference/api/ai-studio/users-and-permissions/roles/list-role-inheritance.md) to confirm the current result. After deletion, use the list to confirm whether the role remains available.

## Limitations and notes

Deleting roles or changing their lifecycle or inheritance affects related roles. Before proceeding, use the impact actions and confirm conditions and results on the relevant Reference page.

## Next steps

- [Manage users and user tags](users-tags.md)
- [Configure data privileges](data-privileges.md)
