Textile Products API

Reference for Yarn, Fiber, and Fabric product endpoints — specialized textile product types with industry-specific attributes.

Textile products extend the base product model with industry-specific attributes for yarns, fibers, and fabrics. All textile products inherit the full set of BaseProduct fields (name, code, composition, certifications, origin countries, etc.) plus textile-specific fields.

Yarn Products

Endpoints

MethodPathDescription
POST/api/v1/textile/yarnsCreate a yarn product
PATCH/api/v1/textile/yarns/{id}Update a yarn product
POST/api/v1/textile/yarns/bulkBulk upsert yarn products

POST /api/v1/textile/yarns

All BaseProduct fields are accepted, plus the following yarn-specific fields:

FieldTypeRequiredDescription
supplier_idintegerFK to Supplier.id
company_idintegerFK to company
textile_categorystringAuto-set to YARN
yarn_countnumberYarn count (must be positive)
yarn_count_unitstringNE, NM, TEX, DTEX, DENIER
twiststringTwist direction (max 10 chars)
plyintegerNumber of plies (≥ 0)
yarn_typestringType of yarn (max 100 chars)
Shell
curl -X POST "http://localhost:8080/api/v1/textile/yarns?userId=1" \
-H "Content-Type: application/json" \
-d '{
"name": "Egyptian Cotton Ne 40/1",
"code": "YARN-EC-40",
"supplier_id": 3,
"composition": "100% Egyptian Cotton",
"product_origin_country": "EG",
"raw_material_origin_country": "EG",
"yarn_count": 40.0,
"yarn_count_unit": "NE",
"twist": "Z",
"ply": 1,
"yarn_type": "Ring Spun",
"gots_certified": true,
"price_per_unit": 8.50,
"currency": "EUR",
"unit_of_measure": "KG"
}'
JavaScript
const resp = await fetch('/api/v1/textile/yarns?userId=1', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'Egyptian Cotton Ne 40/1',
code: 'YARN-EC-40',
supplier_id: 3,
yarn_count: 40.0,
yarn_count_unit: 'NE',
twist: 'Z',
ply: 1,
yarn_type: 'Ring Spun',
product_origin_country: 'EG'
})
});

Fiber Products

Endpoints

MethodPathDescription
POST/api/v1/textile/fibersCreate a fiber product
PATCH/api/v1/textile/fibers/{id}Update a fiber product
POST/api/v1/textile/fibers/bulkBulk upsert fiber products

POST /api/v1/textile/fibers

All BaseProduct fields are accepted, plus the following fiber-specific fields:

FieldTypeRequiredDescription
supplier_idintegerFK to Supplier.id
company_idintegerFK to company
textile_categorystringAuto-set to FIBER
fiber_typestringType of fiber (max 100 chars)
staple_length_mmnumberStaple length in mm (must be positive)
fineness_micronnumberFiber fineness in microns (must be positive)
fiber_originstringOrigin of the fiber (max 100 chars)
Shell
curl -X POST "http://localhost:8080/api/v1/textile/fibers?userId=1" \
-H "Content-Type: application/json" \
-d '{
"name": "Merino Wool 19.5μm",
"code": "FIB-MW-195",
"supplier_id": 7,
"composition": "100% Merino Wool",
"product_origin_country": "AU",
"fiber_type": "Merino Wool",
"staple_length_mm": 75.0,
"fineness_micron": 19.5,
"fiber_origin": "Australia",
"unit_of_measure": "KG",
"price_per_unit": 22.00,
"currency": "EUR"
}'
JavaScript
const resp = await fetch('/api/v1/textile/fibers?userId=1', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'Merino Wool 19.5μm',
code: 'FIB-MW-195',
supplier_id: 7,
fiber_type: 'Merino Wool',
staple_length_mm: 75.0,
fineness_micron: 19.5,
fiber_origin: 'Australia'
})
});

Fabric Products

Endpoints

MethodPathDescription
POST/api/v1/textile/fabricsCreate a fabric product
PATCH/api/v1/textile/fabrics/{id}Update a fabric product
POST/api/v1/textile/fabrics/bulkBulk upsert fabric products

POST /api/v1/textile/fabrics

All BaseProduct fields are accepted, plus the following fabric-specific fields:

FieldTypeRequiredDescription
supplier_idintegerFK to Supplier.id
company_idintegerFK to company
textile_categorystringAuto-set to FABRIC
width_cmnumberFabric width in cm (must be positive)
areal_mass_gsmnumberAreal mass in g/m² (must be positive)
weave_typestringType of weave, e.g. Plain, Twill, Satin (max 100 chars)
finishstringFabric finish, e.g. Mercerized, Calendered (max 100 chars)
Shell
curl -X POST "http://localhost:8080/api/v1/textile/fabrics?userId=1" \
-H "Content-Type: application/json" \
-d '{
"name": "Organic Cotton Twill 280gsm",
"code": "FAB-OCT-280",
"supplier_id": 3,
"composition": "100% Organic Cotton",
"product_origin_country": "TR",
"raw_material_origin_country": "IN",
"width_cm": 150.0,
"areal_mass_gsm": 280.0,
"weave_type": "Twill",
"finish": "Mercerized",
"gots_certified": true,
"unit_of_measure": "METERS",
"price_per_unit": 5.80,
"currency": "EUR",
"quantity_available": 3000.0
}'
JavaScript
const resp = await fetch('/api/v1/textile/fabrics?userId=1', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'Organic Cotton Twill 280gsm',
code: 'FAB-OCT-280',
supplier_id: 3,
width_cm: 150.0,
areal_mass_gsm: 280.0,
weave_type: 'Twill',
finish: 'Mercerized',
unit_of_measure: 'METERS',
quantity_available: 3000.0
})
});

Bulk Upsert (all textile types)

All three textile endpoints support bulk upsert at /bulk. The request body uses the standard bulk format:

JSON
{
"mode": "UPSERT",
"records": [
{
"name": "Cotton Twill 280gsm",
"code": "FAB-CT-280",
"supplier_id": 3,
"width_cm": 150.0,
"areal_mass_gsm": 280.0,
"weave_type": "Twill"
},
{
"name": "Silk Satin 120gsm",
"code": "FAB-SS-120",
"supplier_id": 3,
"width_cm": 140.0,
"areal_mass_gsm": 120.0,
"weave_type": "Satin"
}
]
}

Response

JSON
{
"created": 1,
"updated": 1,
"failed": 0,
"errors": []
}

Shared Base Product Fields

All textile products inherit these fields from BaseProduct:

FieldTypeDescription
namestringProduct name (required)
codestringProduct code
categorystringProduct category
subcategorystringProduct subcategory
descriptionstringDescription
technical_specsstringTechnical specifications
compositionstringMaterial composition
product_origin_countrystringISO 3166-1 alpha-2
raw_material_origin_countrystringISO 3166-1 alpha-2
unit_of_measurestringMETERS, KG, PIECES, ROLLS
quantity_availablenumberCurrent stock
lead_time_daysintegerLead time in days
price_per_unitnumberPrice per unit
currencystringISO 4217 currency code
minimum_ordernumberMinimum order quantity
product_weight_kgnumberWeight in kg
gots_certifiedbooleanGOTS certification
grs_certifiedbooleanGRS certification
oeko_tex_certifiedbooleanOEKO-TEX certification
recycled_content_percentnumber% recycled content
organic_content_percentnumber% organic content
availablebooleanAvailable (default: true)
metadataobjectCustom JSON metadata