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.

HTTP
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

Shell
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

workspace_id

string

Yes

The current workspace ID must be consistent with X-Workspace-ID.

knowledge_base_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

name

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.

description

string

No

New description, the length cannot exceed 4096.

status

string

No

draft, active, disabled or archived.

source_type

string

No

manual, catalog_resource, file_collection, external_drive or connector_export.

catalog_asset_refs

array of object

No

Replaces all associated assets. Each item must provide a type and at least an id or uri.

default_retrieval_profile_ref

string

No

Configuration references are retrieved by default.

tags

array of string

No

Replace all tags.

owner_user_id

string

No

Update owner user ID.

visibility

string

No

private or workspace.

index_status

string

No

empty, indexing, ready or failed.

last_indexed_at

string

No

The most recent index time, in RFC 3339 format.

last_index_error

string

No

Recent index error information, the length cannot exceed 4096.

labels

object

No

Replace string key-value label.

annotations

object

No

Replace string key-value annotation.

metadata

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

JSON
{
  "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

code

integer

0 on success.

data.id

string

knowledge base ID.

data.workspace_id

string

The workspace ID to which it belongs.

data.name

string

Updated name and description. Does not return if description is not set.

data.description

string

Updated name and description. Does not return if description is not set.

data.status

string

Updated status and source type.

data.source_type

string

Updated status and source type.

data.catalog_asset_refs

array of object

Related assets. Does not return if not set.

data.default_retrieval_profile_ref

string

Configuration references are retrieved by default. Does not return if not set.

data.tags

array of string

label. Does not return if not set.

data.owner_user_id

string

Owner user ID. Does not return if not set.

data.visibility

string

Visible range and index status.

data.index_status

string

Visible range and index status.

data.last_indexed_at

string

Last index time and error message. Does not return if not set.

data.last_index_error

string

Last index time and error message. Does not return if not set.

data.version

integer

Updated resource version.

data.labels

object

Extended tags, annotations and metadata. Does not return if not set.

data.annotations

object

Extended tags, annotations and metadata. Does not return if not set.

data.metadata

object

Extended tags, annotations and metadata. Does not return if not set.

data.created_by

string

Creator and last updated ID. Does not return if not set.

data.updated_by

string

Creator and last updated ID. Does not return if not set.

data.created_at

string

Creation and last update times, in RFC 3339 format.

data.updated_at

string

Creation and last update times, in RFC 3339 format.

Error response

JSON
{
  "code": 2,
  "message": "invalid knowledge base metadata"
}

Common HTTP errors

HTTP status

Error code

Common cause

Recommended action

400

2

Invalid request field, workspace, or operation precondition.

Fix the request parameters and submit again.

401

6

Missing or invalid authentication credentials.

Check the credential type, expiration, and authentication header.

403

5

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

3

The target object or required reference was not found.

Verify the object identifier, workspace, and current status.

409

4

Conflict in resource state, request payload, or concurrent modification.

Re-read the current state and version, then handle according to the latest result.

503

15

A business, runtime, or authorization dependency is temporarily unavailable.

After the dependency recovers, check existing results first instead of blindly repeating writes.

Last updated on