Chemical Products API

Reference for ChemicalProduct CRUD endpoints — create, update, list, archive, bulk upsert, and CAS number search.

Endpoints

MethodPathDescription
GET/api/v1/chemicalsList chemical products (paginated + filtered)
GET/api/v1/chemicals/{id}Get a chemical product by ID
GET/api/v1/chemicals/searchSearch by CAS number
POST/api/v1/chemicalsCreate a chemical product
PATCH/api/v1/chemicals/{id}Update a chemical product
POST/api/v1/chemicals/bulkBulk upsert chemical products
DELETE/api/v1/chemicals/{id}Archive a chemical product (soft delete)

GET /api/v1/chemicals

Query Parameters

ParameterTypeDefaultDescription
pageinteger0Zero-based page index
sizeinteger20Items per page
categorystringFilter by chemical category
complianceStatusstringFilter by compliance status
pfasContentbooleanFilter by PFAS content
searchstringFree-text search
Shell
curl "http://localhost:8080/api/v1/chemicals?category=DYES&search=blue&size=10"

GET /api/v1/chemicals/search

Search chemical products by CAS number. Supports exact and partial matching.

ParameterTypeDefaultDescription
casNumberstringCAS number to search for
partialbooleanfalseEnable partial matching
pageinteger0Page index
sizeinteger20Page size
Shell
curl "http://localhost:8080/api/v1/chemicals/search?casNumber=2580-78-1"
curl "http://localhost:8080/api/v1/chemicals/search?casNumber=2580&partial=true"

POST /api/v1/chemicals

Request Body

FieldTypeRequiredDescription
chemical_namestringChemical name
commercial_namestringCommercial/trade name
internal_codestringInternal product code
cas_numbersarrayCAS Registry Numbers
ec_numberstringEC number
chemical_formulastringChemical formula
chemical_categorystringCategory
subcategorystringSubcategory
user_idintegerCreator user ID
company_idintegerCompany ID
metadataobjectArbitrary JSON key-value pairs

The request also supports nested objects for compliance and supplier data:

Compliance Fields (nested under compliance)

FieldTypeDescription
reach_compliantbooleanREACH regulation compliant
reach_registration_numberstringREACH registration number
zdhc_levelstringLEVEL_1, LEVEL_2, LEVEL_3, NOT_LISTED
zdhc_gateway_idstringZDHC Gateway ID
gots_compliantbooleanGOTS compliant
grs_compliantbooleanGRS compliant
svhc_substancebooleanIs SVHC substance
pfas_contentbooleanContains PFAS

Supplier Fields (nested under supplier)

FieldTypeDescription
supplier_namestringChemical supplier name
supplier_codestringSupplier code
contact_emailstringContact email
countrystringSupplier country
Shell
curl -X POST http://localhost:8080/api/v1/chemicals \
-H "Content-Type: application/json" \
-d '{
"chemical_name": "Reactive Blue 19",
"commercial_name": "Remazol Brilliant Blue R",
"cas_numbers": ["2580-78-1"],
"chemical_category": "DYES",
"user_id": 1,
"company_id": 1,
"compliance": {
"reach_compliant": true,
"zdhc_level": "LEVEL_2",
"svhc_substance": false
},
"supplier": {
"supplier_name": "ChemCo GmbH",
"country": "DE"
}
}'
JavaScript
const resp = await fetch('/api/v1/chemicals', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
chemical_name: 'Reactive Blue 19',
cas_numbers: ['2580-78-1'],
chemical_category: 'DYES',
compliance: { reach_compliant: true, zdhc_level: 'LEVEL_2' },
supplier: { supplier_name: 'ChemCo GmbH', country: 'DE' }
})
});

DELETE /api/v1/chemicals/{id}

Archives a chemical product (soft delete — sets archived = true).

Shell
curl -X DELETE http://localhost:8080/api/v1/chemicals/42

Response: 204 No Content


POST /api/v1/chemicals/bulk

Bulk upserts chemical products.

JSON
{
"items": [
{
"chemical_name": "Reactive Blue 19",
"cas_numbers": ["2580-78-1"],
"chemical_category": "DYES"
},
{
"chemical_name": "Sodium Hydroxide",
"cas_numbers": ["1310-73-2"],
"chemical_category": "BASES"
}
]
}