Repository navigation
API Reference
A map of the HTTP surface. The authoritative definition is the OpenAPI schema the backend exports — this page is for orientation, not for generating clients.
cd backend && .venv/Scripts/python tools/export_openapi.py --out openapi.jsonThe TypeScript client for both SPAs is generated from that schema and is never hand-edited (ADR-0005). In CI it is generated from the artifact the backend job exported and never committed, so a breaking backend change fails the build at the commit that caused it.
Authentication is a session cookie. Both apps are same-origin with the API — the
storefront behind its tunnel, the console on the LAN — so there is no CORS, no bearer
token, and no PRINTORIAN_CORS_ORIGINS in the normal arrangement.
Authorization is enforced here, in the API layer, by
Depends(requires(Permission.X)). A route with no such dependency is public by
inspection. Roles are a shorthand for a permission set — see
Roles and Permissions.
Errors carry codes, never prose (ADR-0012). The backend returns
error.ordering.invalid_transition with structured fields; the client renders the
sentence from its own RU/EN catalogue. No user-facing string is hardcoded server-side.
Rate limits apply where the cost is the problem: quotes and previews
(quote_rate_per_minute, 30), uploads (10), auth (20), plus a sign-in lockout. Request
bodies are refused by size at the ASGI layer, before anything buffers them.
| Method | Path | Answers |
|---|---|---|
GET |
/health |
Is this process up? Touches nothing |
GET |
/health/ready |
Can it serve? Names each dependency. Only database can 503 |
GET |
/health/workers |
Is the background work still happening? 503 when a loop is wedged |
Details in Operations. These describe the shape of the deployment, so the
storefront's edge should not forward /health/*.
| Method | Path | |
|---|---|---|
POST |
/auth/register |
Customer self-registration |
POST |
/auth/sign-in |
|
POST |
/auth/sign-out |
|
GET |
/auth/me |
The actor and their resolved permission set — what both SPAs build their navigation from |
| Method | Path | Permission |
|---|---|---|
POST |
/pricing/quote |
none — optional actor, rate-limited |
POST |
/pricing/preview |
none — rate-limited |
quote prices a spec; preview is what drives the configurator's per-option deltas. Both
parse a mesh, which is why both are rate-limited and why an unauthenticated caller is
allowed but capped.
| Method | Path | Permission |
|---|---|---|
GET |
/catalog |
none |
GET |
/catalog/{slug} |
none |
GET |
/catalog/{slug}/model |
none |
POST |
/catalog/geometry |
none — rate-limited upload; mesh analysis |
POST |
/catalog |
manage_library |
PATCH |
/catalog/{slug} |
manage_library |
DELETE |
/catalog/{slug} |
manage_library |
| Method | Path | Permission |
|---|---|---|
POST |
/orders |
place_order |
POST |
/orders/reprice |
place_order |
GET |
/orders/mine |
view_own_orders |
GET |
/orders |
view_all_orders |
GET |
/orders/overdue |
view_all_orders |
GET |
/orders/{id} |
own, or view_all_orders
|
GET |
/orders/{id}/queue |
queue position |
POST |
/orders/{id}/advance |
manage_order |
advance goes through the same transition table as everything else — see
Order Lifecycle.
| Method | Path | Permission |
|---|---|---|
POST |
/payments |
place_order |
POST |
/payments/webhook/{provider} |
none — IP-checked, and the payment is re-read from the gateway before it is believed |
GET |
/payments/order/{order_id} |
|
GET |
/payments/{id} |
|
POST |
/payments/{id}/refund |
issue_refund |
POST |
/payments/{id}/refund-sla-credit |
issue_refund |
GET |
/payments/providers/available |
|
POST |
/payments/{id}/settle-manually |
the manual provider |
| Method | Path | |
|---|---|---|
GET |
/account |
|
PATCH |
/account/profile |
|
GET PATCH
|
/account/notifications |
|
GET |
/account/models |
|
GET |
/account/models/{asset_id}/file |
|
GET |
/account/documents |
Receipts and billing |
GET |
/account/orders.csv |
|
GET |
/account/export |
Full data export |
POST |
/account/close |
|
GET POST PUT DELETE
|
/account/addresses… |
Including /{id}/default
|
GET |
/account/sessions |
|
DELETE |
/account/sessions/{id} · /account/sessions
|
Revoke one, or all |
POST |
/account/password |
| Method | Path | Permission |
|---|---|---|
GET |
/jobs/prep-queue |
view_production |
GET |
/jobs/wait-list |
view_production |
GET |
/jobs/plates/find |
view_production |
GET |
/jobs/{id} |
view_production |
GET |
/jobs/{id}/decisions |
Every candidate machine and why each was refused |
GET |
/jobs/{id}/model · /jobs/{id}/plate/file
|
prepare_plate |
POST |
/jobs/{id}/plate |
prepare_plate |
POST |
/jobs/{id}/release |
manage_order — releases a price review |
| Method | Path | Permission |
|---|---|---|
GET |
/postproduction/board |
view_production |
POST |
/postproduction/tasks |
advance_postproduction |
POST |
/postproduction/tasks/{id}/start /pause /steps /finish
|
advance_postproduction |
POST |
/postproduction/tasks/{id}/pass /return
|
record_qc |
| Method | Path | Permission |
|---|---|---|
GET |
/packaging/board |
view_production |
POST |
/packaging/parcels |
pack_order |
POST |
/packaging/parcels/{id}/start /steps /tara /weight /ready /ship
|
pack_order |
POST |
/packaging/parcels/{id}/hold /release /discrepancy
|
pack_order |
POST DELETE
|
/packaging/tara… /packaging/instruction
|
shelf management |
| Method | Path | Permission |
|---|---|---|
GET |
/fleet/metrics · /fleet/metrics/{printer_id}
|
view_production — the farm's measured occupancy, seconds only. Not a Prometheus scrape
|
GET |
/printers · /printers/{id}
|
view_production |
POST PUT DELETE
|
/printers… |
manage_fleet |
PUT |
/printers/{id}/access-code |
manage_fleet — write-only
|
POST PUT
|
/printers/{id}/slots · /slots/{unit}/{index}
|
AMS slots |
POST |
/printers/{id}/services |
service card entries |
POST |
/printers/{id}/services/{operation_id}/complete |
| Method | Path | Permission |
|---|---|---|
GET |
/materials |
view_production |
GET |
/materials/recommend |
The usage-scenario recommender |
GET |
/materials/{code} |
No consumer yet — #38 |
POST |
/materials · /materials/lots
|
manage_inventory |
| Method | Path | Permission |
|---|---|---|
GET |
/dashboard |
view_all_orders |
One request, assembled across five contexts, read against a single instant. Nine
concurrent requests would let the KPI tiles and the status wall disagree by a few seconds,
which on a screen whose job is "what is happening right now" is worse than being a moment
slower. It needs view_all_orders rather than view_production because it carries
revenue, spend and margin.
| Method | Path | Permission |
|---|---|---|
GET |
/journal · /journal/latest · /journal/{slug}
|
none |
GET |
/journal/rss |
none — RSS feed |
POST |
/journal/subscribe · /journal/unsubscribe/{token}
|
none |
POST PATCH DELETE
|
/journal… |
manage_journal |
| Method | Path | Permission |
|---|---|---|
GET |
/settings · /settings/sections
|
manage_settings |
GET |
/settings/history |
view_audit_log — the «было · стало» record |
PUT DELETE
|
/settings/{key} |
manage_settings |
POST |
/settings/reset-rates |
manage_settings |
POST |
/settings/drop-telemetry |
manage_settings |
| Method | Path | Permission |
|---|---|---|
GET POST
|
/users |
manage_users |
GET |
/users/{id} |
manage_users |
PUT |
/users/{id}/role · /users/{id}/active
|
manage_users |
| Method | Path | |
|---|---|---|
GET |
/public/stats |
Unauthenticated farm statistics for the storefront |
One stream, subscribed by both apps, typed by a generated events package.
printer.state_changed job.progress job.finished job.failed
order.stage_changed material.low material.mounted attention.raised
plate.prepared sla.at_risk payment.settled
What crosses it is an invalidation, not state (ADR-0015). The client is told what went stale and asks for it, so a dropped frame costs a refetch rather than leaving two screens quietly disagreeing. Clients also resync on connect.
payment.settled has its amount stripped on the relay. Every holder of
view_production is entitled to this socket, while the REST API keeps view_financials
separate from every production permission; the socket has no per-actor filtering, so the
redaction happens on the one path both sources share. A screen that should show money asks
the API, which checks the permission.
- Roles and Permissions
- Architecture — how the routers relate to the contexts behind them
- Installation — regenerating the client
Printorian wiki · the code is the source of truth · open work lives in issues · current state in HANDOFF.md
Concepts
Workflow
Lifecycles
- Order Lifecycle
- Job Lifecycle
- Scheduling and Dispatch
- Materials and Inventory
- Fleet and Drivers
- Post-Production and Packing
Money
Running it
- Installation
- Configuration
- Deployment
- Operations
- Backup and Restore
- Database Maintenance
- Troubleshooting
Building it