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://api.moi.matrixorigin.cn/v5/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://api.moi.matrixorigin.cn/v5/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

After a successful request, the target knowledge base no longer exists. Deletion is idempotent: a target that is already absent also returns success. code: "OK" and data.deleted: true indicate that the deletion request completed; this result does not count how many existing knowledge bases the request removed.

{
  "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 deletion request completed, including when the target was already absent.

Error response

A knowledge base ID that is not a positive integer returns HTTP 400 and ErrParamInvalid.

{
  "code": "ErrParamInvalid",
  "msg": "invalid model id",
  "data": null
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

400

ErrParamInvalid

model_id is not a positive 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.

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