When to use this endpoint

Use for mapped inventory-row corrections. Omitted fields retain saved values. This is not a stock movement or warehouse balance reconciliation.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session. These handlers perform no additional stock, finance, page-role, department or owner check; UI button permissions are not server authorization.

Data is scoped to the authenticated tenant. Session CSRF, signed-request checks and account routing still apply. No stockTracking feature gate is enforced in these handlers.

Requires tenant upgrade 796: stock bundle, storage and inventory tables must have deleted/ddate columns before deploying these handlers.

Parameters

ParameterTypeRequiredDescription
idInteger-compatible scalar or native arrayYesPositive integer ID or non-empty native array of positive IDs. Every target must exist before writing; the entire batch commits or rolls back together.
stockIDInteger-compatible scalarNoMaps to inventory.stock_id. Non-negative integer; no catalog costing-default lookup occurs on update.
nameStringNoInventory row name, maximum 100 characters. Does not change the catalog name.
supplierIDInteger-compatible scalarNoNon-negative scalar supplier ID; assign through this alias, not supplier.
supplierObjectNoComposite input is rejected. Use supplierID/storageID; primary IDs cannot be assigned through a composite value.
storageIDInteger-compatible scalarNoNon-negative integer linkage. No linked-record existence validation is added here.
storageObjectNoComposite input is rejected. Use supplierID/storageID; primary IDs cannot be assigned through a composite value.
goodReceivedIDInteger-compatible scalarNoNon-negative integer linkage. No linked-record existence validation is added here.
qtyFinite numeric scalarNoFinite numeric inventory-row value. Numeric strings are accepted and fractions preserved; this does not update catalog costs/prices or warehouse stock.
costFinite numeric scalarNoFinite numeric inventory-row value. Numeric strings are accepted and fractions preserved; this does not update catalog costs/prices or warehouse stock.
priceFinite numeric scalarNoFinite numeric inventory-row value. Numeric strings are accepted and fractions preserved; this does not update catalog costs/prices or warehouse stock.
referenceStringNoBatch/serial text, maximum 100 characters. Not automatically generated or made unique.
receivedDateYYYY-MM-DD or blankNoMust round-trip as a real SQL date or be blank. Blank becomes SQL NULL; it is not the creation date.
cdateUnix seconds or date/time stringNoSupplied valid Unix timestamp/date-time value replaces the inventory creation timestamp.
lastEditedUnix seconds or date/time stringNoIgnored input; changed saves use server Unix seconds.

Example request

$saved = FM_api('StockInventory_updateData', ['id'=>'1042', 'name'=>'Filter cartridge', 'qty'=>'2.5']);

Example response

{"ok":1}

Errors and unusual responses

ResponseCondition
{"error":"not logged in"}No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs.
{"error":"missing or invalid parameter: id"}Missing, malformed, zero or empty target IDs.
{"error":"inventory does not exist"}At least one target does not exist; nothing is saved.
{"error":"use supplierID/storageID instead of composite values"}supplier or storage composite input is supplied.
{"error":"invalid date parameter: receivedDate"}Invalid non-blank SQL date.
{"warning":"No Change."}Supplied mapped values already match.
{"warning":"no updated fields."}No writable mapped values supplied.
{"error":"inventory write failed"}A primary write or history insert fails; the transaction rolls back.
{"error":"inventory read failed"}Target lookup fails.
{"error":"inventory transaction failed"}Transaction begin/commit fails.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Only stock_inventories is updated; IDs never address the stock catalog. Primary IDs and supplied lastEdited cannot be written. Composite supplier/storage writes are rejected; use their scalar ID aliases.
  • Every ID in a bulk request is validated and locked before writing. Values and Core_log-compatible history rows commit together, or the transaction rolls back; a failed write does not return ok.
  • Finite decimal quantities, costs and prices are retained. UI readonly metadata is not authorization; mapped inventory corrections remain writable. No foreign-record validation or warehouse/movement reconciliation is performed.
  • Changed saves set last_edited to server Unix seconds; unchanged values produce the No Change warning without history. Text compares as text, and null is distinct from zero.
  • No exact caller was found in current app JavaScript or m/www for this office endpoint; app stock quantities use separate mobile sync/transaction paths.

Side effects

  • Changed rows, server edit timestamps, inventory cache invalidation and mapped history are committed together. Does not update stock catalog fields, warehouse in_stock, movement history, notifications or configured events.

See it in Fieldmotion

CRM1

No direct CRM1 caller was found for this exact endpoint; the legacy Stock page uses its separate catalog/container APIs.

CRM2

The Layout stockInventory mapping uses this route for inventory saves; the Stock Inventory/Stock Location lists use StockInventories_getDataTable. Filter Network for StockInventory_updateData when saving a mapped inventory layout.

Related endpoints