Inventory & orders API — SmartCut API Reference
Version Ecommerce
Store endpoints for managing inventory and tracking order progress.
## Inventory
Inventory is a two-level hierarchy. A material is a product line ("18mm Oak MFC") identified by a code that is unique within your store. A stock item is one cuttable sheet or length beneath it, carrying its own dimensions and quantity.
Stock is addressed under its material — POST /ecommerce/api/materials/{id}/stock — so the parent link comes from the URL and is never something you send.
Inheritance: stock inherits cost, grain, category, extras and the other shared fields from its material, so you only set what differs. Reads always return the effective values. Setting an inherited field on a stock item pins it, and it will no longer follow later edits to the material; set it to null to resume inheriting.
Quantities: use POST /ecommerce/api/stock/{id}/adjust with a relative delta rather than PATCH-ing q. The adjust endpoint is atomic, so concurrent callers cannot oversell, and it never deletes a row that reaches zero.
## Order workflow
Order status progression: pending → cut → complete → dispatched
Part tracking: Each basket item contains an array of input parts. Use numberCut to track how many of each part type have been cut, and numberComplete to track how many have been fully completed. Parts are identified by partIndex (their position in the basket item's parts array).
## Errors
Validation failures return 400 with a machine-readable code and an errors array naming each offending field. Unrecognised fields are rejected rather than ignored, so a misspelled key is never silently dropped.
Authentication: All endpoints require an API key and an active ecommerce subscription.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /ecommerce/api/materials | List materials |
| POST | /ecommerce/api/materials | Create materials |
| GET | /ecommerce/api/materials/by-code/{code} | Get a material by code |
| PUT | /ecommerce/api/materials/by-code/{code} | Create or update a material by code |
| GET | /ecommerce/api/materials/{id} | Get a material |
| PATCH | /ecommerce/api/materials/{id} | Update a material |
| DELETE | /ecommerce/api/materials/{id} | Delete a material |
| GET | /ecommerce/api/materials/{id}/stock | List stock under a material |
| POST | /ecommerce/api/materials/{id}/stock | Create stock under a material |
| GET | /ecommerce/api/stock | List stock |
| GET | /ecommerce/api/stock/{id} | Get a stock item |
| PATCH | /ecommerce/api/stock/{id} | Update a stock item |
| DELETE | /ecommerce/api/stock/{id} | Delete a stock item |
| POST | /ecommerce/api/stock/{id}/adjust | Adjust stock quantity |
| PATCH | /ecommerce/orders/{id} | Update order status |
| PATCH | /ecommerce/orders/parts/mark-cut | Mark parts as cut |
| PATCH | /ecommerce/orders/parts/mark-complete | Mark parts as complete |
Machine-readable specification:
/openapi/ecommerce.json.
Authentication is the raw API key in the Authorization header,
with no Bearer prefix.