Skip to content

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.

  1. Install InvenTree (it’s included in the ecosystem Docker Compose at port 8000)
  2. Generate an API token in InvenTree: Settings → Security → API Tokens → Add Token
  3. Configure PrintStudio:
Terminal window
INVENTREE_URL=http://localhost:8000
INVENTREE_TOKEN=your-inventree-api-token
DataDirectionFrequency
Material stock levelsInvenTree → PrintStudioEvery 5 minutes
Consumption recordsPrintStudio → InvenTreeAfter each job completion
Reorder requestsPrintStudio → InvenTreeWhen stock hits reorder point
New materialsManual / one-timeVia setup wizard

PrintStudio materials are mapped to InvenTree parts by inventreePartId. Set this when creating a material:

Terminal window
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).

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.

import { IntegrationHub } from "@printstudio/integrations";
const hub = new IntegrationHub({
inventree: {
url: process.env.INVENTREE_URL,
token: process.env.INVENTREE_TOKEN,
},
});
// Get stock for a part
const stock = await hub.inventree.getPartStock(42);
// Adjust stock
await hub.inventree.adjustStock(42, -85, "PrintStudio job JOB-001");

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.