DELETE
/
api
/
knowledgebases
/
{knowledgebaseId}
/
datasets
/
{datasetId}
Delete Dataset
curl --request DELETE \
  --url https://app.pathors.com/api/knowledgebases/{knowledgebaseId}/datasets/{datasetId} \
  --header 'x-api-key: <x-api-key>'
{
  "message": "<string>"
}
Permanently remove a dataset from a specific knowledgebase, including all associated chunks and embeddings.

Endpoint

DELETE /api/knowledgebases/{knowledgebaseId}/datasets/{datasetId}

Path Parameters

knowledgebaseId
string
required
The unique identifier of the knowledgebase containing the dataset
datasetId
string
required
The unique identifier of the dataset to delete

Headers

x-api-key
string
required
Your project API key for authentication
Example request:
curl -X DELETE \
  -H "x-api-key: your_api_key" \
  https://your-domain.com/api/knowledgebases/kb_abc123/datasets/dataset_xyz789

Response

Returns a success message confirming the deletion.
message
string
Confirmation message that the dataset was deleted successfully
Example response:
{
  "message": "Dataset deleted successfully"
}

Error Responses

Status CodeDescription
400Missing knowledgebase ID or dataset ID
401Invalid API key
403Dataset does not belong to the specified knowledgebase
404Knowledgebase or dataset not found
500Internal server error

Deletion Process

  1. Validation: Verifies the knowledgebase exists and belongs to your project
  2. Dataset Verification: Ensures the dataset exists and belongs to the knowledgebase
  3. Chunk Removal: Deletes all text chunks associated with the dataset
  4. Embedding Cleanup: Removes vector embeddings from the search index
  5. File Deletion: Removes the original uploaded file
  6. Database Cleanup: Removes dataset metadata from the database

Important Notes

Permanent Action

  • This action cannot be undone
  • All chunks and embeddings are permanently removed
  • The original file is also deleted from storage

Search Impact

  • Queries will no longer return results from this dataset
  • Existing search results may be affected immediately
  • Related chunks will no longer appear in search results

Validation

  • The dataset must belong to the specified knowledgebase
  • Cross-validation prevents accidental deletion from wrong knowledgebase
  • API key must have access to the project containing the knowledgebase

Usage Notes

  • Ensure you have backups if you need to preserve the original file
  • Consider the impact on existing applications using this dataset
  • Large datasets may take a moment to fully clean up
  • The operation is atomic - either all cleanup succeeds or nothing is deleted

Migration from Old Endpoint

If you’re migrating from the deprecated /api/datasets/{filename} endpoint:
  1. Get your knowledgebase ID using Get Knowledgebases
  2. Get the dataset ID from Get Datasets in Knowledgebase
  3. Update your API calls to use both IDs in the URL path
  4. The response format remains the same