Delete a file
curl --request DELETE \
--url https://api.qontext.ai/v1/files/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.qontext.ai/v1/files/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.qontext.ai/v1/files/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"type": "https://docs.qontext.ai/errors/invalid-id",
"title": "Invalid id",
"status": 400,
"code": "invalid_id",
"detail": "This id is not in a form this API issues. Use one from an earlier response.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/unauthenticated",
"title": "Unauthenticated",
"status": 401,
"code": "unauthenticated",
"detail": "The API key is missing or not valid.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/forbidden",
"title": "Not permitted",
"status": 403,
"code": "forbidden",
"detail": "This key is not allowed to do that.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/file-not-found",
"title": "File not found",
"status": 404,
"code": "file_not_found",
"detail": "No file with that id, or none this key is allowed to read.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/file-protected",
"title": "File protected",
"status": 409,
"code": "file_protected",
"detail": "This file is protected. Make sure to unprotect the file and its parent folders before deleting it.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/internal-error",
"title": "Internal error",
"status": 500,
"code": "internal_error",
"detail": "An unexpected error occurred.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/service-unavailable",
"title": "Temporarily unavailable",
"status": 503,
"code": "service_unavailable",
"detail": "This workspace is temporarily unavailable.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}Files
Delete a file
Removes the file. Its change history goes with it, so this is not reversible through this API. A protected file, or one inside a protected folder, is refused and nothing is removed. Changes still in review do not block the delete; they are adjudicated against it when accepted.
DELETE
/
v1
/
files
/
{id}
Delete a file
curl --request DELETE \
--url https://api.qontext.ai/v1/files/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.qontext.ai/v1/files/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.qontext.ai/v1/files/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"type": "https://docs.qontext.ai/errors/invalid-id",
"title": "Invalid id",
"status": 400,
"code": "invalid_id",
"detail": "This id is not in a form this API issues. Use one from an earlier response.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/unauthenticated",
"title": "Unauthenticated",
"status": 401,
"code": "unauthenticated",
"detail": "The API key is missing or not valid.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/forbidden",
"title": "Not permitted",
"status": 403,
"code": "forbidden",
"detail": "This key is not allowed to do that.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/file-not-found",
"title": "File not found",
"status": 404,
"code": "file_not_found",
"detail": "No file with that id, or none this key is allowed to read.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/file-protected",
"title": "File protected",
"status": 409,
"code": "file_protected",
"detail": "This file is protected. Make sure to unprotect the file and its parent folders before deleting it.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/internal-error",
"title": "Internal error",
"status": 500,
"code": "internal_error",
"detail": "An unexpected error occurred.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}{
"type": "https://docs.qontext.ai/errors/service-unavailable",
"title": "Temporarily unavailable",
"status": 503,
"code": "service_unavailable",
"detail": "This workspace is temporarily unavailable.",
"requestId": "3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b"
}Authorizations
AuthorizationX-API-Key
Workspace-scoped API key, sent as a bearer token. The recommended header. The workspace is implicit in the key and never appears in a URL.
Path Parameters
The file id, as an earlier response reported it. Always doc_…; a composite id is refused.
Example:
"doc_9f2k1x8b3m7q0v"
Response
Deleted. No body.