Printer
Printer Managementβ
Endpoints for managing ticket printers.
All printer endpoints require only a valid accessToken (auth-jwt); they do not use granular permissions.
System Printersβ
GET /printers/availableβ
Retrieves the list of printers detected by the operating system.
Authorization: valid accessToken.
cURL Example:
curl -X GET "http://127.0.0.1:9154/printers/available" \
-H "Cookie: accessToken=$ACCESS_TOKEN"
Response Body (200 OK):
["Printer 1", "Printer 2", "Kitchen"]
POST /printers/setβ
Sets the active printer for a specific type, creating or updating a configuration.
Authorization: valid accessToken.
Request Body:
{
"printerType": "KITCHEN | CUSTOMER | BAR",
"printerName": "string"
}
cURL Example:
curl -X POST "http://127.0.0.1:9154/printers/set" \
-H "Cookie: accessToken=$ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"printerType": "KITCHEN",
"printerName": "Kitchen"
}'
Response Body (200 OK):
Printer Kitchen set for KITCHEN
Response Body (409 Conflict):
{ "error": "Failed to set default printer" }
POST /printers/printβ
Sends a print job.
Authorization: valid accessToken.
Request Body:
{
"templateName": "string (optional)",
"ticketData": { "...": "TicketData object" },
"printerType": "KITCHEN | CUSTOMER | BAR",
"printerId": "string (optional, config UUID)",
"broadcast": false,
"forceTemplateName": false
}
cURL Example:
curl -X POST "http://127.0.0.1:9154/printers/print" \
-H "Cookie: accessToken=$ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"templateName": "Default Customer Ticket",
"ticketData": {
"ticketId": "T-123",
"tableName": "Table 5",
"roomName": "Main Hall",
"date": "2025-10-06",
"items": [
{ "quantity": 2, "name": "Margherita Pizza", "price": 12.50 }
],
"total": 25.00
},
"printerType": "CUSTOMER"
}'
Response Body (200 OK):
Print job sent
Response Body (503 Service Unavailable): any printing error (printer unavailable, template not found, etc.).
{ "message": "Error processing print job" }
Printer Configurationsβ
GET /printers/configsβ
Retrieves all saved printer configurations.
Authorization: valid accessToken.
Response Body (200 OK):
[
{
"id": "config-uuid",
"printerType": "KITCHEN",
"printerName": "Kitchen",
"templateName": null,
"isDefault": true,
"enabled": true,
"createdAt": "2025-10-06T12:00:00Z"
}
]
POST /printers/configsβ
Creates a new printer configuration.
Authorization: valid accessToken.
Request Body:
{
"printerType": "KITCHEN | CUSTOMER | BAR",
"printerName": "string",
"templateName": "string (optional)",
"isDefault": false,
"enabled": true
}
Response Body (201 Created):
{ "id": "new-config-uuid" }
Response Body (409 Conflict):
{ "error": "Printer configuration already exists" }
PUT /printers/configs/{id}β
Updates a printer configuration. All fields are optional.
Authorization: valid accessToken.
Path Parameters:
id(string): Configuration ID.
Request Body:
{
"printerType": "KITCHEN | CUSTOMER | BAR",
"printerName": "string",
"templateName": "string",
"isDefault": false,
"enabled": true
}
Response: 200 OK if updated; 404 Not Found if it does not exist; 409 Conflict { "error": "Printer configuration already exists" } on collision.
DELETE /printers/configs/{id}β
Deletes a printer configuration.
Authorization: valid accessToken.
Path Parameters:
id(string): Configuration ID.
Response: 204 No Content if deleted; 404 Not Found if it does not exist.
POST /printers/configs/{id}/defaultβ
Sets a configuration as the default printer for its type.
Authorization: valid accessToken.
Path Parameters:
id(string): Configuration ID.
Response: 200 OK if set; 404 Not Found if it does not exist.
Notesβ
Any failure during POST /printers/print is wrapped in a 503 with { "message": "Error processing print job" }, including missing templates or unavailable printers.