API Reference
AnyPrint exposes a local HTTP API on 127.0.0.1:3088 (with automatic fallback to ports 3089–3092). All endpoints require a Bearer token. The API is used exclusively by DAXTOP — you only need this reference if you are integrating a custom application.
Base URL
http://127.0.0.1:3088AnyPrint tries port 3088 first. If that port is already in use (e.g., another AnyPrint instance), it falls back to 3089, 3090, 3091, and finally 3092. DAXTOP probes all five ports automatically.
Authentication
Every request must include an Authorization header with a Bearer token:
Authorization: Bearer <token>The token is generated by DAXTOP during setup and stored in the browser's local storage. AnyPrint stores its expected token using electron-store (AES-256-GCM encrypted on disk). A request with a missing or incorrect token returns 401 Unauthorized.
Rate limiting
The API accepts up to 60 requests per minute per IP address. Exceeding this limit returns 429 Too Many Requests.
Endpoints
GET/status
Returns the current status of the AnyPrint service.
Request
GET /status HTTP/1.1
Host: 127.0.0.1:3088
Authorization: Bearer <token>Response 200
{
"status": "ok",
"version": "1.0.5",
"port": 3088,
"printerCount": 1
}GET/printers
Returns a list of all detected USB thermal printers and their current status.
Request
GET /printers HTTP/1.1
Host: 127.0.0.1:3088
Authorization: Bearer <token>Response 200
{
"printers": [
{
"name": "XP-58",
"vendorId": "0x0416",
"productId": "0x5011",
"status": "idle"
}
]
}Status value
idle | Ready to receive a print job |
printing | Currently executing a print job |
error | USB communication error — reconnect printer |
POST/print
Sends a print job to the first available idle printer.
Request
POST /print HTTP/1.1
Host: 127.0.0.1:3088
Authorization: Bearer <token>
Content-Type: application/json
{
"type": "receipt",
"data": { ... }
}Request body
| Field | Type | Meaning |
|---|---|---|
type | string | Print job type: "receipt", "return", or "test" |
data | object | Sale or return data object from DAXTOP (schema defined by DAXTOP API) |
printerId | string (optional) | Target a specific printer by vendorId:productId. If omitted, uses the first idle printer. |
Response 200
{
"ok": true,
"printer": "XP-58",
"jobId": "job_1714060800000"
}Error responses
| Status | Error | Meaning |
|---|---|---|
400 | Invalid request body | Missing or invalid fields |
401 | Unauthorized | Missing or wrong Bearer token |
409 | No printer available | All printers are busy or disconnected |
429 | Too many requests | Rate limit exceeded |
500 | Print error: … | USB communication failure |
WebSocket events
AnyPrint also exposes a WebSocket endpoint at ws://127.0.0.1:3088 for real-time print status updates. DAXTOP subscribes to this stream to show print progress in the UI.
| Event | Description |
|---|---|
print:start | A print job has started |
print:done | Print job completed successfully |
print:error | Print job failed — error details included |
printer:added | A new USB printer was detected |
printer:removed | A printer was disconnected |