Delete knowledge base

Deletes the knowledge base and its definitions; the Catalog tables and files containing the source are not deleted. Before deleting, please confirm that the agent, workflow, or application no longer references the knowledge base.

DELETE https://moi.matrixorigin.cn/newmoi/semantic-models/{model_id}

Preparation before calling

First query the knowledge base details and confirm the knowledge base to be deleted. 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: Target workspace ID, passed through X-Workspace-ID Header.

  • $MODEL_ID: ID of the knowledge base to be deleted.

Request example

curl -X DELETE "https://moi.matrixorigin.cn/newmoi/semantic-models/$MODEL_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

Path parameters

Parameters

Type

Description

model_id

integer

The ID of the knowledge base to be deleted.

Successful response

The knowledge base was deleted when code in the response was OK and data.deleted was true.

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "deleted": true
  }
}

The response fields are as follows.

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data.deleted

boolean

true Indicates that the knowledge base deletion request has been completed.

Error response

{
  "code": "ErrNotFound",
  "msg": "resource not found",
  "data": null
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

400

ErrParamInvalid

model_id is not a valid integer.

Use the knowledge base id in the response.

401

ErrUnauthorized

The API Key is invalid or has expired.

Check API Key.

403

ErrForbidden

The caller does not have permission to delete the knowledge base.

Check workspace and object authorization.

404

ErrNotFound

The knowledge base does not exist or is not visible to the current caller.

Relist the knowledge base and confirm the ID.

409

ErrConflict

The service rejects the current delete operation.

Handle the object or state pointed to by the conflict first.

500

ErrServer

The service failed to complete deletion.

Keep the desensitized response information and try again.

Follow-up operations

Query the knowledge base list Confirm that the knowledge base has been removed.

Last updated on