Bulk delete files
const url = 'https://firma.company-gpt.com/companygpt/rag/api/files/bulk-delete';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"fileIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"status":"pending","collectionIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"search":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://firma.company-gpt.com/companygpt/rag/api/files/bulk-delete \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "fileIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "status": "pending", "collectionIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "search": "example" }'Delete many files in one request — either an explicit list of file IDs (multiselect, max 100) or all files matching a status filter plus optional collectionIds/search refinements (max 500 per request; repeat the call for the remainder). Deletion permission matches single file delete: write access to the collection AND being its owner or having the admin role; files without a collection require a global admin. Files the caller may not delete are skipped silently. Each file’s embeddings, structured-extraction rows and blob are torn down; individual failures do not abort the operation and are reported via failedCount.
Authorizations
Abschnitt betitelt „Authorizations“Request Bodyrequired
Abschnitt betitelt „Request Bodyrequired“Request for POST /files/bulk-delete (handlers.BulkFileDeleteRequest). Exactly one mode must be used: an explicit fileIds list (max 100), or a status filter with optional collectionIds/search refinements.
object
Responses
Abschnitt betitelt „Responses“Deletion result (may be partial)
Response for POST /files/bulk-delete (handlers.BulkFileDeleteResponse). count is the number of files actually deleted; failedCount counts files whose teardown errored (the operation continues past individual failures). Files the caller may not delete are silently skipped and appear in neither count.
object
Example
{ "status": "deleted"}Invalid body — both or neither mode provided, malformed file ID, or too many fileIds
object
Error message
Examplegenerated
{ "error": "example"}Unauthorized
object
Error message
Examplegenerated
{ "error": "example"}Access denied — caller has no collection with owner/admin deletion rights
object
Error message
Examplegenerated
{ "error": "example"}