# View role ownership impact

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

View resource ownership held by a specified role before changing or deleting it.

```text
GET https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/iam/roles/{role_id}/ownership-impact
```

## Preparation before calling

First [select the role](list-roles.md#select-a-role). Prepare a personal access token with access to the target workspace and the [target workspace ID](../../../../../guides/ai-studio/resource-center/workspace.md#copy-a-workspace-id).

## Request parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Input example

```bash
curl -G "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/iam/roles/$ROLE_ID/ownership-impact" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  --data-urlencode "resource_type=workflow"
```

:::::
:::::{tab-item} Parameter description

### Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| workspace_id | string | Yes | Target workspace ID. |
| role_id | string | Yes | Target role ID. |

### Query parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| resource_type | string | No | Counts ownership only for the specified resource type. |

:::::
::::::
:::::::

## Successful response

On success, returns active ownership counts, counts by resource type, and sample resources. This API does not support directly deleting or transferring ownership.

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{"code":"OK","msg":"OK","data":{"workspace_id":"workspace-001","role_id":"role-001","owned_count":1,"by_type":[{"resource_type":"workflow","count":1}],"items":[],"ownership_version":"ownership-v1","can_delete":false,"blocked_reason":"ACTIVE_OWNERSHIP","transfer_supported":false,"role_graph_version":"graph-v1","lifecycle_version":"3","request_id":"req-001","trace_id":"trace-001"}}
```

:::::
:::::{tab-item} Field details

| Field | Type | Description |
| --- | --- | --- |
| code | string | `OK` on success. |
| msg | string | `OK` on success. |
| data.role_id | string | Assessed role ID. |
| data.owned_count | integer | Number of active ownerships held by the role. |
| data.by_type | object[] | Ownership counts by resource type. |
| data.items | object[] | Sample owned resources. |
| data.ownership_version | string | Ownership facts version. |
| data.can_delete | boolean | Always `false` currently. |
| data.blocked_reason | string | Reason deletion is not allowed. |
| data.transfer_supported | boolean | Always `false` currently. |
| data.role_graph_version | string | Role graph version. |
| data.lifecycle_version | string | Role lifecycle version. |
| data.request_id | string | Request correlation ID. |
| data.trace_id | string | Trace ID. |

:::::
::::::
:::::::

## Error response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{"code":"ErrParamInvalid","msg":"请求参数无效","data":null}
```

:::::
:::::{tab-item} Field details

| Field | Type | Description |
| --- | --- | --- |
| code | string | Error code. |
| msg | string | Error message. |
| data | null | — |

:::::
::::::
:::::::
