Skip to main content

Check Product Deletability

POST 

/api/products/is-deletable

Check whether one or more products can be safely deleted. Returns deletability status with reasons and usage record samples for each product.

Required scope: products:write

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

Authentication: Requires Bearer token.

Fields:

  • ids (required): array of product IDs (integers, must exist in DB)

For each product, returns:

  • deletable: true if safe to delete
  • reason: human-readable reason if not deletable
  • usages: array of blocking usage types, each with: relation, label, count, message, and sample records

Usage relations include: salesOrderLines, bundleSalesOrderLines, purchaseOrderLines, inventoryMovements, fifoLayers, inventoryAdjustments, inventoryAssemblyLines, warehouseTransferLines, returnReceiptLines, rmaLines, salesCreditLines, blemishedProducts, inboundShipmentLines, and subscriptionEditions (each is a RESTRICT foreign key, so any referencing row blocks deletion; product variations are checked too, so a matrix parent is reported not deletable when any of its variants is referenced). bundleSalesOrderLines appears when the product was sold as a bundle parent (referenced via sales_order_lines.bundle_id, a RESTRICT foreign key); such bundles are reported as not deletable so they can be archived instead.

Request

Responses

OK

Response Headers
    Content-Type