Materials API
For access, paging, filters and getting only changes, see API basics.
All endpoints below are search/list endpoints that support pagination and join-expansion.
1. Materials
Endpoint
GET /api/material/search
Purpose
Returns a list of materials from inventory, optionally including related entities such as categories, tags, suppliers, types, etc.
Example Request
curl 'https://{{domain}}/api/material/search?limit=50&offset=0&paginate=true&join%5B%5D=categories&join%5B%5D=tags&join%5B%5D=materialType&join%5B%5D=materialType.photo&join%5B%5D=defaultSupplier&join%5B%5D=suppliers&join%5B%5D=defaultQuant&stock=materials%20%7C%7C%20material' \
-H 'accept: application/json' \
-H 'authorization: <TOKEN>' \
-H 'content-type: application/x-www-form-urlencoded; charset=UTF-8'Query Parameters Used
Parameter | Meaning |
|---|---|
limit=50 | Return 50 materials. |
offset=0 | Start from first result. |
paginate=true | Include pagination metadata. |
join[]=categories | Expand material categories. |
join[]=tags | Expand material tags. |
join[]=materialType | Expand material type object. |
join[]=materialType.photo | Expand the photo linked to the type. |
join[]=defaultSupplier | Expand default supplier. |
join[]=suppliers | Expand all linked suppliers. |
join[]=defaultQuant | Expand default quantity/unit. |
`stock=materials |
2. Material Types
Endpoint
GET /api/material_type/search
Purpose
Fetches available material types (grouping/classification for materials). Useful for filtering or UI dropdowns.
Example Request
curl 'https://{{domain}}/api/material_type/search?limit=50&offset=0&paginate=true&join%5B%5D=photo&stock=materials' \
-H 'accept: application/json' \
-H 'authorization: <TOKEN>' \
-H 'content-type: application/x-www-form-urlencoded; charset=UTF-8'Query Parameters Used
Parameter | Meaning |
|---|---|
limit=50, offset=0, paginate=true | Standard paging. |
join[]=photo | Expand the type photo object. |
stock=materials | Filter by materials stock scope. |
3. Material Purchases
Endpoint
GET /api/purchase/search
Purpose
Returns purchasing records (incoming material stock). Includes invoice/slip files and partial expansions for related entities.
Example Request
curl 'https://{{domain}}/api/purchase/search?limit=50&offset=0&paginate=true&join%5B%5D=invoiceFile&join%5B%5D=slipFile&partialJoin%5Bpayments%5D%5B%5D=sum&partialJoin%5Bquants%5D%5B%5D=name&partialJoin%5Bquants.material%5D%5B%5D=name%2C%20alias&partialJoin%5Bproducts%5D%5B%5D=name&partialJoin%5Bsupplier%5D%5B%5D=name&partialJoin%5Bsupplier.country%5D%5B%5D=name&partialJoin%5Bsupplier.country.regions%5D%5B%5D=name&partialJoin%5BcreatedBy%5D%5B%5D=firstName&partialJoin%5BwarehouseLocation%5D%5B%5D=name&partialJoin%5BwarehouseLocation.warehouse%5D%5B%5D=name&sort%5BcreatedAt%5D=desc' \
-H 'accept: application/json' \
-H 'authorization: <TOKEN>' \
-H 'content-type: application/x-www-form-urlencoded; charset=UTF-8'Query Parameters Used
Parameter | Meaning |
|---|---|
join[]=invoiceFile | Include invoice file object. |
join[]=slipFile | Include slip file object. |
partialJoin[payments][]=sum | Include only sum from payments. |
partialJoin[quants][]=name | Include only quant name. |
partialJoin[quants.material][]=name, alias | For quant’s material, include only name & alias. |
partialJoin[products][]=name | Include only product names. |
partialJoin[supplier][]=name | Include only supplier name. |
partialJoin[supplier.country][]=name | Supplier country name only. |
partialJoin[supplier.country.regions][]=name | Supplier region names only. |
partialJoin[createdBy][]=firstName | Creator first name only. |
partialJoin[warehouseLocation][]=name | Warehouse location name only. |
partialJoin[warehouseLocation.warehouse][]=name | Parent warehouse name only. |
sort[createdAt]=desc | Most recent purchases first. |
Purchasing and stock for reporting
The sections below are for reporting and back-office integrations: suppliers, purchase documents with their lines, stock and its value, stock movements and write-offs, and creating purchase documents from another system. For access, paging, filters and getting only changes, see API basics.
Suppliers
GET /api/supplier/search?paginate=true&limit=500&sort[id]=asc
Fields: id, name, code (company code), vatCode, address, phone, email, paymentPeriod, bank details. Suppliers have no updatedAt: reload the list in full from time to time.
Purchase documents
A purchase document (purchase) is the supplier's invoice and the goods received with it.
GET /api/purchase/search
Example request
curl -g -G 'https://{company}.smarton.app/api/purchase/search' \
-H 'Authorization: <token>' \
--data-urlencode 'paginate=true' \
--data-urlencode 'limit=200' \
--data-urlencode 'date=>=2026-10-01&<=2026-10-31' \
--data-urlencode 'partialJoin[supplier][]=name' \
--data-urlencode 'partialJoin[supplier][]=code' \
--data-urlencode 'partialJoin[warehouseLocation][]=name' \
--data-urlencode 'partialJoin[warehouseLocation.warehouse][]=name' \
--data-urlencode 'sort[date]=asc'
Fields
| Field | Meaning |
|---|---|
id | Unique ID. |
invoiceNumber, date | Supplier's invoice number and date. |
supplier | The supplier. |
type | materials, products, services, inventory, assets, expenses or general. |
status | unconfirmed → confirmed → received → closed. A return to the supplier is a separate document with status storno or returned, negative quantities and creditedPurchase pointing to the original. |
warehouseLocation | Where the goods were received; warehouseLocation.warehouse is the warehouse. |
invoiceSumWithoutVat, invoiceVatSum, invoiceTotal | Totals without VAT, VAT and with VAT. |
discountPercent, discountSum | Discount of the whole document. Lines have no discount of their own. |
transportPrice, duty, otherCosts | Extra costs. |
realArrival | When the goods arrived. |
isPaid, paidAmount, payDue | Payment of the invoice. |
namespace | The unit, for companies with several locations. |
Purchase lines
Material lines are stock records (material_quant) that point to the document:
GET /api/material_quant/search?purchase.id=55&type=purchase|arrived|unverified&partialJoin[material][]=name&partialJoin[material.materialType][]=unit&join[]=vat&partialJoin[warehouseLocation.warehouse][]=name
| Field | Meaning |
|---|---|
material | The material; its unit is material.materialType.unit. |
quantity | Quantity. |
unitPrice | Unit price without VAT. |
unitPriceVat | VAT amount per unit (not the price with VAT). |
sum | Line amount without VAT, after the document discount. |
vat | VAT rate. |
type | purchase (ordered), arrived (received into stock) or unverified (read from a scanned invoice, not yet checked). |
Lines for products, services, assets and expenses are products: GET /api/product/search?purchase.id=55&status=purchase|arrived&join[]=vat, with price (unit price without VAT), priceVat (VAT per unit) and storedQuantity.
Stock and its value
GET /api/material_quant/search?type=stock&partialJoin[material][]=name&partialJoin[material.materialType][]=unit&partialJoin[warehouseLocation][]=name&partialJoin[warehouseLocation.warehouse][]=name&paginate=true&limit=500
The stock that is in the warehouses now, in lots. Each row has material, quantity, unitPrice (value of one unit), sum (value of the lot), warehouseLocation and its warehouse, lotNumber and expireAt. Add up the rows per material and warehouse. The totals of a material are also on the material: inStock (quantity) and sum (value).
Warehouses: GET /api/warehouse/search; locations inside them: GET /api/warehouse_location/search?partialJoin[warehouse][]=name.
Stock movements and write-offs
GET /api/material_quant_event/search
Example request
Write-offs in October 2026:
curl -g -G 'https://{company}.smarton.app/api/material_quant_event/search' \
-H 'Authorization: <token>' \
--data-urlencode 'paginate=true' \
--data-urlencode 'limit=500' \
--data-urlencode 'type==write_off' \
--data-urlencode 'date=>=2026-10-01T00:00:00Z&<2026-11-01T00:00:00Z' \
--data-urlencode 'partialJoin[material][]=name' \
--data-urlencode 'partialJoin[quant.warehouseLocation.warehouse][]=name' \
--data-urlencode 'sort[date]=asc'
Every change of stock is a movement. Fields: type, date, material, quant (the stock lot), transactionQuantity and transactionSum (quantity and value moved), remainingQuantity and remainingSum (what the lot had left after it), invoiceNumber and supplier for receipts, order and production for use in sales and production, and comments.
| type | Meaning |
|---|---|
stock_in, restock, restock_past | Received into stock (restock_past: received with an earlier date). |
to_production, consumed | Used for sales and production. |
write_off | Written off. The reason is the text in comments. |
return | Returned to the supplier. |
damaged | Marked as damaged. |
inventorization, edit | Stock count or manual correction. |
Stock at a past date. For each lot (quant), take its last movement with date on or before that date. Its remainingQuantity and remainingSum are the lot's quantity and value at that moment. Add them up per material and warehouse.
Creating purchase documents
Another system can create a purchase document and receive the goods into stock. It takes several calls; create requests are sent as form data (application/x-www-form-urlencoded) and return {"status": 1, "data": <id>}.
- Look up the IDs you need: the supplier (
supplier/search, for example bycode), the materials (material/search), the VAT rates (vat/search) and the warehouse location (warehouse_location/search). - Check that the document is not there yet:
GET /api/purchase/search?supplier.id=2&invoiceNumber==INV-123. If it is, update it instead of creating a new one. - Create the document:
POST /api/purchase/createwithsupplier,invoiceNumber,date,type=materialsandwarehouseLocation. The answer has its ID. - Add the lines:
POST /api/material_quant/purchasewithpurchase(the ID),invoiceNumber,dateanditems, one entry per line withmaterial,quantity,unitPrice(amount and currency),vatandwarehouseLocation. As form fields:purchase=55&invoiceNumber=INV-123&date=2026-10-10 &items[0][material]=3&items[0][quantity]=12&items[0][unitPrice][amount]=1.25&items[0][unitPrice][currency]=EUR&items[0][vat]=1&items[0][warehouseLocation]=2 &items[1][material]=7&…
The same can be sent as a JSON body. - Confirm it:
POST /api/purchase/updatewithidandstatus=confirmed. - Receive the goods into stock, if they have arrived:
POST /api/purchase/receivewithidandpositions, one entry per line with itsid(returned in step 4) andwarehouseLocation. AddinvoiceDateto receive them with the invoice date.
Smarton has no field for your own document ID, so use the supplier and invoice number as the key, and keep the Smarton IDs on your side to send corrections with purchase/update. Documents are easier to correct before they are received; after that, a correction is made with a return document. Sending production documents from another system is not supported.
English