Zum Inhalt springen

Bulk delete files

POST
/files/bulk-delete
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.

Media typeapplication/json

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
fileIds
Array<string>
<= 100 items
status
string
Allowed values: pending indexed indexed_with_warning failed
collectionIds
Array<string>
search
string

Deletion result (may be partial)

Media typeapplication/json

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
status
required
string
count
required
integer
failedCount
required
integer
Example
{
"status": "deleted"
}

Invalid body — both or neither mode provided, malformed file ID, or too many fileIds

Media typeapplication/json
object
error
required

Error message

string
Examplegenerated
{
"error": "example"
}

Unauthorized

Media typeapplication/json
object
error
required

Error message

string
Examplegenerated
{
"error": "example"
}

Access denied — caller has no collection with owner/admin deletion rights

Media typeapplication/json
object
error
required

Error message

string
Examplegenerated
{
"error": "example"
}