Products API

Reference for SupplierProduct and CompanyProduct REST endpoints, including origin country tracking, logistics fields, and the UnitOfMeasure enum.

Supplier Products

Endpoints

MethodPathDescription
POST/api/supplier-productsCreate a supplier product
PATCH/api/supplier-products/{id}Update a supplier product
POST/api/supplier-products/bulkBulk upsert supplier products

POST /api/supplier-products

Request Body

FieldTypeRequiredDescription
namestringProduct name
skustringStock-keeping unit (unique per supplier)
supplier_idintegerFK to Supplier.id
descriptionstringOptional product description
compositionstringMaterial composition
unit_of_measurestringMETERS, KG, PIECES, ROLLS. Default: KG (New in v1.1.0)
product_origin_countrystringISO 3166-1 alpha-2 where product is made (e.g. IT, CN) (New in v1.1.0)
raw_material_origin_countrystringISO 3166-1 alpha-2 where raw material originates (New in v1.1.0)
quantity_availablenumberCurrent stock quantity (≥ 0) (New in v1.1.0)
lead_time_daysintegerProcurement lead time in days (≥ 0) (New in v1.1.0)
unit_costnumberPurchase price per unit
currencystringISO 4217 currency code
reach_compliantbooleanREACH compliance flag
certificationsarrayList of certification strings
product_weight_kgnumberProduct weight in kg (must be positive)
gots_certifiedbooleanGOTS certification
availablebooleanWhether the product is available. Default: true
Note

v1.1.0product_origin_country and raw_material_origin_country are validated against the full ISO 3166-1 alpha-2 country list. Invalid codes return 400 Bad Request.

Shell
curl -X POST http://localhost:8080/api/supplier-products \
-H "Content-Type: application/json" \
-H "X-User-Id: 1" \
-H "X-API-Key: your-api-key" \
-d '{
"name": "Cotton Fabric 200gsm",
"sku": "FAB-CN-200",
"supplier_id": 1,
"unit_of_measure": "METERS",
"unit_cost": 3.50,
"currency": "EUR",
"reach_compliant": true,
"product_origin_country": "IN",
"raw_material_origin_country": "IN",
"quantity_available": 2500.0,
"lead_time_days": 45,
"certifications": ["GOTS", "OCS"]
}'
JavaScript
const resp = await fetch('/api/supplier-products', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-User-Id': '1',
'X-API-Key': 'your-api-key'
},
body: JSON.stringify({
name: 'Cotton Fabric 200gsm',
sku: 'FAB-CN-200',
supplier_id: 1,
unit_of_measure: 'METERS',
product_origin_country: 'IN',
raw_material_origin_country: 'IN',
quantity_available: 2500.0,
lead_time_days: 45
})
});

POST /api/supplier-products/bulk

Upserts by (sku, supplier_id) combination.

JSON
{
"items": [
{
"name": "Cotton Fabric 200gsm",
"sku": "FAB-001",
"supplier_id": 1,
"unit_of_measure": "METERS",
"product_origin_country": "IN",
"quantity_available": 2500.0,
"lead_time_days": 45
},
{
"name": "Polyester Lining",
"sku": "FAB-002",
"supplier_id": 1,
"unit_of_measure": "METERS",
"product_origin_country": "CN"
}
]
}

UnitOfMeasure Enum

New in v1.1.0

ValueMeaningTypical Use
KGKilograms — defaultRaw materials sold by weight
METERSLinear metresFabric, ribbon, tape
PIECESIndividual itemsButtons, zippers, accessories
ROLLSFull rollsFabric reels, paper

Company Products

Endpoints

MethodPathDescription
POST/api/company-productsCreate a company product
PATCH/api/company-products/{id}Update a company product
POST/api/company-products/bulkBulk upsert company products

POST /api/company-products

All fields from BaseProduct apply here as well, including the new v1.1.0 fields.

Request Body

FieldTypeRequiredDescription
namestringProduct name
skustringStock-keeping unit (unique)
unit_of_measurestringMETERS, KG, PIECES, ROLLS. Default: KG (New in v1.1.0)
product_origin_countrystringISO 3166-1 alpha-2 (New in v1.1.0)
raw_material_origin_countrystringISO 3166-1 alpha-2 (New in v1.1.0)
quantity_availablenumberCurrent stock quantity (≥ 0) (New in v1.1.0)
lead_time_daysintegerLead time in days (≥ 0) (New in v1.1.0)
barcodestringEAN / GTIN barcode
unit_sale_pricenumberSelling price per unit
sustainability_scoreintegerESG score 0–100
recycled_content_percentnumberPercentage of recycled content
availablebooleanWhether the product is available. Default: true
Shell
curl -X POST http://localhost:8080/api/company-products \
-H "Content-Type: application/json" \
-H "X-User-Id: 1" \
-H "X-API-Key: your-api-key" \
-d '{
"name": "Eco Tote Bag",
"sku": "TOTE-ECO-001",
"barcode": "8032123456789",
"unit_of_measure": "PIECES",
"unit_sale_price": 12.90,
"sustainability_score": 85,
"recycled_content_percent": 40.0,
"product_origin_country": "TR",
"raw_material_origin_country": "IN",
"quantity_available": 1500.0,
"lead_time_days": 30
}'
JavaScript
const resp = await fetch('/api/company-products', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-User-Id': '1',
'X-API-Key': 'your-api-key'
},
body: JSON.stringify({
name: 'Eco Tote Bag',
sku: 'TOTE-ECO-001',
unit_of_measure: 'PIECES',
sustainability_score: 85,
product_origin_country: 'TR',
raw_material_origin_country: 'IN',
quantity_available: 1500.0,
lead_time_days: 30
})
});