delete_knowledge_base

ArtificialIntelligenceApi.delete_knowledge_base(id, role_id, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Delete a knowledge base

Deletes a knowledge base and associated resources. Fails if it is still attached to any projects. Structured knowledge bases are deleted synchronously; unstructured ones are set to DELETING and removed asynchronously. Requires owner access. No request body.

Parameters:
  • id (str) – Unique identifier of the knowledge base to delete. (required)

  • role_id (str) – Amorphic role ID of the requesting user. Must be a role the authenticated user belongs to. (required)

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

MessageResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: DELETE /ai/knowledgebases/{id}

Parameter examples

Name

In

Example

id

path

"ABCDEFGHIJ"

role_id

header

"custom-role-123e4567-e89b-12d3-a456-426614174000"

Success (HTTP 200)

Structured deletion Message is “Knowledge base deleted successfully”. Unstructured deletion Message is “Knowledge base deletion started successfully”.

Structured knowledge base deleted

{
  "Message": "Knowledge base deleted successfully"
}

Unstructured deletion started

{
  "Message": "Knowledge base deletion started successfully"
}

Errors

Documented error codes: AI-1003, AUTH-1012, AUTH-1001, AUTH-1011, IPV-1002, GE-1085, DB-1002.

HTTP 400

Input validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: AI-1003 (attached to projects or agents), AUTH-1012 (not owner), AUTH-1001 (missing role_id), AUTH-1011 (caller not authorized).

Missing role_id header

{
  "Message": "AUTH-1001 - Missing role information in event header"
}

Caller not authorized

{
  "Message": "AUTH-1011 - User does not have sufficient permission to perform this action"
}

KB attached to projects

{
  "Message": "AI-1003 - The knowledge base is attached to the following projects: ['Demo Project']. Please detach the knowledge base from the projects first to continue deletion."
}

HTTP 404

Knowledge base not found. Body is {“Message”: “<CODE> - <text>”}. Code: IPV-1002.

Knowledge base not found

{
  "Message": "IPV-1002 - Invalid knowledge base - ABCDEFGHIJ, resource not found."
}

HTTP 500

Backend failure. Body is {“Message”: “<CODE> - <text>”}. Codes: GE-1085 (unexpected backend failure), DB-1002 (persistence failure).

Unexpected backend failure

{
  "Message": "GE-1085 - An unexpected error occurred"
}