# Query the running policy list

Query the running policy configuration in the workspace.

```text
GET https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/runtime-policy-profiles
```

## Preparation before calling

Prepare a personal access token and target workspace ID that has access to the target workspace.

The example below uses:

- `$AI_STUDIO_API_KEY`: The actual personal access token, passed through the `X-API-Key` Header.
- `$WORKSPACE_ID`: The workspace ID to be queried, passed through the `X-Workspace-ID` Header, and as `workspace_id` in the path.

## Request example

```bash
curl "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/runtime-policy-profiles?limit=20" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Path parameters

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `workspace_id` | string | Yes | Current workspace ID, must be consistent with `X-Workspace-ID`. |

## Query parameters

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `status` | string | No | Filter by policy status. |
| `scope_type` | string | No | Filter by scope type. |
| `scope_ref` | string | No | Filter by scope reference. |
| `query` | string | No | Query by name or related text. |
| `limit` | integer | No | Returns the upper limit of quantity. |
| `offset` | integer | No | Returns the offset. |

## Successful response

Returns `200` on success. `data.items` is the policy list, `data.total`, `data.limit` and `data.offset` describe the list range.

```json
{
  "code": 0,
  "data": {
    "items": [
      {
        "id": "policy_01",
        "name": "默认运行限制",
        "status": "active",
        "scope_type": "workspace",
        "version": 1
      }
    ],
    "total": 1,
    "limit": 20,
    "offset": 0
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | `0` on success. |
| `data.items[]` | array | Run policy list. |
| `data.items[].id` | string | Run policy ID. |
| `data.items[].name` | string | Policy name and status. |
| `data.items[].status` | string | Policy name and status. |
| `data.items[].scope_type` | string | Scope types and references. |
| `data.items[].scope_ref` | string | Scope types and references. |
| `data.items[].version` | integer | Policy version. |
| `data.total` | integer | The total number of filter results, the current return upper limit and offset. |
| `data.limit` | integer | The total number of filter results, the current return upper limit and offset. |
| `data.offset` | integer | The total number of filter results, the current return upper limit and offset. |

`[]` after a type denotes an array. `[]` in a field path denotes each item in an array.

## Error response

```json
{
  "code": 2,
  "message": "运行策略参数无效"
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `2`（`INVALID_ARGUMENT`）
  - Invalid workspace or filter parameters.
  - Check path and query parameters.
* - `401`
  - `6`（`UNAUTHENTICATED`）
  - Credentials are missing or invalid.
  - Check API Key.
* - `403`
  - `5`（`PERMISSION_DENIED`）
  - The current identity does not have read permission.
  - Use valid credentials, or contact your administrator for authorization.
* - `503`
  - `15`（`UNAVAILABLE`）
  - The running policy service is unavailable.
  - Try again later.
```

## Follow-up operations

Use policy ID [Query the details of the running strategy](get-runtime-policy-profile.md).
