Skip to main content

HTTP API

All endpoints are served from the configured driver host.
http://<driver-host>:8080
https://plato-printer.local

Common Printer Target

Printer-targeting endpoints require ip_address and port.
{
  "vendor_id": 1208,
  "product_id": 1208,
  "ip_address": "192.168.1.50",
  "port": "9100",
  "beep": false
}
vendor_id and product_id are accepted for client compatibility. The current network print path targets printers by ip_address and port.

POST /print

Queues a print job and returns immediately.
POST /print
Content-Type: application/json
{
  "vendor_id": 1208,
  "product_id": 1208,
  "ip_address": "192.168.1.50",
  "port": "9100",
  "beep": true,
  "chunks": ["GSB2MAA..."],
  "runAt": 1735689600000
}
FieldRequiredNotes
ip_addressYesPrinter IP address.
portYesPrinter TCP port, usually 9100.
chunksYesNon-empty array of base64 ESC/POS chunks.
beepNoAdds the configured beep sequence after print/cut.
runAtNoMillisecond timestamp, numeric string, or parseable date string. Future values delay the BullMQ job.
Successful response:
{
  "ok": true,
  "jobId": "42",
  "queued": true
}
Validation errors:
StatusError
400Missing printer address
400Missing print data
400Invalid runAt timestamp

POST /status

Returns cached or live printer status.
{
  "ip_address": "192.168.1.50",
  "port": "9100",
  "validate": true
}
Response:
{
  "ok": true,
  "printerKey": "192.168.1.50:9100",
  "status": "online",
  "validated": true,
  "busy": false,
  "source": "probe",
  "lastPingOn": "2026-06-16T07:00:00.000Z",
  "lastError": null,
  "waiting": 0,
  "active": 0,
  "delayed": 0,
  "failed": 0,
  "completed": 0
}
Status behavior:
  • If the queue has waiting, active, or delayed jobs, status returns cached state with busy: true.
  • If the queue is idle, the driver can probe the printer.
  • source: "probe" means a live socket check was performed.
  • source: "cache" means the response came from stored state and queue counts.

POST /beep

Queues the beep sequence for a printer.
{
  "ip_address": "192.168.1.50",
  "port": "9100"
}
Response:
{
  "ok": true,
  "jobId": "43",
  "queued": true
}

POST /cash-drawer

Queues the ESC/POS cash drawer pulse command.
{
  "ip_address": "192.168.1.50",
  "port": "9100"
}
Response:
{
  "ok": true,
  "jobId": "44",
  "queued": true
}

GET /health

Returns process health and build version.
{
  "ok": true,
  "version": 66,
  "uptime": 123.45
}

GET /queue-status

Returns known printer queues.
{
  "queue": [
    {
      "printerKey": "192.168.1.50:9100",
      "status": "online",
      "validated": false,
      "busy": false,
      "source": "cache",
      "lastPingOn": "2026-06-16T07:00:00.000Z",
      "lastError": null,
      "waiting": 0,
      "active": 0,
      "delayed": 0,
      "failed": 0,
      "completed": 0
    }
  ],
  "totalPending": 0,
  "isProcessing": false
}

GET /mesh-status

When mesh is enabled:
{
  "enabled": true,
  "path": "/mesh",
  "port": 8080,
  "connectedPeers": [],
  "peerCount": 0
}
When mesh is disabled:
{
  "enabled": false,
  "message": "Mesh disabled by config.json"
}

GET /ca.crt

Available when HTTPS is enabled. Downloads the CA certificate as plato-printer-ca.crt.

WS /mesh

PeerJS signaling endpoint mounted when features.meshEnabled is true.