Inventory
Inventory routes
Manage green coffee inventory, generate share links, and keep stocked state accurate through session-authenticated product routes.
Inventory is where public catalog data becomes account-owned operational data. The core route is /api/beans, backed by session auth for writes and optional share-token reads for scoped external viewing.
Inventory IDs are not catalog IDs. Roast and downstream workflows use green_coffee_inv.id values.
Endpoints
| Route | Methods | Auth | Purpose |
|---|---|---|---|
| /api/beans | GET POST PUT DELETE | GET: session or share token; writes: session | Inventory CRUD plus shared-link reads |
| /api/share | POST | Session | Create share links for one bean or the whole inventory |
| /api/update-stocked-status | POST PUT | Session | Recalculate stocked status for one item or the entire account |
Mutation behavior
- POST /api/beans can create manual catalog entries when no catalog_id is supplied and manual_name is present.
- PUT /api/beans requires an id query parameter and filters updates down to known inventory columns before writing.
- DELETE /api/beans requires an id query parameter and enforces ownership before removing inventory and dependent data.
- POST /api/update-stocked-status recalculates one item by coffee_id. PUT scans the caller's full inventory and batch-updates any mismatched stocked flags.
Inventory IDs drive roast workflows
Roast creation, Artisan imports, and several CLI commands expect green_coffee_inv.id values, not coffee_catalog IDs. Use the inventory surface or CLI inventory list to find the correct IDs.
CLI access
List stocked inventory
purvey inventory list --stocked --prettyInspect add flags
purvey inventory add --help