Query the knowledge base list¶
Query the knowledge base metadata for the current workspace and filter by status, source, visible scope, index status, owner, or keywords.
GET https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/knowledge-bases
Before you call¶
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 theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed through theX-Workspace-IDHeader and also asworkspace_idin the path.
Request example¶
curl --get "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/knowledge-bases" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
--data-urlencode "status=active" \
--data-urlencode "index_status=ready" \
--data-urlencode "query=产品" \
--data-urlencode "limit=20"
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Current workspace ID, must be consistent with |
Query parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
No |
Filter by knowledge base status. |
|
string |
No |
Filter by source type. |
|
string |
No |
Filter by visible range. |
|
string |
No |
Filter by index status. |
|
string |
No |
Filter by owner user ID. |
|
string |
No |
Filter by keyword. |
|
integer |
No |
Single return quantity. |
|
integer |
No |
Returns the offset. |
Successful response¶
Returns 200 on success. data.items is the knowledge base of this page, and data.total is the total number of filtered results.
{
"code": 0,
"data": {
"items": [
{
"id": "kb_01",
"workspace_id": "ws_01",
"name": "产品文档",
"status": "active",
"source_type": "catalog_resource",
"visibility": "workspace",
"index_status": "ready",
"version": 1,
"created_at": "2026-08-18T01:00:00Z",
"updated_at": "2026-08-18T01:00:00Z"
}
],
"total": 1,
"limit": 20,
"offset": 0
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
object[] |
Knowledge base list on this page. |
|
string |
Knowledge base ID. |
|
string |
ID of the workspace to which it belongs. |
|
string |
Name and description; will not be returned if no description is set. |
|
string |
Name and description; will not be returned if no description is set. |
|
string |
Knowledge base status and source type. |
|
string |
Knowledge base status and source type. |
|
object[] |
Associated assets; not returned if not set. Each item can contain |
|
string |
Default retrieval configuration reference; does not return if not set. |
|
string[] |
Label; does not return if not set. |
|
string |
Owner user ID; not returned if not set. |
|
string |
Visible range and index status. |
|
string |
Visible range and index status. |
|
string |
Recent index time and error message; not returned if not set. |
|
string |
Recent index time and error message; not returned if not set. |
|
integer |
Resource version. |
|
object |
Extended tags, comments, and metadata; not returned if not set. |
|
object |
Extended tags, comments, and metadata; not returned if not set. |
|
object |
Extended tags, comments, and metadata; not returned if not set. |
|
string |
Creator and last updater ID; not returned if not set. |
|
string |
Creator and last updater ID; not returned if not set. |
|
string |
Creation and last update times, in RFC 3339 format. |
|
string |
Creation and last update times, in RFC 3339 format. |
|
integer |
The total number of knowledge bases that meet the filter conditions. |
|
integer |
The paging value actually used this time. |
|
integer |
The paging value actually used this time. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Error response¶
{
"code": 2,
"message": "invalid knowledge base metadata"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
|
Check filter parameters and do not use path separators in IDs. |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The knowledge base service is temporarily unavailable. |
Try again later. |
Follow-up operations¶
Use data.items[].id to call Query knowledge base details.