Query knowledge base tags

Reading the current workspace can read the tag statistics of the knowledge base.

GET https://api.moi.matrixorigin.cn/v5/semantic-models/tags

Preparation before calling

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 the X-API-Key Header.

  • $WORKSPACE_ID: The workspace ID to be queried is passed through the X-Workspace-ID Header.

Request example

curl "https://api.moi.matrixorigin.cn/v5/semantic-models/tags?search=product" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

Query parameters

Parameter

Type

Required

Description

search

string

No

Only count knowledge base tags that match the search criteria.

Successful response

Returns 200 on success. data.items is the label statistics list.

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "items": [
      {
        "tag": "product",
        "count": 3
      },
      {
        "tag": "support",
        "count": 1
      }
    ]
  }
}

The response fields are as follows.

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data.items

array of object

Tag statistics list; if there is no tag, it is an empty array.

data.items[].tag

string

Tag name.

data.items[].count

integer

The number of knowledge bases with this tag that can be read by the current caller.

In field paths, [] means each item in an array. For example, data.items[].tag is the tag field of each item in data.items.

Error response

{
  "code": "ErrForbidden",
  "msg": "permission denied",
  "data": null
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

401

ErrUnauthorized

The API Key is invalid or has expired.

Check API Key.

403

ErrForbidden

The caller does not have permission to read the knowledge base collection.

Check workspace and object authorization.

500

ErrServer

The service failed to complete tag aggregation.

Keep the desensitized response information and try again.

Follow-up operations

Filter by tag Query the knowledge base list.

Last updated on