Creates several inventory decreases in one call, each as a draft.
POST /inventory/inventory-decreases/bulk
Group: Inventory › Inventory Decreases · Operation ID: bulkCreateInventoryDecreases
All or nothing: if any inventory decrease is rejected, nothing is written, not even the entries before it. index on the error says which, counting from zero. Each entry is exactly what POST inventory/inventory-decreases takes, and the results come back in input order. Nothing is posted, since committing is per document.
Open in the interactive reference
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Api-Version |
header | "v1" |
yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version v1. |
Idempotency-Key |
header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with 400 IDEMPOTENCY_NOT_SUPPORTED rather than silently ignored. |
Request body
Required, application/json: bulkCreateInventoryDecreasesInput.
| Field | Type | Required | Description |
|---|---|---|---|
decreases |
array of object | yes | The inventory decreases to create. At least one, and each is exactly what POST inventory/inventory-decreases takes. |
decreases[].locationId |
string | yes | The unique identifier for the warehouse location. One location for the whole document, and every line comes out of it. Required. See id on GET inventory/warehouses/:id. |
decreases[].entityId |
string | no | The unique identifier for the legal entity. Omit it to use the location's owning entity. See id on GET base/entities. |
decreases[].documentDate |
string (date) | no | The date the adjustment is dated. It drives the posting period. Defaults to today. Use format YYYY-MM-DD. |
decreases[].reasonCodeId |
string | no | The unique identifier for a reason code explaining the adjustment. See id on GET inventory/reason-codes/:id. |
decreases[].notes |
string | no | Free text on the inventory decrease. |
decreases[].lines |
array of object | yes | The lines of the inventory decrease. At least one is required. |
decreases[].lines[].itemId |
string | yes | The unique identifier for the item whose stock this line removes. See id on GET inventory/items/:id. |
decreases[].lines[].unitId |
string | yes | The unique identifier for the unit the quantity is counted in. See id on GET inventory/unit-of-measures/:id. |
decreases[].lines[].quantity |
string (decimal) | yes | The quantity to remove, in that unit. A positive number greater than zero. |
decreases[].lines[].unitPrice |
string (decimal) | no | The value of one unit, in the inventory decrease's currency. Optional: omit it to value the stock at the cost it already has, which is what a write-off ordinarily wants. A supplied value must be greater than zero. |
decreases[].lines[].notes |
string | no | Free text on the line. |
decreases[].lines[].batches |
array of object | no | The batches to take the quantity from. Required for a batch-tracked item, and the quantities must add up to the line's quantity. Every batch named must already exist for the item, since a decrease removes lots and does not create them. |
decreases[].lines[].batches[].batchNumberId |
string | no | The unique identifier for the batch being removed. Give this or batchNumber. |
decreases[].lines[].batches[].batchNumber |
string | no | The batch number as printed, for example 'LOT-2026-08-14'. It is matched against the batches of this line's item, since the same number on another item is a different lot. Give this or batchNumberId. |
decreases[].lines[].batches[].quantity |
string (decimal) | yes | The quantity of this batch to remove, in the line's unit. The batch quantities of a line must add up to the line's quantity. |
decreases[].lines[].serials |
array of object | no | The units to remove, one entry per unit. Required for a serialized item, and the count must equal the line's quantity. Every unit named must already exist. |
decreases[].lines[].serials[].serialNumberId |
string | no | The unique identifier for the unit being removed. Give this or serialNumber. |
decreases[].lines[].serials[].serialNumber |
string | no | The serial number stamped on the unit, matched against the units of this line's item. Give this or serialNumberId. |
decreases[].lines[].binLocations |
array of object | no | The bins the quantity comes out of, in a bin-tracked warehouse. An entry may name a batchNumber or serialNumber of its own line. |
decreases[].lines[].binLocations[].binLocationId |
string | yes | The unique identifier for the bin to take the quantity from. See id on GET inventory/bins/:id. |
decreases[].lines[].binLocations[].quantity |
string (decimal) | yes | The quantity taken from this bin, in the line's unit. |
decreases[].lines[].binLocations[].batchNumber |
string | no | Names one of this line's batches, when the bin entry belongs to it. A number the line does not have is rejected rather than reinterpreted. |
decreases[].lines[].binLocations[].serialNumber |
string | no | Names one of this line's serialized units, when the bin entry belongs to it. |
Example:
{
"decreases": [
{
"locationId": "e1d84c07-5b39-4a26-9f70-2c8b613ad495",
"documentDate": "2026-08-14",
"reasonCodeId": "6f2b58c1-9d47-4e03-a815-70c9d2e46b38",
"notes": "Forklift damage, aisle 4",
"lines": [
{
"itemId": "5f21c8b0-9d34-4a76-8e12-04b93c7de5a8",
"unitId": "3b7d5e9c-1a24-4f80-9c6d-2e8f70b13a45",
"quantity": "12.00",
"notes": "Crushed by a forklift",
"batches": [
{
"batchNumber": "LOT-2026-08-14",
"quantity": "12.00"
}
],
"binLocations": [
{
"binLocationId": "0c7e91d3-4a58-4b26-9e10-63f8a2c5d704",
"quantity": "12.00",
"batchNumber": "LOT-2026-08-14"
}
]
}
]
}
]
}
Response
200 Success
Under data (bulkCreateInventoryDecreasesOutput):
| Field | Type | Required | Description |
|---|---|---|---|
items |
array of object | yes | The created inventory decreases, in input order. Match them to inputs by position. |
items[].id |
string | yes | The unique identifier for the inventory decrease. |
items[].documentNumber |
string | no | The inventory decrease's document number, for example 'DEC-42'. Absent while none has been assigned. |
items[].documentStatus |
string | yes | The status of the inventory decrease. Possible values: 'DRAFT', 'COMMITTED', 'CANCELLED'. |
items[].documentDate |
string (date) | yes | The date the adjustment is dated. It drives the posting period, so it is not the same as when the record was created. Format YYYY-MM-DD. |
items[].entityId |
string | yes | The unique identifier for the legal entity the document belongs to. See id on GET base/entities. |
items[].entityName |
string | no | The display name of that legal entity. |
items[].locationId |
string | no | The unique identifier for the warehouse location. One location for the whole document, and every line uses it. Absent only on a document with no lines. See id on GET inventory/warehouses/:id. |
items[].locationCode |
string | no | The short code of that warehouse location. |
items[].locationName |
string | no | The display name of that warehouse location. |
items[].reasonCodeId |
string | no | The unique identifier for the reason code, when one was given. See id on GET inventory/reason-codes/:id. |
items[].reasonCode |
string | no | The short code of that reason code. |
items[].reasonCodeDescription |
string | no | The description of that reason code. |
items[].currency |
string | no | The currency the inventory decrease is valued in, the legal entity's functional currency. Format ISO 4217, for example 'EUR'. |
items[].notes |
string | no | Free text on the inventory decrease. |
items[].createdDate |
string (date-time) | no | The date and time the inventory decrease was created, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. |
items[].lastModifiedDate |
string (date-time) | no | The date and time the inventory decrease record last changed, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. |
items[].lines |
array of object | yes | The lines of the inventory decrease. An inventory decrease always has at least one. |
items[].lines[].id |
string | yes | The unique identifier for the inventory decrease line. |
items[].lines[].itemId |
string | yes | The unique identifier for the item whose stock this line removes. See id on GET inventory/items/:id. |
items[].lines[].itemCode |
string | no | The short code of that item. |
items[].lines[].itemName |
string | no | The display name of that item. |
items[].lines[].unitId |
string | yes | The unique identifier for the unit the quantity is counted in. See id on GET inventory/unit-of-measures/:id. |
items[].lines[].unitCode |
string | no | The short code of that unit, for example 'BOX'. |
items[].lines[].quantity |
string (decimal) | yes | The quantity removed, in the line's unit. A positive number. |
items[].lines[].inventoryQuantity |
string (decimal) | no | The same quantity in the item's stocking unit. |
items[].lines[].unitPrice |
string (decimal) | no | The value of one unit, in the inventory decrease's currency, when one was recorded. Usually absent, since stock leaving is valued at the cost it already has. |
items[].lines[].notes |
string | no | Free text on the line. |
items[].lines[].batches |
array of object | no | The batches making up this line's quantity, for a batch-tracked item. Absent when the item is not batch-tracked. |
items[].lines[].batches[].batchNumberId |
string | no | The unique identifier for the batch record. |
items[].lines[].batches[].batchNumber |
string | yes | The batch number as printed, for example 'LOT-2026-08-14'. |
items[].lines[].batches[].manufacturerBatchNumber |
string | no | The maker's own number for the same batch, when one was recorded. |
items[].lines[].batches[].expirationDate |
string (date) | no | The expiration date of the batch. Format YYYY-MM-DD. |
items[].lines[].batches[].quantity |
string (decimal) | yes | The quantity of this batch removed by the line, in the line's unit. |
items[].lines[].batches[].inventoryQuantity |
string (decimal) | no | The same quantity in the item's stocking unit. |
items[].lines[].serials |
array of object | no | The serialized units making up this line's quantity, one entry per unit. Absent when the item is not serialized. |
items[].lines[].serials[].serialNumberId |
string | no | The unique identifier for the serial record. |
items[].lines[].serials[].serialNumber |
string | yes | The serial number stamped on the unit. |
items[].lines[].serials[].manufacturerSerialNumber |
string | no | The maker's own number for the same unit, when one was recorded. |
items[].lines[].binLocations |
array of object | no | The bins the quantity came out of, in a bin-tracked warehouse. Each entry that names a batchNumber or serialNumber belongs to that batch or unit, and one that names neither belongs to the line. |
items[].lines[].binLocations[].binLocationId |
string | yes | The unique identifier for the bin the quantity came out of. See id on GET inventory/bins/:id. |
items[].lines[].binLocations[].binLocationCode |
string | no | The short code of that bin. |
items[].lines[].binLocations[].quantity |
string (decimal) | yes | The quantity taken from this bin, in the line's unit. |
items[].lines[].binLocations[].inventoryQuantity |
string (decimal) | no | The same quantity in the item's stocking unit. |
items[].lines[].binLocations[].batchNumber |
string | no | The batch this bin entry belongs to, when it belongs to one of the line's batches. |
items[].lines[].binLocations[].serialNumber |
string | no | The serialized unit this bin entry belongs to, when it belongs to one of the line's units. |
Response headers
Idempotency-Replayed— Present andtrueonly when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent asfalse.
Errors
| Code | Status |
|---|---|
NOTHING_TO_CREATE |
400 |
REFERENCE_NOT_FOUND |
400 |
NO_LINES |
400 |
INVALID_QUANTITY |
400 |
UNKNOWN_TRACKING_NUMBER |
400 |
DUPLICATE_TRACKING_NUMBER |
400 |
UNKNOWN_TRACKING_REFERENCE |
400 |
POSTING_REJECTED |
400 |
IDEMPOTENCY_KEY_CONFLICT |
409 |
IDEMPOTENCY_PAYLOAD_MISMATCH |
422 |
Statuses
400— Invalid request or business failure. Codes: NOTHING_TO_CREATE, REFERENCE_NOT_FOUND, NO_LINES, INVALID_QUANTITY, UNKNOWN_TRACKING_NUMBER, DUPLICATE_TRACKING_NUMBER, UNKNOWN_TRACKING_REFERENCE, POSTING_REJECTED401— Missing or invalid access token403— Not authorized404— Not found409— The Idempotency-Key is still being processed by another request.422— The Idempotency-Key was already used with a different request payload.429— Too many requests500— Internal server error