Query the knowledge base list

Query the knowledge base metadata of the current workspace and filter by status, source, visible range, index status, owner or keywords.

HTTP
GET $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/knowledge-bases

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. Prepare a personal access token and target workspace ID that can access the target workspace.

Request parameters

Shell
curl --get "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/knowledge-bases" \
  -H "X-API-Key: $CLOUDSIGMA_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

Field

Type

Required

Description

workspace_id

string

Yes

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

Query parameters

Field

Type

Required

Description

status

string

No

status. Allowed: draft, active, disabled, archived.

source_type

string

No

Source type. Allowed: manual, catalog_resource, file_collection, external_drive, connector_export.

visibility

string

No

Visible range. Allowed: private, workspace.

index_status

string

No

Index status. Allowed: empty, indexing, ready, failed.

owner_user_id

string

No

Filter by owner user ID.

query

string

No

Filter by keyword.

limit

integer

No

Single return quantity. When it is not provided or is less than or equal to 0, it is 50, and the maximum is 200.

offset

integer

No

Returns the offset. 0 when not provided or less than 0.

Status, source, visible range, and index status are stripped of leading and trailing whitespace and converted to lowercase. query does case-insensitive literal inclusion matching by name and description, % and _ are not used as wildcards. The results are sorted by update time in descending order and ID in ascending order.

Successful response

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

Returns 200 on success. data.items is the knowledge base of this page, and data.total is the total number of filtered results. When there is no match, data.items returns [].

Field

Type

Description

code

integer

0 on success.

data.items

array or null

List of knowledge bases on this page. May be null when there is no match.

data.total

integer

The total number of knowledge bases that meet the filter conditions.

data.limit

integer

The paging value actually used this time.

data.offset

integer

The paging value actually used this time.

data.items[].id

string

knowledge base ID.

data.items[].workspace_id

string

The workspace ID to which it belongs.

data.items[].name

string

Name and description. Does not return if description is not set.

data.items[].description

string

Name and description. Does not return if description is not set.

data.items[].status

string

knowledge base status and source type.

data.items[].source_type

string

knowledge base status and source type.

data.items[].catalog_asset_refs

array

Related assets. Does not return if not set. For member description, see Create the associated asset field in the knowledge base.

data.items[].default_retrieval_profile_ref

string

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

data.items[].tags

array of string

label. Does not return if not set.

data.items[].owner_user_id

string

Owner user ID. Does not return if not set.

data.items[].visibility

string

Visible range and index status.

data.items[].index_status

string

Visible range and index status.

data.items[].last_indexed_at

string

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

data.items[].last_index_error

string

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

data.items[].version

integer

Resource version.

data.items[].labels

object

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

data.items[].annotations

object

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

data.items[].metadata

object

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

data.items[].created_by

string

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

data.items[].updated_by

string

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

data.items[].created_at

string

Creation and last update times, in RFC 3339 format.

data.items[].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