Skip to main content

Bulk Delete Inbox Documents

POST 

/api/document-inbox/bulk-destroy

Bulk-delete a polymorphic mix of OCR extractions from the unified Document Inbox. Powers the bulk-actions toolbar shown when rows are selected in the inbox UI.

Request body:

  • items (required, array, min:1) — list of extractions to delete
  • items.*.type (required, string, in:customer_po,supplier_invoice) — which OCR extraction model the id belongs to
  • items.*.id (required, integer) — extraction ID

Behavior:

  • Validates the entire payload with Laravel validation (returns 422 on shape errors)
  • Iterates each item; routes customer_po to CustomerPOOcrManager::deleteExtraction() and supplier_invoice to SupplierInvoiceOcrManager::deleteExtraction()
  • Both managers delete the S3 file (if any) and the DB record
  • Confirmed extractions are SKIPPED (cannot be deleted — same constraint as the single-record DELETE endpoints)
  • Missing IDs are reported in not_found rather than failing the whole request — partial success is allowed

Response 200:

{
"deleted": 2,
"skipped": [
{ "type": "customer_po", "id": 91, "reason": "confirmed" }
],
"not_found": [],
"message": "2 document(s) deleted successfully. 1 skipped (confirmed)."
}

Request

Responses

Successful response