# View grantable resources

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

View resources the current identity can grant. Results are filtered by selected resource type and action and can be used to select a grant target.

```text
GET https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/iam/permissions/resources
```

## Preparation before calling

Determine the resource type and action to grant. Prepare a [personal access token](../../../../../guides/genesis/api-keys.md) with required workspace permissions 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/permissions/resources" -H "X-API-Key: $AI_STUDIO_API_KEY" -H "X-Workspace-ID: $WORKSPACE_ID" --data-urlencode "resource_type=workflow" --data-urlencode "action_id=workflow.read" --data-urlencode "limit=50"
```

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

### Path parameters

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

### Query parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `resource_type` | string | Yes | Resource type to view. |
| `action_id` | string | Yes | Action ID to evaluate. |
| `purpose` | string | No | Calling-scenario identifier. |
| `parent_id` | string | No | View resources only under this parent resource. |
| `q` | string | No | Search by name or path. |
| `cursor` | string | No | Cursor returned by the previous page. |
| `limit` | integer | No | Items per page; default 50, range 1–100. |

When `data.next_cursor` is nonempty, use it as `cursor` in the next request and keep other query parameters unchanged. Stop when `data.next_cursor` is empty.

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

## Successful response

Returns grantable resources and the capability state. If `capability_status` is not `ready`, show the unsupported or temporarily unavailable state indicated by `reason_code`; do not interpret an empty list as no resources.

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

```json
{"code":"OK","msg":"OK","data":{"items":[],"next_cursor":"","capability_status":"ready","reason_code":"","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.items` | object array | Grantable resources on the current page. |
| `data.next_cursor` | string | Cursor for the next page; empty when there is no next page. |
| `data.capability_status` | string | Resource-adapter state: `ready`, `unsupported`, or `unavailable`. |
| `data.reason_code` | string | Reason code when the adapter is unavailable or unsupported. |
| `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 | — |

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