Delete a knowledge base document from an AI assistant
Before You Begin
🔗 Use the GraphQL Playground to execute the queries in this guide.
➡️ New to GraphQL? Learn how to navigate the Playground with our Playground Basics Guide.
Prerequisites
- Authentication: Use a Service Account token (Personal Access Tokens are deprecated).
- Permissions: You must be a super admin of the organization.
- Document ID: The
idof the document to delete. See Create Assistant Knowledge Base Document. - Assistant ID: The UUID of the assistant that owns the document.
- Organization UUID: The UUID of the organization that owns the assistant.
Delete an Assistant Knowledge Base Document
Use the deleteAiAssistantKnowledgeBaseDocument mutation to permanently remove a knowledge base document from an assistant. This action cannot be undone.
Inputs
- assistantId: UUID of the assistant that owns the document (required).
- organizationUuid: UUID of the organization that owns the assistant (required).
- documentId: ID of the document to delete (required).
mutation {
deleteAiAssistantKnowledgeBaseDocument(
input: {
assistantId: "assistant-uuid-123"
organizationUuid: "org-uuid-456"
documentId: "doc-uuid-789"
}
) {
success
errors
}
}
Response:
{
"data": {
"deleteAiAssistantKnowledgeBaseDocument": {
"success": true,
"errors": []
}
}
}
Response explained
- success:
truewhen the document was deleted successfully. - errors: Empty array on success. Contains error messages if the operation failed.
Error handling
If the deletion fails (e.g., permission denied or organization not found), you'll receive an error response:
{
"data": {
"deleteAiAssistantKnowledgeBaseDocument": null
},
"errors": [
{
"message": "Permission denied",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": ["deleteAiAssistantKnowledgeBaseDocument"]
}
]
}
Error response explained
- data.deleteAiAssistantKnowledgeBaseDocument: Returns
nullwhen the operation fails. - errors: Array containing error details when the operation fails.
- errors[].message: Human-readable error description. Common messages:
"Permission denied"— the authenticated user is not a super admin of the organization."Organization not found with id: <uuid>"— theorganizationUuiddoes not match an existing organization.
Tips
- Irreversible: Deletion is permanent. Re-upload and re-create the document if needed.
- Assistant scope: This mutation works with any assistant regardless of which channel it is connected to (portal, Slack, pipe, etc.).
- Finding your document ID: The
idis returned by thecreateAiAssistantKnowledgeBaseDocumentmutation. See Create Assistant Knowledge Base Document.
