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.

Not yet available to API tokens

This endpoint currently requires session authentication; Personal Access Token scope support is in progress.

Request body:

  • items (required, array, min:1) — list of extractions to delete
  • items.*.type (required, string, in:customer_po,supplier_invoice,vendor_credit,landed_cost_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 the API::deleteExtraction, supplier_invoice to the API::deleteExtraction, vendor_credit to the API::deleteExtraction, and landed_cost_invoice to the API::deleteExtraction (deletes the S3 file and soft-deletes the extraction row)
  • All managers delete the S3 file (if any) and the DB record (vendor credit deletes skip the S3 delete when the file belongs to an attachment on an existing credit)
  • 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