Inventories

Set absolute inventory levels by (product, variant, outlet) tuple

Upserts absolute on-hand quantities for a list of (productId, variantId, outletId) tuples scoped to the API-key company. Existing live rows are overwritten; missing rows are created. Writes exactly the tuples supplied — no outlet fan-out, no zero-fill. Does NOT revive soft-deleted rows (a soft-deleted tuple is re-inserted as a new live row). Records StockChange RECOUNT history for managed tuples whose quantity changed.

post/v1/inventories/set-levels

Request

  • Base URL: https://api.finalpos.com (the document declares no server; this is the origin it was published from)
  • URL: https://api.finalpos.com/v1/inventories/set-levels
  • Auth: API key in header x-api-key

Request body

Example request

{
  "items": [
    {
      "productId": "6650a1f77bcf86cd79943011",
      "variantId": "6650a1f77bcf86cd79943012",
      "outletId": "6650a1f77bcf86cd79943013",
      "quantity": 10,
      "manageStock": true,
      "expectedQuantity": 96,
      "idempotencyKey": "sarnia:baseline:b54c8f9e-4c6a-4f5a-9d2e-7a1b3c9d0e2f"
    }
  ]
}

Response

statusCodenumber required

HTTP status code

messagestring required

Result message

matchednumber required

Existing tuples matched by (productId, variantId, outletId)

upsertednumber required

New inventory rows inserted

modifiednumber required

Existing rows whose quantity/manageStock changed

Example response

{
  "statusCode": 200,
  "message": "Inventory levels set successfully.",
  "matched": 8,
  "upserted": 2,
  "modified": 5,
  "results": [
    {
      "variantId": "6650a1f77bcf86cd79943012",
      "outletId": "6650a1f77bcf86cd79943013",
      "updatedQuantity": 42,
      "error": "outlet not found in this company"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.