Warehouse Batches
Add Warehouse Batch
post /sites/{siteid}/warehouses/{warehouseid}/warehousebatches.jsonSite ID. (Use eshopid of the site for this parameter).
Warehouse ID.
{ "transactiontype": 50, "emailowner": "info@example.com", "comment": "New Stocktaking"}2| HTTP Status Code Summary | |
|---|---|
| 200 | Returns warehousebatchid |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 404 | The specified resource was not found. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Get Warehouse Batches
get /sites/{siteid}/warehouses/{warehouseid}/warehousebatches.jsonFilter on transaction type. Accepts either a single TransactionType enum value (e.g. 10) or a comma-separated list (e.g. 10,50,60). When omitted, no filter is applied and every transactiontype is returned, including cycle counts (60).
Filter on batch state. Accepts either a single WarehouseBatchState enum value (e.g. 10) or a comma-separated list (e.g. 10,20). Defaults to 10 (Open) when omitted.
Filter on show stock flag.
Free-text search across the warehouse batch's textual fields (e.g. name, comment,
instructions, emailowner, externalid, reasoncode). The value is split on whitespace
and each token must match at least one searchable field (case-insensitive substring match).
Filter on warehousebatches with datestart starting from the timestamp provided.
Filter on warehousebatches with datestart up to and including the timestamp provided.
Filter on warehousebatches with dateend starting from the timestamp provided.
Filter on warehousebatches with dateend up to and including the timestamp provided.
The index of the item to start from. Used for pagination.
Number of items to return.
Comma separated list of fields to return. Use this to query only the fields you are using. See WarehouseBatch object for all fields. Pass fields= to opt-in to additional fields available on warehousebatch (e.g. name, instructions, showstock, datestart, dateend, dateclosed, closedbyuserid).
Site ID. (Use eshopid of the site for this parameter).
Warehouse ID.
{ "totalcount": 1, "items": [ { "warehousebatchid": 1, "warehouseid": 1, "warehousetransactionid": null, "transactiontype": 10, "datecreated": 1463124692, "warehousebatchstate": 10, "emailowner": "", "comment": "", "shipmentid": null, "externalid": null, "reasoncode": null } ]}| HTTP Status Code Summary | |
|---|---|
| 200 | Returns an envelope with items of type warehousebatch for a warehouse. |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 404 | The specified resource was not found. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Get Warehouse Batch
get /sites/{siteid}/warehouses/{warehouseid}/warehousebatches/{warehousebatchid}.jsonSite ID. (Use eshopid of the site for this parameter).
Warehouse ID.
Warehouse Batch ID.
{ "warehousebatchid": 2, "warehouseid": 1, "warehousetransactionid": null, "transactiontype": 50, "datecreated": 1550669775, "warehousebatchstate": 10, "emailowner": "info@example.com", "comment": "New Stocktaking", "shipmentid": null, "externalid": null, "reasoncode": null}| HTTP Status Code Summary | |
|---|---|
| 200 | Returns an item of type warehousebatch. |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 404 | The specified resource was not found. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Update Warehouse Batch
put /sites/{siteid}/warehouses/{warehouseid}/warehousebatches/{warehousebatchid}.jsonNote! Changing the warehousebatchstate from 10 (Open) to 20 (Closed) will trigger the commit of a
transaction for the batch items.
The fields name, instructions, showstock, datestart and dateend can only be updated when
the batch's transactiontype is 60 (cycle count). When updating, name must be a non-empty string
and datestart must be less than or equal to dateend.
Site ID. (Use eshopid of the site for this parameter).
Warehouse ID.
Warehouse Batch ID.
{ "warehousebatchstate": 20, "emailowner": "info@example.com", "comment": "Stocktaking has been completed!"}true| HTTP Status Code Summary | |
|---|---|
| 200 | Successful. Returns true. |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 404 | The specified resource was not found. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Get Warehouse Batch Items
get /sites/{siteid}/warehouses/{warehouseid}/warehousebatches/{warehousebatchid}/warehousebatchitems.jsonThe index of the item to start from. Used for pagination.
Number of items to return.
Filter on items with datelaststocktaking starting from the timestamp provided.
Filter on items with datelaststocktaking up to and including the timestamp provided.
Filter on whether the warehousebatchitem is in scope for the batch. Use true to return only in-scope items, false to return only out-of-scope items. Cycle-count batches only (transactiontype=60); ignored on other batch types.
Comma separated sort fields. Prefix a field with - to reverse direction.
Supported: warehousebatchitemid, datemodified, datelaststocktaking, inscope
(inscope on cycle-count batches only; the sort key is ignored on other batch types).
Default: warehousebatchitemid.
Comma separated list of fields to return. Use this to query only the fields you are using. See WarehouseBatchItem object for all fields. Pass fields= to opt-in to additional fields available on warehousebatchitem (e.g. datelaststocktaking, inscope).
Site ID. (Use eshopid of the site for this parameter).
Warehouse ID.
Warehouse Batch ID.
Returns an envelope with items of type warehousebatchitem for a warehousebatch.
{ "totalcount": 2, "items": [ { "warehousebatchitemid": 1, "warehousebatchid": 1, "warehouseitemid": 3, "datemodified": 1463131430, "decimalquantity": "25.000", "moneypricein": "3920.00", "emailowner": "info@example.com", "comment": null, "sku": "10038-1" }, { "warehousebatchitemid": 2, "warehousebatchid": 1, "warehouseitemid": 5, "datemodified": 1463131443, "decimalquantity": "5.000", "moneypricein": "3920.00", "emailowner": "info@example.com", "comment": null, "sku": "10038-2" } ]}| HTTP Status Code Summary | |
|---|---|
| 200 | Returns an envelope with items of type warehousebatchitem for a warehousebatch. |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 404 | The specified resource was not found. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Batch Set Warehouse Batch Items
put /sites/{siteid}/warehouses/{warehouseid}/warehousebatches/{warehousebatchid}/warehousebatchitems.jsonSite ID. (Use eshopid of the site for this parameter).
Warehouse ID.
Warehouse Batch ID.
[ { "sku": "10038-1", "decimalquantity": "9.000", "emailowner": "info@example.com", "comment": "1 missing" }, { "sku": "10038-2", "decimalquantity": "2.000", "emailowner": "info@example.com", "comment": "" }, { "sku": "10038-3", "decimalquantity": "1.000" }][ { "statuscode": 200, "return": true }, { "statuscode": 200, "return": true }, { "statuscode": 200, "return": true }]| HTTP Status Code Summary | |
|---|---|
| 200 | Returns true or a batch envelope if multiple warehousebatchitems were set |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 404 | The specified resource was not found. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Batch Delete Warehouse Batch Items
delete /sites/{siteid}/warehouses/{warehouseid}/warehousebatches/{warehousebatchid}/warehousebatchitems.jsonSite ID. (Use eshopid of the site for this parameter).
Warehouse ID.
Warehouse Batch ID.
[ { "sku": "10038-2" }, { "sku": "10038-3" }][ { "statuscode": 200, "return": true }, { "statuscode": 200, "return": true }]| HTTP Status Code Summary | |
|---|---|
| 200 | Returns true or a batch envelope if multiple warehousebatchitems were deleted |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 404 | The specified resource was not found. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Get Counted Items for Closed Warehouse Batch
get /sites/{siteid}/warehouses/{warehouseid}/warehousebatches/{warehousebatchid}/warehousebatchitems-counted.jsonReturns the counted items for a closed warehousebatch, including stock and value before/after, approved deltas, and product title/variant/binlocation. Responds with HTTP 400 if the batch is not in state 20 (Closed).
The index of the item to start from. Used for pagination.
Number of items to return.
Filter on stock keeping unit (SKU), use comma as separator for multiple values.
Filter on whether the warehousebatchitem is in scope for the batch. Use true to return only in-scope items, false to return only out-of-scope items. Cycle-count batches only (transactiontype=60); ignored on other batch types.
Comma separated sort fields. Prefix a field with - to reverse direction.
Supported: warehousebatchitemid, sku, datemodified, decimaldiff, inscope
(inscope on cycle-count batches only; the sort key is ignored on other batch types).
Default: warehousebatchitemid.
Comma separated list of fields to return. Use this to query only the fields you are using. See WarehouseBatchCountedItem object for all fields.
Site ID. (Use eshopid of the site for this parameter).
Warehouse ID.
Warehouse Batch ID.
| HTTP Status Code Summary | |
|---|---|
| 200 | Returns an envelope with items of type WarehouseBatchCountedItem. |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 404 | The specified resource was not found. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Get Cycle Count Scope Items
get /sites/{siteid}/warehouses/{warehouseid}/warehousebatches/{warehousebatchid}/scope-items.jsonReturns the warehouseitems declared in scope for a cycle-count (transactiontype=60) batch, including product details for display. Responds with HTTP 400 if the batch is not a cycle count.
The index of the item to start from. Used for pagination.
Number of items to return.
Search text matching SKU or product title.
Filter on stock keeping unit (SKU), use comma as separator for multiple values.
Filter on items with datelaststocktaking starting from the timestamp provided.
Filter on items with datelaststocktaking up to and including the timestamp provided.
When true, only return items where available stock is below decimalthreshold.
Comma separated sort fields. Prefix a field with - to reverse direction.
Supported: warehousebatchscopeitemid, warehouseitemid, sku, title,
decimaltotal, decimalreserved, moneytotal, datelaststocktaking, dateadded.
Default: sku.
Comma separated list of fields to return. Use this to query only the fields you are using. See WarehouseBatchScopeItem object for all fields.
Site ID. (Use eshopid of the site for this parameter).
Warehouse ID.
Warehouse Batch ID.
| HTTP Status Code Summary | |
|---|---|
| 200 | Returns an envelope with items of type WarehouseBatchScopeItem. |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 404 | The specified resource was not found. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Add Cycle Count Scope Item
post /sites/{siteid}/warehouses/{warehouseid}/warehousebatches/{warehousebatchid}/scope-items.jsonAdd a single sku to the scope of a cycle-count batch in state Pending (40).
Idempotent — returns true if the row already exists. When the sku has never been
stocked at the warehouse, a warehouse item (zero stock) is created automatically.
Site ID. (Use eshopid of the site for this parameter).
Warehouse ID.
Warehouse Batch ID.
{ "sku": "100287"}true| HTTP Status Code Summary | |
|---|---|
| 200 | Successful. Returns true. |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 404 | The specified resource was not found. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Replace Cycle Count Scope
put /sites/{siteid}/warehouses/{warehouseid}/warehousebatches/{warehousebatchid}/scope-items.jsonReplace-all semantics: the resulting scope equals exactly the sku values supplied
in the body. Rows present today but absent from the body are deleted; rows in the
body but missing today are inserted. An empty array is valid and clears the scope.
Warehouse items (zero stock) are created automatically for skus never stocked at the
warehouse. Duplicate skus (case-insensitive) in the body return HTTP 400. Only
allowed on cycle-count batches in state Pending (40).
Site ID. (Use eshopid of the site for this parameter).
Warehouse ID.
Warehouse Batch ID.
[ { "sku": "100287" }, { "sku": "100288" }]true| HTTP Status Code Summary | |
|---|---|
| 200 | Successful. Returns true. |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 404 | The specified resource was not found. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Delete Cycle Count Scope Items
delete /sites/{siteid}/warehouses/{warehouseid}/warehousebatches/{warehousebatchid}/scope-items.jsonDelete one or more sku rows from the scope of a cycle-count batch in state
Pending (40). Deleting a sku with no scope row (or never stocked at the warehouse)
is a no-op; no warehouse items are created. Duplicate skus (case-insensitive) in
the body, and an empty array, return HTTP 400. Each row is processed on its own and
reported in a batch envelope, so a row that fails — including a batch that belongs
to another warehouse — is reported as
{"statuscode": 400, "errortext": "…"} while the request itself answers HTTP 200.
Site ID. (Use eshopid of the site for this parameter).
Warehouse ID.
Warehouse Batch ID.
[ { "sku": "100287" }, { "sku": "100288" }][ { "statuscode": 200, "return": true }, { "statuscode": 400, "errortext": "Warehouse batch does not belong to the given warehouse." }]| HTTP Status Code Summary | |
|---|---|
| 200 | Returns a batch envelope with one row per provided item, in the same order they were received. |
| 400 | Invalid request. Data sent from client is invalid. |
| 401 | Missing or bad authentication. |
| 429 | Too Many Requests. |
| 500 | Internal Server Error. |
Objects
DecimalQuantitystring
Errorobject
A status code for the error. Usually HTTP status code.
A textual description of the error.
An optional internal code for the error.
Moneystring
Timestampinteger
Number of seconds since the Unix Epoch.
TransactionTypeinteger
10ManualIn20ManualOut30Sales40Refund50StockTaking60Cycle count
10, 20, 30, 40, 50, 60WarehouseBatchobject
All changes to a warehouse is made using transactions. To make a change, first create a warehousebatch, add batch items and then set the batch to closed. That will commit the batch and create a warehousetransaction.
The unique ID of the warehousebatch.
The warehouse ID for this warehousebatch.
The warehouse transaction ID for this warehousebatch.
The type of the transaction.
The creation date for this warehousebatch.
The state of this warehousebatch.
The email for the owner of this warehousebatch.
The comment for this warehousebatch.
The name for this warehousebatch. Can only be set on cycle count batches (transactiontype = 60). Null when no name has been set.
The instructions for this warehousebatch. Can only be set on cycle count batches (transactiontype = 60). Null when no instructions have been set.
The ID for the shipment that is the source of this warehouse batch (if applicable).
External ID for the warehousebatch which will be transferred to the warehouse transaction (if applicable).
A reason code for the warehousebatch which will be transferred to the warehouse transaction (if applicable).
Flag indicating if stock quantities are shown to the counter for this warehousebatch.
Can only be set on cycle count batches (transactiontype = 60). Null when not set.
The start date for this warehousebatch. Can only be set on cycle count batches
(transactiontype = 60). Must be less than or equal to dateend. Null when no start bound is set.
The end date for this warehousebatch. Can only be set on cycle count batches
(transactiontype = 60). Must be greater than or equal to datestart. Null when no end bound is set.
The date the warehousebatch was closed. Null while the batch has not been closed yet.
The user ID (GUID matching the User entity) of the logged-in user who closed the warehousebatch. Populated for back-office requests authenticated with a user session (api_session token). Null when the batch is closed via a plain API-key token or by a background job that carries no user identity.
WarehouseBatchCountedItemobject
A counted item for a closed warehousebatch (before/after stock and value, approved deltas)
plus product title/variant/binlocation. Returned only by the
/warehousebatches/{warehousebatchid}/warehousebatchitems-counted endpoint.
The unique ID of the warehousebatchitem.
The ID of the warehousebatch.
The ID of the warehouseitem.
The SKU for this stock item.
The modified date for this warehousebatchitem.
The quantity counted by staff for this warehousebatchitem.
The purchase price per item for this warehousebatchitem.
The email for the owner of this warehousebatchitem.
A comment for the warehousebatchitem.
Stock quantity for this item BEFORE the batch transaction was committed.
Stock quantity for this item AFTER the batch transaction was committed.
Stock value for this item BEFORE the batch transaction was committed.
Stock value for this item AFTER the batch transaction was committed.
Approved quantity delta committed by the transaction (= decimalquantityafter - decimalquantitybefore).
Approved value delta committed by the transaction (= moneyvalueafter - moneyvaluebefore).
Whether this batchitem was in scope for the batch. Cycle-count batches only (transactiontype=60); omitted from the response on all other batch types.
Bin location for the stock item in the warehouse.
The product ID.
The product title.
Array of variant attributes for the product. Each item has name (variant group, e.g.
"Size") and value (variant value, e.g. "Large"). Empty array for non-variant products.
Array containing the URL of the product's first image. Empty array when the product has no images.
WarehouseBatchItemobject
Warehouse batch item for a warehousebatch.
The unique ID of the warehousebatchitem.
The ID of the warehousebatch that this warehousebatchitem belongs to.
The unique ID of the warehouseitem.
The modified date for this warehousebatchitem.
The stock quantity for this warehousebatchitem.
The purchase price per item for this warehousebatchitem.
The email for the owner of this warehousebatchitem.
A comment for the warehousebatchitem.
The SKU for this stock item.
The last date this warehouseitem has been part of a stocktaking or cycle count transaction.
Whether this warehousebatchitem is in scope for the batch. Cycle-count batches only (transactiontype=60); omitted on other batch types. Read-only; only returned when requested via fields=. Not accepted in POST/PUT request bodies.
WarehouseBatchScopeItemobject
One warehouseitem declared in scope for a cycle-count warehousebatch (transactiontype 60)
in state Pending (40), including product details for display. Returned by
GET /warehousebatches/{warehousebatchid}/scope-items.
The unique ID of the scope-item row.
The ID of the warehousebatch.
The ID of the warehouseitem in scope.
The SKU for this stock item.
When the warehouseitem was added to the cycle-count scope.
The product title.
Array of variant attributes for the product. Each item has name and value.
Current stock level for the warehouseitem.
Reserved stock level for the warehouseitem.
Current stock value for the warehouseitem.
The last date this warehouseitem has been part of a stocktaking or cycle count transaction.
WarehouseBatchScopeItemRefobject
WarehouseBatchStateinteger
10Open20Closed30Cancelled40Pending (cycle count batches only —transactiontype= 60)
10, 20, 30, 40