---
orphan: true
---

# Query the Catalog system tree

Query the read-only navigation tree of the system database.

```text
POST https://moi.matrixorigin.cn/newmoi/catalog/system/tree
```

## Preparation before calling

Prepare a personal access token and 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`: Target workspace ID, passed through `X-Workspace-ID` Header.

## Request example

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/system/tree" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "include_table_leaves": false
  }'
```

## Request body

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `include_table_leaves` | boolean | No | Whether to include table leaf nodes in the tree. |

## Successful response

Returns `200` and the system library tree on success.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "tree": [
      {
        "type": "catalog",
        "name": "system",
        "node_list": []
      }
    ]
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `data.tree` | array | System library navigation tree. |
| `data.tree[].type` | string | Node type. |
| `data.tree[].name` | string | Node name. |
| `data.tree[].description` | string | Node description. |
| `data.tree[].node_list` | array | List of child nodes. |
| `data.tree[].allowed_actions` | string[] | Operations allowed by the current identity on this node. |

In this document, `[]` after a type means an array; for example, `string[]` is an array of strings. In field paths, `[]` means each item in an array; for example, `data.tree[].name` is the `name` field of each item in `data.tree`.

## Error response

```json
{
  "code": "ErrServer",
  "msg": "服务器内部错误",
  "data": null
}
```

### Common HTTP errors

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

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `ErrParamInvalid`
  - The request body format is invalid.
  - Check `include_table_leaves`.
* - `403`
  - `ErrForbidden`
  - The current identity does not have permission to read the system tree.
  - Use credentials with read permissions.
* - `500`
  - `ErrServer`
  - The server failed to read the system tree.
  - Try again later.
```
