# Update an inventory revaluation

Operation ID: `updateInventoryRevaluation`

Group: Inventory › Inventory Revaluations

[Open in the interactive reference](https://docs.api.lensing.ai/lensing/v1/endpoints/updateInventoryRevaluation)

`PATCH /inventory/inventory-revaluations/{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 a draft inventory revaluation. Use the revaluation's id, not its documentNumber.

Only a draft revaluation can be changed. A main field you leave out keeps its current value.

Send every line you want the revaluation to keep, in updateLines or createLines, with every update. A request with no lines returns the revaluation unchanged, including its main fields. An existing line you don't send is deleted, and deleteLines has no effect.

updateLines names a line by its id from GET inventory/inventory-revaluations/:id, and a line id from another revaluation is refused. Sending batches or serials on a line replaces the ones that line had.

The response is the updated revaluation with its lines, in the same shape as GET inventory/inventory-revaluations/:id.

## 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 revaluation you want to update. |

## Request body

Required, `application/json`: updateInventoryRevaluationInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `documentDate` | date | no | The date the revaluation is dated. Use format YYYY-MM-DD. |
| `costingValuationType` | string | no | How the value change is recorded. Accepted values: 'revaluation', 'directCostCapitalisation'. 'revaluation' restates the cost outright, and 'directCostCapitalisation' adds a cost that was expensed elsewhere onto the stock. |
| `capitalisationExpenseAccountId` | string | no | The unique identifier for the general ledger account a direct cost capitalization takes the expense off. See id on GET accounting/chart-of-accounts/:id. |
| `costingElementTypeId` | string | no | The unique identifier for the costing element type the cost breakdown rows are recorded against. |
| `reasonCodeId` | string | no | The unique identifier for a reason code. See id on GET inventory/reason-codes/:id. |
| `notes` | string | no | Free text on the revaluation. Example: `"Reviewed with finance"`. |
| `createLines` | array<object> | no | The lines to add, each the same shape as a line on create. |
| `createLines[].itemId` | string | yes | The unique identifier for the item to revalue. See id on GET inventory/items/:id. |
| `createLines[].locationId` | string | yes | The unique identifier for the warehouse whose stock is being restated. There is no document-level warehouse, so every line names its own. See id on GET inventory/warehouses/:id. |
| `createLines[].unitId` | string | yes | The unique identifier for the unit the quantity is in. Required: without it the platform falls back to whichever unit is first in the tenant. See id on GET inventory/unit-of-measures/:id. |
| `createLines[].quantity` | decimal | yes | How much stock this line restates. Must be greater than zero. |
| `createLines[].currentUnitCost` | decimal | yes | What the stock is carried at today, in the legal entity's functional currency. Read it from GET inventory/inventory-levels for the same item and warehouse, since it is checked and never looked up, and a guess posts the wrong difference. Zero is accepted and a negative cost is not. |
| `createLines[].newUnitCost` | decimal | yes | What it should be carried at after this posts, in the legal entity's functional currency. |
| `createLines[].previousAfterSaleCost` | decimal | no | The accrued after-sale cost before this document. Moving-average direct cost capitalization only. |
| `createLines[].newAfterSaleCost` | decimal | no | The after-sale cost to capitalize. Moving-average direct cost capitalization only. |
| `createLines[].notes` | string | no | Free text on the line. |
| `createLines[].batches` | array<object> | no | The batches being restated. Their quantities must add up to the line's quantity. |
| `createLines[].batches[].batchNumberId` | string | no | The unique identifier for the batch. See id on GET inventory/batch-numbers. Either this or batchNumber is required. |
| `createLines[].batches[].batchNumber` | string | no | The batch number as printed. Either this or batchNumberId is required; alone, it must name exactly one batch of the item in the line's warehouse. Given beside batchNumberId, it must be that batch's own number. |
| `createLines[].batches[].quantity` | decimal | yes | How much of the line this batch accounts for. |
| `createLines[].batches[].currentUnitCost` | decimal | no | What this batch is carried at today. |
| `createLines[].batches[].newUnitCost` | decimal | no | What it should be carried at. |
| `createLines[].serials` | array<object> | no | The serialized units being restated, one entry per unit. |
| `createLines[].serials[].serialNumberId` | string | no | The unique identifier for the unit. 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 line's warehouse. Given beside serialNumberId, it must be that unit's own number. |
| `createLines[].serials[].currentUnitCost` | decimal | no | What this unit is carried at today. |
| `createLines[].serials[].newUnitCost` | decimal | no | What it should be carried at. |
| `createLines[].serials[].previousAfterSaleCost` | decimal | no | The unit's accrued after-sale cost before this document. |
| `createLines[].serials[].newAfterSaleCost` | decimal | no | The after-sale cost to capitalize on it. |
| `updateLines` | array<object> | no | The lines to change, addressed by the id this endpoint publishes. Everything but the id is optional, and a tracking array replaces what that line had. |
| `updateLines[].id` | string | yes | The unique identifier for the line to change. |
| `updateLines[].itemId` | string | no | The unique identifier for a different item. See id on GET inventory/items/:id. |
| `updateLines[].locationId` | string | no | The unique identifier for the warehouse whose stock is being restated. There is no document-level warehouse, so every line names its own. See id on GET inventory/warehouses/:id. |
| `updateLines[].unitId` | string | no | The unique identifier for the unit the quantity is in. Required: without it the platform falls back to whichever unit is first in the tenant. See id on GET inventory/unit-of-measures/:id. |
| `updateLines[].quantity` | decimal | no | How much stock this line restates. Must be greater than zero. |
| `updateLines[].currentUnitCost` | decimal | no | What the stock is carried at today, in the legal entity's functional currency. Read it from GET inventory/inventory-levels for the same item and warehouse, since it is checked and never looked up, and a guess posts the wrong difference. Zero is accepted and a negative cost is not. |
| `updateLines[].newUnitCost` | decimal | no | What it should be carried at after this posts, in the legal entity's functional currency. |
| `updateLines[].previousAfterSaleCost` | decimal | no | The accrued after-sale cost before this document. Moving-average direct cost capitalization only. |
| `updateLines[].newAfterSaleCost` | decimal | no | The after-sale cost to capitalize. Moving-average direct cost capitalization only. |
| `updateLines[].notes` | string | no | Free text on the line. |
| `updateLines[].batches` | array<object> | no | The batches being restated. Their quantities must add up to the line's quantity. |
| `updateLines[].batches[].batchNumberId` | string | no | The unique identifier for the batch. See id on GET inventory/batch-numbers. Either this or batchNumber is required. |
| `updateLines[].batches[].batchNumber` | string | no | The batch number as printed. Either this or batchNumberId is required; alone, it must name exactly one batch of the item in the line's warehouse. Given beside batchNumberId, it must be that batch's own number. |
| `updateLines[].batches[].quantity` | decimal | yes | How much of the line this batch accounts for. |
| `updateLines[].batches[].currentUnitCost` | decimal | no | What this batch is carried at today. |
| `updateLines[].batches[].newUnitCost` | decimal | no | What it should be carried at. |
| `updateLines[].serials` | array<object> | no | The serialized units being restated, one entry per unit. |
| `updateLines[].serials[].serialNumberId` | string | no | The unique identifier for the unit. 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 line's warehouse. Given beside serialNumberId, it must be that unit's own number. |
| `updateLines[].serials[].currentUnitCost` | decimal | no | What this unit is carried at today. |
| `updateLines[].serials[].newUnitCost` | decimal | no | What it should be carried at. |
| `updateLines[].serials[].previousAfterSaleCost` | decimal | no | The unit's accrued after-sale cost before this document. |
| `updateLines[].serials[].newAfterSaleCost` | decimal | no | The after-sale cost to capitalize on it. |
| `deleteLines` | array<string> | no | The unique identifiers of the lines to remove. |

```json
{
  "documentDate": "2026-01-15",
  "costingValuationType": "<costingValuationType>",
  "capitalisationExpenseAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "costingElementTypeId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "reasonCodeId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "notes": "Reviewed with finance",
  "createLines": [
    {
      "itemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "locationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "unitId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "quantity": "19.99",
      "currentUnitCost": "19.99",
      "newUnitCost": "19.99",
      "previousAfterSaleCost": "19.99",
      "newAfterSaleCost": "19.99",
      "notes": "<notes>",
      "batches": [
        {
          "batchNumberId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
          "batchNumber": "<batchNumber>",
          "quantity": "19.99",
          "currentUnitCost": "19.99",
          "newUnitCost": "19.99"
        }
      ],
      "serials": [
        {
          "serialNumberId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
          "serialNumber": "<serialNumber>",
          "currentUnitCost": "19.99",
          "newUnitCost": "19.99",
          "previousAfterSaleCost": "19.99",
          "newAfterSaleCost": "19.99"
        }
      ]
    }
  ],
  "updateLines": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "itemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "locationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "unitId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "quantity": "19.99",
      "currentUnitCost": "19.99",
      "newUnitCost": "19.99",
      "previousAfterSaleCost": "19.99",
      "newAfterSaleCost": "19.99",
      "notes": "<notes>",
      "batches": [
        {
          "batchNumberId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
          "batchNumber": "<batchNumber>",
          "quantity": "19.99",
          "currentUnitCost": "19.99",
          "newUnitCost": "19.99"
        }
      ],
      "serials": [
        {
          "serialNumberId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
          "serialNumber": "<serialNumber>",
          "currentUnitCost": "19.99",
          "newUnitCost": "19.99",
          "previousAfterSaleCost": "19.99",
          "newAfterSaleCost": "19.99"
        }
      ]
    }
  ],
  "deleteLines": [
    "<deleteLines>"
  ]
}
```

## Response

`200` Success

Under `data` (updateInventoryRevaluationOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | The unique identifier for the revaluation. Example: `"8e4b17c0-5d92-4a63-b0f7-1c8e35a029d4"`. |
| `documentNumber` | string | no | The revaluation's document number, for example 'REV-1187'. Example: `"REV-1187"`. |
| `documentStatus` | string | yes | The status of the revaluation. Possible values: 'DRAFT', 'COMMITTED', 'CANCELLED'. Example: `"DRAFT"`. |
| `documentDate` | date | no | The date the revaluation is dated. Format YYYY-MM-DD. |
| `entityId` | string | no | The unique identifier for the legal entity whose books this moves. See id on GET base/entities. |
| `entityName` | string | no | The display name of that legal entity. |
| `costingValuationType` | string | no | How the value change is recorded. Possible values: 'revaluation', 'directCostCapitalisation'. 'revaluation' restates the cost outright, and 'directCostCapitalisation' adds a cost that was expensed elsewhere onto the stock. |
| `capitalisationExpenseAccountId` | string | no | The unique identifier for the general ledger account a direct cost capitalization takes the expense off. Absent on an ordinary revaluation. See id on GET accounting/chart-of-accounts/:id. |
| `costingElementTypeId` | string | no | The unique identifier for the costing element type the cost breakdown rows are recorded against. Required to commit. |
| `reasonCodeId` | string | no | The unique identifier for the reason code, when one was given. See id on GET inventory/reason-codes/:id. |
| `reasonCode` | string | no | The code of that reason code. |
| `reasonCodeDescription` | string | no | The description of that reason code. |
| `currency` | string | no | The currency of every amount on the revaluation, the legal entity's functional currency. Format ISO 4217, for example 'EUR'. Example: `"EUR"`. |
| `totalRevaluationAmount` | decimal | no | The sum of every line's revaluationAmount, in the revaluation's currency. This is what the document moves on the balance sheet. |
| `active` | boolean | no | Whether the document is active. |
| `notes` | string | no | Free text on the revaluation. Example: `"Reviewed with finance"`. |
| `lineCount` | number | no | How many lines the revaluation has. Example: `1`. |
| `createdDate` | date-time | no | The date and time the revaluation was created, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. |
| `lastModifiedDate` | date-time | no | The date and time the revaluation record last changed, in UTC. Format YYYY-MM-DDTHH:mm:ss.sssZ. Example: `"2026-08-18T11:20:04.219Z"`. |
| `lines` | array<object> | no | The lines of the revaluation as it now stands. |
| `lines[].id` | string | yes | The unique identifier for the revaluation line. Pass it in updateLines or deleteLines on PATCH inventory/inventory-revaluations/:id to change or remove the line. |
| `lines[].itemId` | string | no | The unique identifier for the item being revalued. See id on GET inventory/items/:id. |
| `lines[].itemCode` | string | no | The code of that item. |
| `lines[].itemName` | string | no | The display name of that item. |
| `lines[].locationId` | string | no | The unique identifier for the warehouse whose stock this line restates. The same item may be carried at a different cost in each warehouse. See id on GET inventory/warehouses/:id. |
| `lines[].locationCode` | string | no | The code of that warehouse. |
| `lines[].locationName` | string | no | The display name of that warehouse. |
| `lines[].unitId` | string | no | The unique identifier for the unit the quantity is in. See id on GET inventory/unit-of-measures/:id. |
| `lines[].unitCode` | string | no | The code of that unit. |
| `lines[].quantity` | decimal | no | How much stock this line restates the cost of, in the line's unit. |
| `lines[].inventoryQuantity` | decimal | no | The same amount in the item's stocking unit. |
| `lines[].currentUnitCost` | decimal | no | What the stock is carried at today, in the revaluation's currency. You supply it and the platform checks it rather than deriving it. Read it from GET inventory/inventory-levels. |
| `lines[].newUnitCost` | decimal | no | What it should be carried at after this posts, in the revaluation's currency. |
| `lines[].previousAfterSaleCost` | decimal | no | The accrued after-sale cost before this document, in the revaluation's currency. Moving-average direct cost capitalization only. |
| `lines[].newAfterSaleCost` | decimal | no | The after-sale cost to capitalize, in the revaluation's currency. Moving-average direct cost capitalization only. |
| `lines[].revaluationAmount` | decimal | no | The value this line moves on the balance sheet, in the revaluation's currency: (newUnitCost - currentUnitCost) x quantity. |
| `lines[].status` | string | no | Where the line sits in the platform's own process. This is free text with no fixed set of values. |
| `lines[].notes` | string | no | Free text on the line. |
| `lines[].batches` | array<object> | no | The batches being restated. Their quantities must add up to the line's quantity. |
| `lines[].batches[].batchNumberId` | string | no | The unique identifier for the batch number. |
| `lines[].batches[].batchNumber` | string | no | The batch number itself. |
| `lines[].batches[].quantity` | decimal | no | How much of the line this batch accounts for. |
| `lines[].batches[].currentUnitCost` | decimal | no | What this batch is carried at today, in the revaluation's currency. |
| `lines[].batches[].newUnitCost` | decimal | no | What it should be carried at. |
| `lines[].serials` | array<object> | no | The serialized units being restated, one entry per unit, so there must be exactly as many as the quantity says. |
| `lines[].serials[].serialNumberId` | string | no | The unique identifier for the serial number. |
| `lines[].serials[].serialNumber` | string | no | The serial number itself. |
| `lines[].serials[].currentUnitCost` | decimal | no | What this unit is carried at today, in the revaluation's currency. |
| `lines[].serials[].newUnitCost` | decimal | no | What it should be carried at. |
| `lines[].serials[].previousAfterSaleCost` | decimal | no | The unit's accrued after-sale cost before this document. Direct cost capitalization on a sold serial only. |
| `lines[].serials[].newAfterSaleCost` | decimal | no | The after-sale cost to capitalize on it. |

```json
{
  "data": {
    "id": "8e4b17c0-5d92-4a63-b0f7-1c8e35a029d4",
    "documentNumber": "REV-1187",
    "documentStatus": "DRAFT",
    "documentDate": "2026-01-15",
    "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "entityName": "<entityName>",
    "costingValuationType": "<costingValuationType>",
    "capitalisationExpenseAccountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "costingElementTypeId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "reasonCodeId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "reasonCode": "<reasonCode>",
    "reasonCodeDescription": "<reasonCodeDescription>",
    "currency": "EUR",
    "totalRevaluationAmount": "19.99",
    "active": true,
    "notes": "Reviewed with finance",
    "lineCount": 1,
    "createdDate": "2026-01-15T09:30:00.000Z",
    "lastModifiedDate": "2026-08-18T11:20:04.219Z",
    "lines": [
      {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "itemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "itemCode": "<itemCode>",
        "itemName": "<itemName>",
        "locationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "locationCode": "<locationCode>",
        "locationName": "<locationName>",
        "unitId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "unitCode": "<unitCode>",
        "quantity": "19.99",
        "inventoryQuantity": "19.99",
        "currentUnitCost": "19.99",
        "newUnitCost": "19.99",
        "previousAfterSaleCost": "19.99",
        "newAfterSaleCost": "19.99",
        "revaluationAmount": "19.99",
        "status": "<status>",
        "notes": "<notes>",
        "batches": [
          {
            "batchNumberId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "batchNumber": "<batchNumber>",
            "quantity": "19.99",
            "currentUnitCost": "19.99",
            "newUnitCost": "19.99"
          }
        ],
        "serials": [
          {
            "serialNumberId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "serialNumber": "<serialNumber>",
            "currentUnitCost": "19.99",
            "newUnitCost": "19.99",
            "previousAfterSaleCost": "19.99",
            "newAfterSaleCost": "19.99"
          }
        ]
      }
    ]
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## Response headers

- `Idempotency-Replayed` — Present and `true` only 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 as `false`.

## Errors

| Code | Status |
| --- | --- |
| `NOT_FOUND` | 400 |
| `WRONG_STATUS` | 400 |
| `REFERENCE_NOT_FOUND` | 400 |
| `NO_LINES` | 400 |
| `INVALID_QUANTITY` | 400 |
| `MISSING_CAPITALISATION_ACCOUNT` | 400 |
| `TRACKING_MISMATCH` | 400 |
| `POSTING_REJECTED` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: NOT_FOUND, WRONG_STATUS, REFERENCE_NOT_FOUND, NO_LINES, INVALID_QUANTITY, MISSING_CAPITALISATION_ACCOUNT, TRACKING_MISMATCH, POSTING_REJECTED
- `401` — The request carries no valid access token.
- `403` — Not authorized
- `404` — Not found
- `409` — 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 requests from this client address. The response has no body and no `Retry-After` header.
- `500` — Internal server error
