WinShopAPI docs
ReferenceDocumentsStock taking

Stock takings

Create a stock taking

Creates a stock taking from the header and any items in the body, and returns the stored document. Reserves the next internal document number. Requires `Permissions.StockTakings.Create`.

Get a stock taking

Returns one stock taking by `documentId`, with its header, items and item variants. Requires `Permissions.StockTakings.View`.

Delete a stock taking

Deletes the stock taking together with its items and item variants. Cannot be undone. Call `GET {documentId}/check-delete` first to find out whether the delete is allowed. Requires `Permissions.StockTakings.Delete`.

Update a stock taking

Updates the stock taking header and the items sent in the body. Pass `removeItemsNotInRequest=true` to also delete the items the body leaves out. Requires `Permissions.StockTakings.Update`.

Check whether a stock taking can be deleted

Advisory pre-flight for `DELETE {documentId}`. `canBeDeleted` is false when `blockingReasons` holds `HEADER_BLOCKED` or `ITEMS_BLOCKED`. The delete re-checks inside its own transaction, so a positive answer here is an indication rather than a guarantee. Requires `Permissions.StockTakings.Delete`.

Add items to a stock taking

Appends the items in the body to an existing stock taking and recalculates the document totals. Requires `Permissions.StockTakings.Create`.

Delete stock taking items

Deletes the items listed in `itemIds` and recalculates the document totals. Call `GET {documentId}/items/check-delete` first to find out whether the delete is allowed. Requires `Permissions.StockTakings.Delete`.

Check whether stock taking items can be deleted

Advisory pre-flight for `DELETE {documentId}/items`. `blockingReasons` holds `ITEMS_BLOCKED` when at least one id in `itemIds` is still referenced elsewhere. At most 1000 ids per call. Requires `Permissions.StockTakings.Delete`.

Update a stock taking item

Replaces one item of the stock taking, identified by `itemId`, and recalculates the document totals. Requires `Permissions.StockTakings.Update`.

Delete a stock taking item variant

Deletes one variant row (a size/colour breakdown) of an item and recalculates the document totals. Call the matching `check-delete` endpoint first to find out whether the delete is allowed. Requires `Permissions.StockTakings.Delete`.

Check whether an item variant can be deleted

Advisory pre-flight for `DELETE {documentId}/items/{itemId}/variants/{variantId}`. `blockingReasons` holds `ITEM_VARIANT_BLOCKED` when the variant is still referenced elsewhere. Requires `Permissions.StockTakings.Delete`.

Get the lock state of a stock taking

Returns whether the stock taking is locked against concurrent edits and, when it is, the name of the user holding the lock. Requires `Permissions.StockTakings.View`.

Lock a stock taking

Locks the stock taking for the calling user so other users cannot edit or process it. Returns 400 when it is already locked. Release it with `DELETE {documentId}/lock`. Requires `Permissions.StockTakings.Update`.

Unlock a stock taking

Releases the lock on the stock taking. Returns 400 when the lock belongs to another user. Requires `Permissions.StockTakings.Update`.