InvenTree
InvenTree is an open-source inventory management system. PrintStudio can sync material stock levels with InvenTree bidirectionally, so filament spools and laser sheets tracked in InvenTree automatically flow into PrintStudio’s inventory system.
- Install InvenTree (it’s included in the ecosystem Docker Compose at port 8000)
- Generate an API token in InvenTree: Settings → Security → API Tokens → Add Token
- Configure PrintStudio:
INVENTREE_URL=http://localhost:8000INVENTREE_TOKEN=your-inventree-api-tokenWhat Syncs
Section titled “What Syncs”| Data | Direction | Frequency |
|---|---|---|
| Material stock levels | InvenTree → PrintStudio | Every 5 minutes |
| Consumption records | PrintStudio → InvenTree | After each job completion |
| Reorder requests | PrintStudio → InvenTree | When stock hits reorder point |
| New materials | Manual / one-time | Via setup wizard |
Material Mapping
Section titled “Material Mapping”PrintStudio materials are mapped to InvenTree parts by inventreePartId. Set this when creating a material:
curl -X POST http://localhost:8787/api/inventory/materials \ -H "Content-Type: application/json" \ -H "X-API-Key: your-api-key" \ -d '{ "name": "PLA Black 1.75mm", "type": "filament", "quantity": 1000, "unit": "g", "inventreePartId": 42, "reorderPoint": 200 }'The inventreePartId is the numeric part ID in InvenTree (visible in the URL when viewing a part).
Consumption Tracking
Section titled “Consumption Tracking”When a job completes, PrintStudio records the actual material used (from slicer estimates or sensor data) and posts a stock adjustment to InvenTree:
PrintStudio: job complete, used 85g PLA Black → InvenTree: POST /api/stock/adjust/ { part: 42, quantity: -85, notes: "PrintStudio job JOB-001" }This keeps InvenTree as the single source of truth for inventory accounting.
Via IntegrationHub
Section titled “Via IntegrationHub”import { IntegrationHub } from "@printstudio/integrations";
const hub = new IntegrationHub({ inventree: { url: process.env.INVENTREE_URL, token: process.env.INVENTREE_TOKEN, },});
// Get stock for a partconst stock = await hub.inventree.getPartStock(42);
// Adjust stockawait hub.inventree.adjustStock(42, -85, "PrintStudio job JOB-001");Troubleshooting
Section titled “Troubleshooting”Sync not running — Check that INVENTREE_URL and INVENTREE_TOKEN are set. Run curl http://localhost:8000/api/part/ with your token to verify connectivity.
Stock drift — If InvenTree and PrintStudio are out of sync, trigger a manual resync: POST /api/inventory/sync/inventree with your admin API key.
“Part not found” — Verify the inventreePartId matches an actual part in InvenTree. Delete and re-create the material mapping if needed.