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.
products:writeGrant 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
filtersinstead ofids - 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
- 200
- 401
- 403
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Validation failed — the body is a field → messages map (Laravel shape) or the platform envelope with a stable machine-readable code. Fix the payload and resubmit.
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.