# View object permission view

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

View the current grants, grant sources, and editability for a specified role on a specified object.

```text
GET https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/iam/permissions/objects/{resource_type}/{resource_id}/permission-view
```

## Preparation before calling

Select the object and role to view.

Prepare a [personal access token](../../../../../guides/genesis/api-keys.md) that can access 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 -X GET "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/iam/permissions/objects/$RESOURCE_TYPE/$RESOURCE_ID/permission-view" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

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

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | string | Yes | Target workspace ID. |
| `resource_type` | string | Yes | Target resource type. |
| `resource_id` | string | Yes | Target resource ID. |

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

## Successful response

On success, returns the object's owner, direct grants, all-scope grants, and the capability sources included in this view. A `false` capability flag means that source is not included in this view; it does not mean that the corresponding grants are empty.

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

```json
{"code":"OK","msg":"OK","data":{"workspace_id":"workspace-001","resource_type":"workflow","resource_id":"workflow-001","owner":{"role_id":"role-owner"},"capabilities":{"owner_included":true,"direct_specific_grants_included":true,"all_scope_grants_included":true},"direct_grants":[],"all_scope_grants":[],"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.workspace_id` | string | Workspace ID that contains the object. |
| `data.resource_type` | string | Object resource type. |
| `data.resource_id` | string | Object resource ID. |
| `data.owner` | object | Object's direct owner and ownership version. |
| `data.capabilities` | object | Flags for data sources included in this permission view. |
| `data.direct_grants` | object array | Grants that directly apply to this object. |
| `data.all_scope_grants` | object array | All-scope grants that cover this object. |
| `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":"Invalid request parameters","data":null}
```

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

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

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

## Next steps

### Confirm object grant state

Before validating or applying object grants, confirm the current grant state for the object and role, and prepare changes based on the editability information returned by this page.
