Delete a batch
Deletes a batch. This is a soft delete: the batch stops appearing in GET /public/v1/batches by default (pass the deleted filter as include or only to still see it) and this endpoint returns 404 for it, but the record is retained — GET /public/v1/batches/{id} keeps resolving it with a non-null deleted_at. The delete cannot be undone through the API; recreating the batch via upsert produces a new batch with a new id. Responds 204 with no body on success, or 404 if no non-deleted batch with that id exists in your company (including one that was already deleted or belongs to another company).
A batch can only be deleted while nothing depends on it. The delete is refused with a 400 when the batch: appears on any sales order or purchase line item, has any returns, appears on any inventory transfer, or is used as an input or output of any assembly. The batch only becomes deletable once no such record references it. Only batches of batch-tracked products can be deleted here — a batch of a product on any other inventory-tracking method is refused with a 400.
A batch may still hold on-hand quantity when it is deleted; that remaining quantity is not adjusted away, but it immediately stops counting as active inventory (it drops out of the batch's and its product's quantity_active and quantity_active_by_location fields, and of the inventory endpoint). No inventory is created, consumed, or released, and nothing is synced to Metrc or BioTrack. A successful delete records a delete entry in the batch's activity log and notifies the relevant users.
Required permission: products_permissions_delete.
Path parameters
ID of the batch to delete, as returned by the list, fetch, and upsert endpoints. An ID that doesn't exist for your company (or was already deleted) returns 404.
Response
No Content
Changes
No recorded changes to this endpoint across all 1 revision of this API.