Skip to main content

Spools API

Manage filament spool inventory.

List Spools

GET /api/v1/spools

Query Parameters:

ParameterTypeDescription
skipintRecords to skip (default: 0)
limitintRecords per page (default: 20, max: 100)
material_typestringFilter by material (PLA, PETG, etc.)
brandstringFilter by brand
colorstringFilter by color
in_stockboolFilter by availability

Example:

curl 'http://localhost:8000/api/v1/spools?material_type=PLA&limit=10' \
-H 'Authorization: Bearer eyJ...'

Response:

{
"items": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"material_type": "PLA",
"brand": "Polymaker",
"color": "Black",
"color_hex": "#000000",
"finish": "Matte",
"diameter_mm": 1.75,
"net_weight_grams": 1000,
"remaining_weight_grams": 750,
"spool_weight_grams": 200,
"purchase_price": 25.00,
"cost_per_gram": 0.025,
"supplier": "Amazon",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
],
"total": 42,
"skip": 0,
"limit": 10
}

Get Spool

GET /api/v1/spools/{id}

Response:

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"material_type": "PLA",
"brand": "Polymaker",
"color": "Black",
...
}

Create Spool

POST /api/v1/spools
Content-Type: application/json

{
"material_type": "PLA",
"brand": "Polymaker",
"color": "Black",
"color_hex": "#000000",
"finish": "Matte",
"diameter_mm": 1.75,
"net_weight_grams": 1000,
"spool_weight_grams": 200,
"purchase_price": 25.00,
"supplier": "Amazon",
"purchase_date": "2024-01-01",
"notes": "Good quality, consistent diameter"
}

Response: 201 Created

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"material_type": "PLA",
...
}

Update Spool

PATCH /api/v1/spools/{id}
Content-Type: application/json

{
"remaining_weight_grams": 500,
"notes": "Updated after print job"
}

Response: 200 OK

Delete Spool

DELETE /api/v1/spools/{id}

Response: 204 No Content

Deduct Weight

Deduct material from spool after use:

POST /api/v1/spools/{id}/deduct
Content-Type: application/json

{
"weight_grams": 50.5,
"reason": "Production run #42"
}

Response:

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"remaining_weight_grams": 449.5,
"deducted": 50.5
}

Spool Schema

FieldTypeRequiredDescription
material_typestringYesPLA, PETG, ABS, etc.
brandstringNoManufacturer name
colorstringYesColor name
color_hexstringNoHex color code
finishstringNoMatte, Glossy, Silk, etc.
diameter_mmfloatYes1.75 or 2.85
net_weight_gramsfloatYesTotal filament weight
remaining_weight_gramsfloatNoCurrent weight (defaults to net)
spool_weight_gramsfloatNoEmpty spool weight
purchase_pricefloatNoCost per spool
supplierstringNoWhere purchased
purchase_datedateNoWhen purchased
notesstringNoAdditional notes

Material Types

Supported values for material_type:

  • PLA
  • PETG
  • ABS
  • TPU
  • ASA
  • Nylon
  • PC
  • HIPS
  • PVA
  • Custom