To delete a file from the Library by providing its unique `file_id`
DELETEhttps://api.knowbase.ai/api/v1/delete
Headers
Name
Type
Description
access-token*
string
Required. Your API access token
Request Body
Name
Type
Description
file_id*
string
The ID of the file to summarize
{
"message": "string"
}
{
"detail": "string"
}
{
"error": "string"
}
Example usage
import requests
import json
# The URL for the delete endpoint
url = 'https://api.knowbase.ai/api/v1/delete'
# Replace 'your_access_token_here' with the actual access token you received from the API
headers = {
'access-token': 'your_access_token_here',
'Content-Type': 'application/json' # Specify the content type as JSON
}
# Replace 'your_file_id_here' with the actual file ID you want to delete
data = {
'file_id': 'your_file_id_here'
}
# Make the DELETE request to delete the file
response = requests.delete(url, headers=headers, data=json.dumps(data))
# Check the response
if response.status_code == 200:
print("File deleted successfully.")
print(response.json()) # This will print the success message
elif response.status_code == 404:
print("File not found.")
print(response.json()) # This will print the error message
else:
print("Failed to delete file.")
print(response.json()) # This will print the error message