# View data privileges

View a role's current data-access privileges, their sources, and editability, to assess or adjust grants.

```text
GET $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/iam/roles/{role_id}/data-privileges
```

## Before you call this API

Configure the [regional API endpoint and authentication](https://omnifabric.cloudsigma.com/docs/developer/endpoints-and-authentication.html.md), and select the target workspace.

First [select a role](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/users-and-permissions/roles/list-roles.html.md#select-a-role).

## Request parameters

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

```bash
curl -X GET "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/iam/roles/$ROLE_ID/data-privileges" -H "X-API-Key: $CLOUDSIGMA_API_KEY" -H "X-Workspace-ID: $WORKSPACE_ID"
```

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

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

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

## Successful response

Returns the role's current data-privilege view, including direct and inherited privileges, OmniFabric privilege facts, and editability.

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

```json
{"code":"OK","msg":"OK","data":{"target_role_id":"role-001","data_privilege_version":2,"matrixone_fact_version":"fact-v2","items":[],"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.target_role_id` | string | Role ID being viewed. |
| `data.data_privilege_version` | integer | Current data-privilege version; submit it as the expected version when updating. |
| `data.matrixone_fact_version` | string | OmniFabric privilege fact version. |
| `data.items` | object array | Role's data-privilege items. |
| `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 current data privileges

Before validating or applying data privileges, confirm the role's current data access and prepare changes from the grant state read on this page.
