Skip to main content
Staffify Docs
Updated
Docs/Workspace API/Stock items

Stock items

Material and inventory tracking (CV-filters, kraanleertjes, sifons) layered on top of your product catalog. Each stock item is a sidecar on a CRM product — the API resource id is the product id. Quantity mutations go through an append-only ledger (stock_movements) so you have an audit history of every bijboeking, afboeking, retour and consume.
Scopes: operations.stock.read / operations.stock.write.

Field Service module required. These endpoints require the Field Service module to be enabled on your workspace. Calls return 403 MODULE_VAKMAN_DISABLED otherwise.

Endpoints

GET/api/workspace/v1/stock-items
GET/api/workspace/v1/stock-items/{productId}
PATCH/api/workspace/v1/stock-items/{productId}
POST/api/workspace/v1/stock-items/{productId}/adjust
GET/api/workspace/v1/stock-items/{productId}/movements

The stock item object

FieldTypeDescription
product_idintegerIdentical to the product id from the CRM products API — stock is a sidecar
namestringProduct name (inherited from the product)
skustringProduct SKU
unitstringUnit of measure (stuk, meter, liter, kg, ...)
is_stock_trackedbooleanWhether stock is actively tracked
stock_currentintegerCurrent on-hand quantity
stock_min_thresholdintegerLow-stock threshold — fires stock.low_threshold event when crossed
stock_locationstringShelf/aisle/warehouse label
ean_barcodestringEAN-13 barcode for scanner workflows
supplier_namestringDefault supplier label
last_stock_movement_atstring(ISO)When the most recent adjust happened

The stock movement object

Movements are append-only. Every adjust creates one row with a signed delta and the resulting on-hand quantity. Combined with the five movement types, this gives you full root-cause attribution of any stock change.

FieldTypeDescription
idintegerMovement id (append-only ledger)
product_idintegerThe stock item that was mutated
movement_typeenumworkorder_consume | manual_adjust | purchase_receive | return | opening_balance
quantity_deltaintegerSigned delta — positive for receives/returns, negative for consume/adjust-down
stock_afterintegerOn-hand quantity after this movement
workorder_idintegerLinks the movement to a work order when the technician consumed material
notesstringFree-form movement notes
created_atstring(ISO)When the movement was recorded

Set tracking + initial balance

Use PATCH to turn tracking on, set a threshold, pin a shelf location, and optionally seed an opening balance. Settings and quantity in a single idempotent call.

curl "https://app.staffifyai.com/api/workspace/v1/stock-items/842" \
  -X PATCH \
  -H "Authorization: Bearer sfy_wsp_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "is_stock_tracked": true,
    "stock_current": 25,
    "stock_min_threshold": 5,
    "stock_location": "Magazijn A3",
    "ean_barcode": "4260182982266",
    "supplier_name": "Rexel Benelux"
  }'

Register a purchase receive (bijboeking)

POST to /adjust with a positive quantity_delta and movement_type: "purchase_receive". The response contains the updated stock item. Negative delta that would push on-hand below 0 returns 422 INSUFFICIENT_STOCK.

curl "https://app.staffifyai.com/api/workspace/v1/stock-items/842/adjust" \
  -X POST \
  -H "Authorization: Bearer sfy_wsp_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "quantity_delta": 12,
    "movement_type": "purchase_receive",
    "notes": "PO 2026-10-184 Rexel"
  }'

Stop tracking

There is no DELETE on stock items — stock is a sidecar on the CRM product. To stop tracking a product, PATCH is_stock_tracked to false. The movement history is kept and the sidecar row stays, so you can resume tracking later without losing the audit trail.

Events

  • stock.upserted — settings changed via PATCH
  • stock.adjusted — quantity changed via /adjust
  • stock.low_threshold — fires whenever an adjust leaves the on-hand quantity at or below stock_min_threshold
Stock items - Workspace API - Staffify