API Reference
Both the Python and Rust engines expose identical HTTP endpoints. Only one engine runs at a time on port 8001.
POST /calculate
Calculate a window cleaning cost estimate.
Request Body (JSON):
{
"window_count": 50,
"window_type": "standard_single_pane",
"access_method": "ground_level",
"service_type": "both",
"frequency": "quarterly",
"labour_rate": 22.00,
"margin_pct": 35.0
}
Parameters:
Field |
Type |
Description |
|---|---|---|
|
integer |
Number of windows (minimum 1) |
|
string |
One of: |
|
string |
One of: |
|
string |
One of: |
|
string |
One of: |
|
float |
Hourly labour rate in CAD (must be > 0) |
|
float |
Target profit margin percentage (0–100) |
Response Body (JSON):
{
"labour_cost": 66.00,
"materials_cost": 5.28,
"subtotal": 71.28,
"margin_amount": 24.95,
"final_price": 96.23,
"per_window_cost": 1.92
}
Response Fields:
Field |
Description |
|---|---|
|
Total labour cost after frequency discount (CAD) |
|
Materials estimate at 8% of labour (CAD) |
|
Labour + materials before margin (CAD) |
|
Profit margin applied to subtotal (CAD) |
|
Total quoted price including margin (CAD) |
|
Final price divided by window count (CAD) |
GET /health
Health check endpoint.
Response:
{"status": "ok", "engine": "python"}
The engine field returns "python" or "rust" depending on which engine is running.