Update an inventory decrease

Operation ID: updateInventoryDecrease

Group: Inventory › Inventory Decreases

Open in the interactive reference

PATCH /inventory/inventory-decreases/{id}

Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.

Updates an inventory decrease with the fields you send. A field you leave out keeps its current value. Lines change through three separate arrays: deleteLines, updateLines, and createLines. You can send any combination in one request.

Leave out all three to keep the lines as they are. On an updateLines item, a field you leave out keeps its current value. On an updateLines item, sending batches, serials, or binLocations replaces all of that line's tracking, so send every batch, serial, and bin entry the line should keep.

Leave all three out to keep the line's tracking as it is.

Only a draft can be changed. You can change its date, reason code, notes, and lines, but not its location. The response is the whole updated document.

One request can remove a line and add its replacement.

Parameters

Name In Type Required Description
Api-Version header string · 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.
id path string yes The unique identifier of the inventory decrease you want to update.

Request body

Required, application/json: updateInventoryDecreaseInput.

Field Type Required Description
documentDate date no A new document date. Changing it moves the posting period. Use format YYYY-MM-DD.
reasonCodeId string no A new reason code. See id on GET inventory/reason-codes/:id.
notes string no Free text on the inventory decrease. Pass an empty string to clear it. Example: "Forklift damage, aisle 4 — two more found".
deleteLines array<string> no The unique identifiers of lines to remove. Applied before updateLines and createLines.
updateLines array<object> no The lines to change, addressed by id. Applied after deleteLines and before createLines. Example: [{"id":"9b3f5a10-7c24-4e68-8d05-1f6a92b4c837","quantity":"14.00","batches":[{"batchNumber":"LOT-2026-08-14","quantity":"14.00"}],"binLocations":[{"binLocationId":"0c7e91d3-4a58-4b26-9e10-63f8a2c5d704","quantity":"14.00","batchNumber":"LOT-2026-08-14"}]}].
updateLines[].id string yes The unique identifier for the line to change. A line belonging to another document is rejected, not skipped.
updateLines[].itemId string no A new item for the line. See id on GET inventory/items/:id.
updateLines[].unitId string no A new unit for the line's quantity. See id on GET inventory/unit-of-measures/:id.
updateLines[].quantity decimal no A new quantity, in the line's unit. Must be greater than zero when given.
updateLines[].unitPrice decimal no A new value of one unit, in the inventory decrease's currency. Must be greater than zero when given. Omit it to keep valuing the stock at the cost it already has.
updateLines[].notes string no Free text on the line. Pass an empty string to clear it.
updateLines[].batches array<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. On update, this replaces the line's batches.
updateLines[].batches[].batchNumberId string no The unique identifier for the batch being removed. See id on GET inventory/batch-numbers. Either this or batchNumber is required.
updateLines[].batches[].batchNumber string no The batch number as printed, for example 'LOT-2026-08-14'. Either this or batchNumberId is required; alone, it must name exactly one batch of the item in the document's warehouse. Given beside batchNumberId, it must be that batch's own number.
updateLines[].batches[].quantity 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.
updateLines[].serials array<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. On update, this replaces the line's serials.
updateLines[].serials[].serialNumberId string no The unique identifier for the unit being removed. See id on GET inventory/serial-numbers. Either this or serialNumber is required.
updateLines[].serials[].serialNumber string no The serial number stamped on the unit. Either this or serialNumberId is required; alone, it must name exactly one unit of the item in the document's warehouse. Given beside serialNumberId, it must be that unit's own number.
updateLines[].binLocations array<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. On update, this replaces the line's bin entries.
updateLines[].binLocations[].binLocationId string yes The unique identifier for the bin to take the quantity from. See id on GET inventory/bins/:id.
updateLines[].binLocations[].quantity decimal yes The quantity taken from this bin, in the line's unit.
updateLines[].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.
updateLines[].binLocations[].serialNumber string no Names one of this line's serialized units, when the bin entry belongs to it.
createLines array<object> no The lines to add. They use the document's existing location, so a document with no lines yet cannot take new ones.
createLines[].itemId string yes The unique identifier for the item whose stock this line removes. See id on GET inventory/items/:id.
createLines[].unitId string yes The unique identifier for the unit the quantity is counted in. See id on GET inventory/unit-of-measures/:id.
createLines[].quantity decimal yes The quantity to remove, in that unit. A positive number greater than zero.
createLines[].unitPrice 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.
createLines[].notes string no Free text on the line.
createLines[].batches array<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.
createLines[].batches[].batchNumberId string no The unique identifier for the batch being removed. See id on GET inventory/batch-numbers. Either this or batchNumber is required.
createLines[].batches[].batchNumber string no The batch number as printed, for example 'LOT-2026-08-14'. Either this or batchNumberId is required; alone, it must name exactly one batch of the item in the document's warehouse. Given beside batchNumberId, it must be that batch's own number.
createLines[].batches[].quantity 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.
createLines[].serials array<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.
createLines[].serials[].serialNumberId string no The unique identifier for the unit being removed. See id on GET inventory/serial-numbers. Either this or serialNumber is required.
createLines[].serials[].serialNumber string no The serial number stamped on the unit. Either this or serialNumberId is required; alone, it must name exactly one unit of the item in the document's warehouse. Given beside serialNumberId, it must be that unit's own number.
createLines[].binLocations array<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.
createLines[].binLocations[].binLocationId string yes The unique identifier for the bin to take the quantity from. See id on GET inventory/bins/:id.
createLines[].binLocations[].quantity decimal yes The quantity taken from this bin, in the line's unit.
createLines[].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.
createLines[].binLocations[].serialNumber string no Names one of this line's serialized units, when the bin entry belongs to it.
{
  "documentDate": "2026-01-15",
  "reasonCodeId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "notes": "Forklift damage, aisle 4 — two more found",
  "deleteLines": [
    "<deleteLines>"
  ],
  "updateLines": [
    {
      "id": "9b3f5a10-7c24-4e68-8d05-1f6a92b4c837",
      "quantity": "14.00",
      "batches": [
        {
          "batchNumber": "LOT-2026-08-14",
          "quantity": "14.00"
        }
      ],
      "binLocations": [
        {
          "binLocationId": "0c7e91d3-4a58-4b26-9e10-63f8a2c5d704",
          "quantity": "14.00",
          "batchNumber": "LOT-2026-08-14"
        }
      ]
    }
  ],
  "createLines": [
    {
      "itemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "unitId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "quantity": "19.99",
      "unitPrice": "19.99",
      "notes": "<notes>",
      "batches": [
        {
          "batchNumberId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
          "batchNumber": "<batchNumber>",
          "quantity": "19.99"
        }
      ],
      "serials": [
        {
          "serialNumberId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
          "serialNumber": "<serialNumber>"
        }
      ],
      "binLocations": [
        {
          "binLocationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
          "quantity": "19.99",
          "batchNumber": "<batchNumber>",
          "serialNumber": "<serialNumber>"
        }
      ]
    }
  ]
}

Response

200 Success

Under data (updateInventoryDecreaseOutput):

Field Type Required Description
id string yes The unique identifier for the inventory decrease. Example: "d4a17f28-6b93-4c50-8e71-2a5d0c9b3e64".
documentNumber string no The inventory decrease's document number, for example 'DEC-42'. Absent while none has been assigned. Example: "DEC-42".
documentStatus string yes The status of the inventory decrease. Possible values: 'DRAFT', 'COMMITTED', 'CANCELLED'. Example: "DRAFT".
documentDate 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. Example: "2026-08-14".
entityId string yes The unique identifier for the legal entity the document belongs to. See id on GET base/entities. Example: "1a9c4e70-38b5-4d26-9f01-7c2e5b8a6d43".
entityName string no The display name of that legal entity. Example: "Acme Netherlands B.V.".
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. Example: "e1d84c07-5b39-4a26-9f70-2c8b613ad495".
locationCode string no The short code of that warehouse location. Example: "WH-01".
locationName string no The display name of that warehouse location. Example: "Rotterdam Distribution Centre".
reasonCodeId string no The unique identifier for the reason code, when one was given. See id on GET inventory/reason-codes/:id. Example: "6f2b58c1-9d47-4e03-a815-70c9d2e46b38".
reasonCode string no The short code of that reason code. Example: "COUNT".
reasonCodeDescription string no The description of that reason code. Example: "Count correction".
currency string no The currency the inventory decrease is valued in, the legal entity's functional currency. Format ISO 4217, for example 'EUR'. Example: "EUR".
notes string no Free text on the inventory decrease. Example: "Forklift damage, aisle 4 — two more found".
createdDate date-time no The date and time the inventory decrease was created, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. Example: "2026-08-14T09:12:00.000Z".
lastModifiedDate date-time no The date and time the inventory decrease record last changed, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. Example: "2026-08-14T09:40:00.000Z".
lines array<object> yes The lines of the inventory decrease. An inventory decrease always has at least one. Example: [{"id":"9b3f5a10-7c24-4e68-8d05-1f6a92b4c837","itemId":"5f21c8b0-9d34-4a76-8e12-04b93c7de5a8","itemCode":"WIDGET-01","itemName":"Standard widget","unitId":"3b7d5e9c-1a24-4f80-9c6d-2e8f70b13a45","unitCode":"EA","quantity":"14.00","inventoryQuantity":"14.00","notes":"Crushed by a forklift","batches":[{"batchNumberId":"9c31f5a8-6b02-4e79-b354-8d1a67e0f2b9","batchNumber":"LOT-2026-08-14","expirationDate":"2027-08-14","quantity":"14.00","inventoryQuantity":"14.00"}],"binLocations":[{"binLocationId":"0c7e91d3-4a58-4b26-9e10-63f8a2c5d704","binLocationCode":"A-01-02","quantity":"14.00","inventoryQuantity":"14.00","batchNumber":"LOT-2026-08-14"}]}].
lines[].id string yes The unique identifier for the inventory decrease line.
lines[].itemId string yes The unique identifier for the item whose stock this line removes. See id on GET inventory/items/:id.
lines[].itemCode string no The short code of that item.
lines[].itemName string no The display name of that item.
lines[].unitId string yes The unique identifier for the unit the quantity is counted in. See id on GET inventory/unit-of-measures/:id.
lines[].unitCode string no The short code of that unit, for example 'BOX'.
lines[].quantity decimal yes The quantity removed, in the line's unit. A positive number.
lines[].inventoryQuantity decimal no The same quantity in the item's stocking unit.
lines[].unitPrice 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.
lines[].notes string no Free text on the line.
lines[].batches array<object> no The batches making up this line's quantity, for a batch-tracked item. Absent when the item is not batch-tracked.
lines[].batches[].batchNumberId string no The unique identifier for the batch record.
lines[].batches[].batchNumber string yes The batch number as printed, for example 'LOT-2026-08-14'.
lines[].batches[].manufacturerBatchNumber string no The maker's own number for the same batch, when one was recorded.
lines[].batches[].expirationDate date no The expiration date of the batch. Format YYYY-MM-DD.
lines[].batches[].quantity decimal yes The quantity of this batch removed by the line, in the line's unit.
lines[].batches[].inventoryQuantity decimal no The same quantity in the item's stocking unit.
lines[].serials array<object> no The serialized units making up this line's quantity, one entry per unit. Absent when the item is not serialized.
lines[].serials[].serialNumberId string no The unique identifier for the serial record.
lines[].serials[].serialNumber string yes The serial number stamped on the unit.
lines[].serials[].manufacturerSerialNumber string no The maker's own number for the same unit, when one was recorded.
lines[].binLocations array<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.
lines[].binLocations[].binLocationId string yes The unique identifier for the bin the quantity came out of. See id on GET inventory/bins/:id.
lines[].binLocations[].binLocationCode string no The short code of that bin.
lines[].binLocations[].quantity decimal yes The quantity taken from this bin, in the line's unit.
lines[].binLocations[].inventoryQuantity decimal no The same quantity in the item's stocking unit.
lines[].binLocations[].batchNumber string no The batch this bin entry belongs to, when it belongs to one of the line's batches.
lines[].binLocations[].serialNumber string no The serialized unit this bin entry belongs to, when it belongs to one of the line's units.
{
  "data": {
    "id": "d4a17f28-6b93-4c50-8e71-2a5d0c9b3e64",
    "documentNumber": "DEC-42",
    "documentStatus": "DRAFT",
    "documentDate": "2026-08-14",
    "entityId": "1a9c4e70-38b5-4d26-9f01-7c2e5b8a6d43",
    "entityName": "Acme Netherlands B.V.",
    "locationId": "e1d84c07-5b39-4a26-9f70-2c8b613ad495",
    "locationCode": "WH-01",
    "locationName": "Rotterdam Distribution Centre",
    "reasonCodeId": "6f2b58c1-9d47-4e03-a815-70c9d2e46b38",
    "reasonCode": "COUNT",
    "reasonCodeDescription": "Count correction",
    "currency": "EUR",
    "notes": "Forklift damage, aisle 4 — two more found",
    "createdDate": "2026-08-14T09:12:00.000Z",
    "lastModifiedDate": "2026-08-14T09:40:00.000Z",
    "lines": [
      {
        "id": "9b3f5a10-7c24-4e68-8d05-1f6a92b4c837",
        "itemId": "5f21c8b0-9d34-4a76-8e12-04b93c7de5a8",
        "itemCode": "WIDGET-01",
        "itemName": "Standard widget",
        "unitId": "3b7d5e9c-1a24-4f80-9c6d-2e8f70b13a45",
        "unitCode": "EA",
        "quantity": "14.00",
        "inventoryQuantity": "14.00",
        "notes": "Crushed by a forklift",
        "batches": [
          {
            "batchNumberId": "9c31f5a8-6b02-4e79-b354-8d1a67e0f2b9",
            "batchNumber": "LOT-2026-08-14",
            "expirationDate": "2027-08-14",
            "quantity": "14.00",
            "inventoryQuantity": "14.00"
          }
        ],
        "binLocations": [
          {
            "binLocationId": "0c7e91d3-4a58-4b26-9e10-63f8a2c5d704",
            "binLocationCode": "A-01-02",
            "quantity": "14.00",
            "inventoryQuantity": "14.00",
            "batchNumber": "LOT-2026-08-14"
          }
        ]
      }
    ]
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}

Response headers

Errors

Code Status
NOT_FOUND 400
WRONG_STATUS 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