Skip to main content

Preview Bulk Delete Products

POST 

/api/products/bulk-delete/preview

Count how many products in a selection can be deleted and why the rest can't, without changing anything. Works for any selection size: the response is counts and a few examples per reason, never one row per product.

Required scope: products:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Authentication: Requires Bearer token.

Body fields:

  • ids (array of integers, required unless apply_to_all): the products to include
  • apply_to_all (boolean, optional): true to include every product matching filters instead of ids
  • filters (object, optional): the same filters List Products accepts, without the filter[...] wrapper (e.g. {"ids": "101,102"})
  • delete_returns (boolean, optional, default false): also delete the returns of products kept only because of them. A product whose only history is RMAs and return receipts (and the returned units still in stock) is deleted together with its return receipt lines, which takes those units back out of stock, and its RMA lines. RMAs and receipts left with no lines are deleted; other products' lines and linked sales credits stay. Returns synced to your accounting system or received in the closed period always stay, and so does the product.

Response (data): selected, deletable, blocked (products kept because something still uses them or one of their variations), missing (ids that no longer exist), blocked_groups (one per reason, biggest first, e.g. salesOrderLines, purchaseOrderLines, returnReceiptLines, rmaLines; each product counted once, under its main reason), next_step, delete_returns (whether the counts include deleting returns) and returns: null when no product is kept for its returns, otherwise what the delete_returns option covers: products (kept only for their returns, deleted with the option), protected_products (whose returns must stay), rmas and return_receipts (left empty and deleted), rma_lines, return_receipt_lines, units (returned units taken back out of stock) and blocked_reasons. With delete_returns, products whose returns must stay are grouped under the reason protectedReturns, each item's detail saying why. Each kept group: reason, label, count, message, next_step and items (the first few records: id, label, link, optional detail).

Requires permission: products.delete

Request​

Responses​

OK

Response Headers
    Content-Type