Maxim

Maxim

Last updated on Oct 8, 2026

Creates a material. The material appears at storage location storage_id and at any storage location that stores all materials or its categories.

v1/materials/add.php

Parameters

Field Type Required Description
name string Yes Name
unit string Yes Unit of measure, a code from Units of Measure
storage_id int Yes Storage location where the stock is created
sku string No SKU
price float No Price per unit. Default 0
stock float No Initial stock at storage location storage_id. Default 0
minimum float No Minimum stock at storage location storage_id. Default 0
notes string No Notes
categories array No Categories: objects with id or name
suppliers array No Suppliers: objects with id

A category can be passed by name: if there is no such category, it is created. The IDs of existing categories and suppliers are returned by v1/categories/get_list and v1/suppliers/get_list.

SKU uniqueness is not checked.

Example request

{
    "name": "Oak board",
    "sku": "M010",
    "unit": "cu m",
    "price": 130000,
    "storage_id": 3998,
    "stock": 2.5,
    "minimum": 0.5,
    "categories": [{ "id": 12 }, { "name": "Hardware" }],
    "suppliers": [{ "id": 45 }]
}

Example response

{
    "success": true,
    "material_id": 2051
}

Errors

Error Reason
No name in input A required field is missing (instead of name, the field's name)
Name must not be empty Empty name
Unit not found Unknown unit of measure, or a resources-only unit
Storage ID not found Storage location not found or deleted
Invalid price value. Must be a number The value is not a number, e.g. "12,5" (same for stock and minimum)
Category 12 not found Category not found
Supplier not found or access denied Supplier not found or deleted