Update agent knowledge base metadata¶
Updates the knowledge base metadata that the agent can reference, and does not perform file parsing or indexing.
To create a knowledge base in the resource center to which files and data tables can be added, use Create an empty knowledge base.
PATCH $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/knowledge-bases/{knowledge_base_id}
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First query agentknowledge base details to confirm the current metadata and version. Prepare a personal access token and target workspace ID that can access the target workspace.
Request body¶
curl -X PATCH "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/knowledge-bases/$KNOWLEDGE_BASE_ID" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"name": "产品文档(已审核)",
"status": "active",
"index_status": "ready",
"tags": ["产品", "文档", "已审核"]
}'
Each successful update will increment version by one.
Path parameters
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
The current workspace ID must be consistent with X-Workspace-ID. |
|
string |
Yes |
The knowledge base ID to be updated. |
Request body
When updating, omit the field or fill in null to retain the original value. It will be cleared when {} is filled in the object field, and it will be cleared when [] is filled in the array field. This rule also applies to tags and asset references.
The most recent index time passed to null will not be cleared. An empty string resets status, source, visible range, and index status to creation defaults. The update does not supplement the creation of dedicated default tool references. An empty update also increments the version and does not check whether the old version has changed.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
New name. It must be non-empty after removing the leading and trailing blanks, and the UTF-8 encoding cannot exceed 128 bytes. |
|
string |
No |
New description, the length cannot exceed 4096. |
|
string |
No |
draft, active, disabled or archived. |
|
string |
No |
manual, catalog_resource, file_collection, external_drive or connector_export. |
|
array of object |
No |
Replaces all associated assets. Each item must provide a type and at least an id or uri. |
|
string |
No |
Configuration references are retrieved by default. |
|
array of string |
No |
Replace all tags. |
|
string |
No |
Update owner user ID. |
|
string |
No |
private or workspace. |
|
string |
No |
empty, indexing, ready or failed. |
|
string |
No |
The most recent index time, in RFC 3339 format. |
|
string |
No |
Recent index error information, the length cannot exceed 4096. |
|
object |
No |
Replace string key-value label. |
|
object |
No |
Replace string key-value annotation. |
|
object |
No |
Replace extended metadata. Cannot contain keys, provider runtime information, or session references. |
The name can contain /, for example 产品文档/安装指南. / is saved as the name content. When querying and updating knowledge base metadata, use the returned data.id as knowledge_base_id. The associated Catalog asset is specified by catalog_asset_refs.
The existing name is retained when name is omitted or null is passed in. Passing in an empty string or a name containing only whitespace returns 400.
Successful response¶
{
"code": 0,
"data": {
"id": "kb_01",
"workspace_id": "ws_01",
"name": "产品文档(已审核)",
"status": "active",
"source_type": "catalog_resource",
"visibility": "workspace",
"index_status": "ready",
"version": 2,
"updated_by": "user_01",
"updated_at": "2026-08-18T02:00:00Z",
"created_at": "2026-01-15T10:00:00Z"
}
}
Returns 200 on success. data is the updated knowledge base metadata, data.version is increased by 1 than before the update.
Field |
Type |
Description |
|---|---|---|
|
integer |
0 on success. |
|
string |
knowledge base ID. |
|
string |
The workspace ID to which it belongs. |
|
string |
Updated name and description. Does not return if description is not set. |
|
string |
Updated name and description. Does not return if description is not set. |
|
string |
Updated status and source type. |
|
string |
Updated status and source type. |
|
array of object |
Related assets. Does not return if not set. |
|
string |
Configuration references are retrieved by default. Does not return if not set. |
|
array of string |
label. Does not return if not set. |
|
string |
Owner user ID. Does not return if not set. |
|
string |
Visible range and index status. |
|
string |
Visible range and index status. |
|
string |
Last index time and error message. Does not return if not set. |
|
string |
Last index time and error message. Does not return if not set. |
|
integer |
Updated resource version. |
|
object |
Extended tags, annotations and metadata. Does not return if not set. |
|
object |
Extended tags, annotations and metadata. Does not return if not set. |
|
object |
Extended tags, annotations and metadata. Does not return if not set. |
|
string |
Creator and last updated ID. Does not return if not set. |
|
string |
Creator and last updated ID. Does not return if not set. |
|
string |
Creation and last update times, in RFC 3339 format. |
|
string |
Creation and last update times, in RFC 3339 format. |
Error response¶
{
"code": 2,
"message": "invalid knowledge base metadata"
}
Common HTTP errors¶
HTTP status |
Error code |
Common cause |
Recommended action |
|---|---|---|---|
400 |
|
Invalid request field, workspace, or operation precondition. |
Fix the request parameters and submit again. |
401 |
|
Missing or invalid authentication credentials. |
Check the credential type, expiration, and authentication header. |
403 |
|
The current identity or active role does not have permission for this operation. |
Use an authorized identity or contact an administrator to grant access. |
404 |
|
The target object or required reference was not found. |
Verify the object identifier, workspace, and current status. |
409 |
|
Conflict in resource state, request payload, or concurrent modification. |
Re-read the current state and version, then handle according to the latest result. |
503 |
|
A business, runtime, or authorization dependency is temporarily unavailable. |
After the dependency recovers, check existing results first instead of blindly repeating writes. |