Once a customer submits an order it enters theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/hxmz-axfn07/qr-printing-sfw/llms.txt
Use this file to discover all available pages before exploring further.
new status and staff advance it through a defined lifecycle using the transition and print endpoints. Both endpoints require admin authentication. The transition endpoint accepts an application/x-www-form-urlencoded body; the print endpoint takes no request body — only the order UUID in the path is required.
POST /api/orders/:id/transition
Path Parameter
The UUID of the order to transition.
Request Fields
The transition to apply. Must be one of:
start_review, approve, start_print, complete, fail, cancel.A human-readable explanation. Required when
action is fail or cancel. Stored in failure_reason or cancel_reason respectively and displayed in the admin dashboard.Status Flow
| Action | Required Current Status | Next Status |
|---|---|---|
start_review | new | reviewing |
approve | reviewing | ready |
start_print | ready | printing |
complete | printing | printed |
fail | printing | failed |
cancel | any active status | cancelled |
new, reviewing, ready, and printing. Attempting to cancel an already-terminal order (printed, cancelled, failed) returns a 400 error.
The
start_print action is used internally by POST /api/orders/:id/print. You can call it manually via the transition endpoint if you want to mark an order as printing without executing the PRINT_COMMAND (for example, if printing was done outside the system).Response — 200 OK
Error Cases
| Status | Condition |
|---|---|
400 Bad Request | action is not a recognised value ({"error": "Invalid action"}) |
400 Bad Request | Order is not in the required status for the given action |
400 Bad Request | Attempting to cancel a non-active order |
404 Not Found | No order exists with the given id |
401 Unauthorized | Missing or invalid admin token |
Examples
POST /api/orders/:id/print
ready → printing) with a shell print command. The order must currently be in the ready status. The endpoint iterates over every document in the order and runs the configured PRINT_COMMAND once per document, substituting document-specific placeholders.
Requires admin authentication.
Path Parameter
The UUID of the order to print.
How PRINT_COMMAND Works
ThePRINT_COMMAND string from .env is a shell template with the following placeholders, all replaced per document at runtime:
| Placeholder | Value |
|---|---|
{file} | Absolute path to the stored document file |
{copies} | Number of copies requested |
{paper} | Paper size, e.g. A4 |
{color} | Color mode, bw or color |
{style} | Print style, single or double |
.env configuration using CUPS:
PRINT_COMMAND is empty, the endpoint still transitions the order to printing but does not run any shell command. This is useful for shops that manage physical printing manually but want to track order state in the system.
Response — 200 OK
printed is false when PRINT_COMMAND was not configured — the status is still advanced to printing.
Error Cases
| Status | Condition |
|---|---|
400 Bad Request | Order status is not ready ({"error": "Order must be ready first"}) |
404 Not Found | No order with the given id |
401 Unauthorized | Missing or invalid admin token |
500 Internal Server Error | PRINT_COMMAND exited non-zero; order is automatically transitioned to failed with failure_reason set to stderr output |