Inventory API

Inventory items are kept in the warehouse like materials and use the same API resources. They are marked with stock = inventory (ordinary materials have materials), so every inventory request filters by it. Stock lots, movements, write-offs and purchase documents work the same way as for materials, described in Materials API. For access, paging, filters and getting only changes, see API basics.

Inventory items

GET /api/material/search?stock==inventory

Example request

curl -g -G 'https://{company}.smarton.app/api/material/search' \
  -H 'Authorization: <token>' \
  --data-urlencode 'stock==inventory' \
  --data-urlencode 'paginate=true' \
  --data-urlencode 'limit=500' \
  --data-urlencode 'partialJoin[materialType][]=name' \
  --data-urlencode 'partialJoin[materialType][]=unit' \
  --data-urlencode 'partialJoin[categories][]=name' \
  --data-urlencode 'partialJoin[defaultSupplier][]=name' \
  --data-urlencode 'sort[id]=asc'

Fields

FieldMeaning
id, nameID and name of the item.
materialTypeThe inventory type; its unit is the item's unit.
categoriesInventory categories of the item.
inStockQuantity in stock now.
minStockMinimum quantity. Items below it are shown in Inventory → minimum quantity.
sumValue of the stock now.
defaultSupplier, suppliersThe usual supplier and all suppliers of the item.
stockinventory.

Items below their minimum quantity: add minStock=>inStock (the minimum is greater than the quantity in stock).

Inventory types and categories

GET /api/material_type/search?stock==inventory
GET /api/material_category/search?stock==inventory&partialJoin[parent][]=name

Types classify the items and give them a unit (name, unit). Categories group the items for filtering (name, parent).

Stock, movements and write-offs

Filter the material stock records by the item's stock:

GET /api/material_quant/search?material.stock==inventory&type=stock&partialJoin[material][]=name&partialJoin[warehouseLocation.warehouse][]=name
GET /api/material_quant_event/search?material.stock==inventory&type==write_off&partialJoin[material][]=name

The fields, the movement types and how to get the stock at a past date are described in Materials API.

Inventory purchases

GET /api/purchase/search?type=inventory&partialJoin[supplier][]=name

Purchase documents of inventory have type = inventory. Their fields and lines are the same as for materials, see Materials API.

Inventory tests

GET /api/material_test/search?material.stock==inventory&partialJoin[material][]=name&partialJoin[supplier][]=name

Quality test results of the items. Fields: date, materialTestStatus (success or fail; empty means not tested yet), lotNumber, material (the item), quant (the stock lot), supplier and files (attached documents).

Inventory tags

GET /api/inventory_tag/search?discriminator=inventory_tag&partialJoin[quant][]=quantity&partialJoin[quant.material][]=name

Tags (labels) attached to inventory in stock. Fields: value (the code on the tag), type, name, isActive, activeFrom, activeTo and quant (the stock lot the tag is on, with its material). Always add discriminator=inventory_tag: the same list also holds other kinds of cards.

With an API key

Inventory items, types, categories, stock, movements and purchases belong to the Purchasing and stock area of an API key. Inventory tests and tags are not available with an API key.