Files
uberbringer/docs/swagger.json
T
57_WolveandClaude Opus 5.5 3e9779f71a
Security / Vulnerability check (push) Successful in 41s
Test / Lint and test (push) Successful in 1m50s
Add the list block and the module layer with the note module
The list block prints items with a dot, dash, number or checkbox bullet,
wrapping a long item with a hanging indent; a checkbox list ticks its
done items as [√], or [x] on code pages without √. It stands alone or
inside a box, and its items, bullet and done fields carry their enums
and limits as jsonschema tags.

internal/pkg/modules holds modules that build ordinary jobs from their
own payloads: a registry by name, an Env with the clock, time zone and
time layout, strict payload decoding that reports every problem, ErrSkip
and PayloadError. The note module prints a boxed note with an optional
checklist and a time stamp in the footer.

Three routes join the route table: POST /api/v1/print/{module} and
POST /api/v1/preview/{module}, which take ?copies and a reserved
?printer, and GET /api/v1/modules. Print and the module route share one
submit path, and preview shares one too. New error codes:
invalid_payload, invalid_query, unknown_printer, module_not_found and
module_failed; a module that builds an invalid receipt is logged and
reported to Sentry once. [format] gains timezone and time_layout, the
binary embeds the time zone database, and uberbringer preview takes
--module.

The note receipt passed on the TM-T88IV, and its bytes are pinned in
TestPaperReceipts. docs/api.md describes the list block, the module
routes and the note payload; docs/swagger.json is regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 10:55:50 -06:00

1749 lines
56 KiB
JSON

{
"components": {
"schemas": {
"Element": {
"additionalProperties": false,
"description": "Element is one item on a receipt. Its type selects which fields apply. On the blocks (box, rule, kv and list) and inside a box, a field that does not apply is an error; on the other types it is ignored, except for the block fields. width and height mean character multipliers for text, module width and bar height for barcodes, and target width in dots for images. A block's width is set by columns, in characters of its own size and font, never by width; without columns a block spans the line. The enums list the canonical spellings: apart from type and leader, other letter case is accepted too, and so are a few aliases such as centre and ean-13.",
"properties": {
"align": {
"description": "align places text, a QR code, a barcode or an image, a box's text, or a rule's label. Default left, center for a rule's label.",
"enum": [
"left",
"center",
"right"
],
"type": "string"
},
"base64": {
"description": "base64 is an image's data in base64, or a data:image/...;base64, URI: PNG, JPEG, GIF or WebP.",
"type": "string"
},
"bold": {
"description": "bold prints the text in bold: a box's text, a rule's label.",
"type": "boolean"
},
"bullet": {
"description": "bullet marks each item of a list: dot, the default, dash, number (right-aligned to the widest number) or checkbox.",
"enum": [
"dot",
"dash",
"number",
"checkbox"
],
"type": "string"
},
"children": {
"description": "children are a box's body as elements, one level deep: text, feed, rule, kv and list. Set text or children, not both.",
"items": {
"$ref": "#/components/schemas/Element"
},
"type": "array"
},
"columns": {
"description": "columns is a block's width in characters of its own size and font, 1-255, cut to the line. A narrower block is centred. 0 means the default, the whole line.",
"maximum": 255,
"minimum": 0,
"type": "integer"
},
"correction": {
"description": "correction is a QR code's error correction level. Default M.",
"enum": [
"L",
"M",
"Q",
"H"
],
"type": "string"
},
"data": {
"description": "data is a QR code's data, up to 7089 bytes of UTF-8, or a barcode's: digits for EAN and UPC, A-Z 0-9 -.$/+% and space for CODE39, printable ASCII for CODE128.",
"type": "string"
},
"done": {
"description": "done are the indexes into items, from 0, of a checkbox list's ticked items, each once. They print as [√], or [x] on code pages without √.",
"items": {
"maximum": 199,
"minimum": 0,
"type": "integer"
},
"type": "array",
"uniqueItems": true
},
"fit": {
"description": "fit shrinks a box to its widest line, title and footer included, and centres it. columns is then the most it may take.",
"type": "boolean"
},
"font": {
"description": "font is a, the default, or b, the smaller font; on a block it sets the font of its borders and text.",
"enum": [
"a",
"b"
],
"type": "string"
},
"footer": {
"description": "footer is text set into a box's bottom border, on the right.",
"type": "string"
},
"height": {
"description": "height is the character height for text (1-8), or the bar height of a barcode in dots (1-255, default 80). 0 means the default.",
"maximum": 255,
"minimum": 0,
"type": "integer"
},
"hex": {
"description": "hex is a raw element's ESC/POS bytes in hex, spaces allowed, e.g. \"1B 61 01\". It is sent as given.",
"type": "string"
},
"hri": {
"description": "hri places a barcode's human-readable text. Default below.",
"enum": [
"none",
"above",
"below",
"both"
],
"type": "string"
},
"invert": {
"description": "invert prints white on black.",
"type": "boolean"
},
"items": {
"description": "items are a list's items, 1-200, none empty; required for list. An item too long for its line wraps with a hanging indent.",
"items": {
"minLength": 1,
"type": "string"
},
"maxItems": 200,
"minItems": 1,
"type": "array"
},
"leader": {
"description": "leader is the fill between a kv row's key and value: \".\", the default, \"·\", \" \" (or \"space\"), \"_\", \"-\" or \"─\".",
"enum": [
".",
"·",
" ",
"space",
"_",
"-",
"─"
],
"type": "string"
},
"lines": {
"description": "lines is a feed's number of lines, 1-255. 0 means the default, 1.",
"maximum": 255,
"minimum": 0,
"type": "integer"
},
"mode": {
"description": "mode is a cut's mode. Default partial.",
"enum": [
"partial",
"full"
],
"type": "string"
},
"newline": {
"description": "newline false keeps the next element on the same line. Default true.",
"type": "boolean"
},
"padding": {
"description": "padding is the spaces between a box's side borders and its body, 0-3. Default 1.",
"maximum": 3,
"minimum": 0,
"type": "integer"
},
"pairs": {
"description": "pairs are a kv block's rows, 1-100; required for kv.",
"items": {
"$ref": "#/components/schemas/Pair"
},
"maxItems": 100,
"minItems": 1,
"type": "array"
},
"size": {
"description": "size sets width and height together: 1-8 for text, 1-3 for a block, whose borders scale with its text. For a QR code it is the module size in dots, 1-16, default 6. 0 means the default.",
"maximum": 16,
"minimum": 0,
"type": "integer"
},
"style": {
"description": "style is a box's border style (single, double, double-h, double-v or ascii) or a rule's line style (single, double, light, medium, dark, solid, dashed, dotted or ascii). Default single.",
"enum": [
"single",
"double",
"double-h",
"double-v",
"ascii",
"light",
"medium",
"dark",
"solid",
"dashed",
"dotted"
],
"type": "string"
},
"symbology": {
"description": "symbology is a barcode's type; required for a barcode.",
"enum": [
"ean13",
"ean8",
"upca",
"upce",
"code39",
"code128"
],
"type": "string"
},
"text": {
"description": "text is a text element's UTF-8 text, a box's body or a rule's label. \\n starts a new line.",
"type": "string"
},
"title": {
"description": "title is text set into a box's top border.",
"type": "string"
},
"title_style": {
"description": "title_style is inline, the default, or capped.",
"enum": [
"inline",
"capped"
],
"type": "string"
},
"type": {
"description": "type is the kind of element. box, rule, kv and list are blocks, laid out to the printer model's width when the job prints.",
"enum": [
"text",
"feed",
"qr",
"barcode",
"image",
"raw",
"cut",
"box",
"rule",
"kv",
"list"
],
"type": "string"
},
"underline": {
"description": "underline is 0, 1 for thin or 2 for thick.",
"maximum": 2,
"minimum": 0,
"type": "integer"
},
"url": {
"description": "url is an image's http or https URL. Set url or base64.",
"type": "string"
},
"width": {
"description": "width is the character width for text (1-8), the module width of a barcode (2-6, default 3), or the target width of an image in dots. 0 means the default.",
"minimum": 0,
"type": "integer"
},
"wrap": {
"description": "wrap false sends the text as it is and lets the printer wrap it, or inside a box splits lines at the box edge. Default true: wrap at spaces.",
"type": "boolean"
}
},
"required": [
"type"
],
"type": "object"
},
"ErrorResponse": {
"description": "ErrorResponse is the JSON body of every error.",
"properties": {
"code": {
"description": "code is stable and meant for clients to match on.",
"type": "string"
},
"details": {
"description": "details lists every problem when a job fails validation (invalid_job), a module payload is invalid (invalid_payload) or a module builds an invalid receipt (module_failed). A job problem names the element by its path, e.g. elements[0].children[3] (qr); a payload problem names the field, e.g. done[0].",
"items": {
"type": "string"
},
"type": "array"
},
"error": {
"description": "error says what went wrong, for people. It may change.",
"type": "string"
}
},
"required": [
"error",
"code"
],
"type": "object"
},
"HealthResponse": {
"description": "HealthResponse is the body of GET /healthz.",
"properties": {
"printer": {
"$ref": "#/components/schemas/PrinterHealth",
"description": "printer is the printer's state."
},
"queue": {
"$ref": "#/components/schemas/QueueHealth",
"description": "queue is the print queue's state."
},
"status": {
"description": "status is ok, degraded when the printer is not ready, or unavailable when it is unreachable or did not answer in time.",
"enum": [
"ok",
"degraded",
"unavailable"
],
"type": "string"
}
},
"required": [
"status",
"printer",
"queue"
],
"type": "object"
},
"IndexResponse": {
"description": "IndexResponse describes the running build.",
"properties": {
"Authors": {
"description": "Authors is where the project lives.",
"type": "string"
},
"Build": {
"description": "Build is the commit the binary was built from.",
"type": "string"
},
"Description": {
"description": "Description says what the daemon does.",
"type": "string"
},
"Project": {
"description": "Project is the project's name.",
"type": "string"
},
"Version": {
"description": "Version is the release, e.g. 0.2.0, or dev for a local build.",
"type": "string"
}
},
"required": [
"Project",
"Description",
"Authors",
"Version",
"Build"
],
"type": "object"
},
"Job": {
"additionalProperties": false,
"description": "Job is a receipt to print.",
"properties": {
"copies": {
"description": "copies is how many times the receipt is printed, each with its own cut. Zero means one.",
"maximum": 5,
"minimum": 0,
"type": "integer"
},
"elements": {
"description": "elements are the items on the receipt, in order: 1-500, box children counted.",
"items": {
"$ref": "#/components/schemas/Element"
},
"maxItems": 500,
"minItems": 1,
"type": "array"
}
},
"required": [
"elements"
],
"type": "object"
},
"JobStatus": {
"description": "JobStatus describes a job.",
"properties": {
"attempts": {
"description": "attempts is how many times the job was sent to the printer.",
"type": "integer"
},
"created_at": {
"description": "created_at is when the job was queued.",
"format": "date-time",
"type": "string"
},
"error": {
"description": "error says why a failed job failed.",
"type": "string"
},
"finished_at": {
"description": "finished_at is when the job was done or failed.",
"format": "date-time",
"type": "string"
},
"id": {
"description": "id identifies the job.",
"examples": [
"job_01kbx4n6m3ex8tq0wq3r5vrzq1"
],
"pattern": "^job_[0-7][0-9a-hjkmnp-tv-z]{25}$",
"type": "string"
},
"started_at": {
"description": "started_at is when the worker took the job.",
"format": "date-time",
"type": "string"
},
"status": {
"description": "status is where the job is in its lifecycle.",
"enum": [
"queued",
"printing",
"done",
"failed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"created_at"
],
"type": "object"
},
"ModuleInfo": {
"description": "ModuleInfo describes one module.",
"properties": {
"description": {
"description": "description says in one line what the module prints.",
"type": "string"
},
"name": {
"description": "name is the module's name in the module routes' paths, e.g. note.",
"type": "string"
}
},
"required": [
"name",
"description"
],
"type": "object"
},
"ModuleList": {
"description": "ModuleList is the body of GET /api/v1/modules: every module, sorted by name.",
"items": {
"$ref": "#/components/schemas/ModuleInfo"
},
"type": "array"
},
"ModulePayload": {
"description": "ModulePayload is a module's payload: a JSON object whose fields the module defines, such as a note's title, text and items.",
"type": "object"
},
"OpenAPIDocument": {
"description": "OpenAPIDocument is the body of GET /openapi.json: this API's OpenAPI 3.1 document, generated from the route table.",
"properties": {
"components": {
"description": "components holds the schemas of the request and response bodies.",
"type": "object"
},
"info": {
"description": "info names the API and its version.",
"type": "object"
},
"openapi": {
"description": "openapi is the OpenAPI version the document follows.",
"type": "string"
},
"paths": {
"description": "paths are the routes.",
"type": "object"
}
},
"required": [
"openapi",
"info",
"paths",
"components"
],
"type": "object"
},
"Pair": {
"additionalProperties": false,
"description": "Pair is one row of a kv block: a key, a leader and a value.",
"properties": {
"bold": {
"description": "bold prints the key and the value bold.",
"type": "boolean"
},
"key": {
"description": "key is the row's key, on the left. A key too long for the line is cut with \"...\".",
"minLength": 1,
"type": "string"
},
"value": {
"description": "value is the row's value, on the right. A long value wraps into the room after the key.",
"type": "string"
}
},
"required": [
"key"
],
"type": "object"
},
"PreviewLine": {
"description": "PreviewLine is one line of a preview.",
"properties": {
"data": {
"description": "data is the QR code or barcode data, the image URL (or base64), the number of raw bytes, or the cut mode.",
"type": "string"
},
"kind": {
"description": "kind is what printed the line.",
"enum": [
"text",
"qr",
"barcode",
"image",
"raw",
"cut"
],
"type": "string"
},
"runs": {
"description": "runs are the styled parts of text. Plain Font A text at size 1 has none.",
"items": {
"$ref": "#/components/schemas/PreviewRun"
},
"type": "array"
},
"text": {
"description": "text is the line as it prints, or a placeholder such as [qr: https://example.com].",
"type": "string"
}
},
"required": [
"kind",
"text"
],
"type": "object"
},
"PreviewResponse": {
"description": "PreviewResponse is the JSON form of a preview.",
"properties": {
"codepage": {
"description": "codepage is the code page text is printed in.",
"type": "string"
},
"columns": {
"description": "columns is the number of Font A characters per line.",
"type": "integer"
},
"line_count": {
"description": "line_count is the lines the receipt prints, all copies counted: text lines, fed lines, and one for each QR code, barcode and image.",
"type": "integer"
},
"lines": {
"description": "lines are the lines as they print, in order.",
"items": {
"$ref": "#/components/schemas/PreviewLine"
},
"type": "array"
},
"warnings": {
"description": "warnings name the elements with characters the code page lacks, and images wider than the paper.",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"columns",
"codepage",
"line_count",
"lines",
"warnings"
],
"type": "object"
},
"PreviewRun": {
"description": "PreviewRun is a styled range of a line's text, in characters [from, to). Width and height are omitted at scale 1, font when it is a.",
"properties": {
"bold": {
"description": "bold is set for bold text.",
"type": "boolean"
},
"font": {
"description": "font is b for the smaller font.",
"enum": [
"b"
],
"type": "string"
},
"from": {
"description": "from is the first character of the run.",
"type": "integer"
},
"height": {
"description": "height is the character height multiplier, when it is not 1.",
"type": "integer"
},
"invert": {
"description": "invert is set for white on black.",
"type": "boolean"
},
"to": {
"description": "to is the character after the run.",
"type": "integer"
},
"underline": {
"description": "underline is 1 for a thin and 2 for a thick underline.",
"enum": [
1,
2
],
"type": "integer"
},
"width": {
"description": "width is the character width multiplier, when it is not 1.",
"type": "integer"
}
},
"required": [
"from",
"to"
],
"type": "object"
},
"PrinterHealth": {
"description": "PrinterHealth is the printer part of the /healthz response.",
"properties": {
"cover_open": {
"description": "cover_open is reported only while the printer is offline: Epson printers go offline when the cover opens.",
"type": "boolean"
},
"error": {
"description": "error is set when the printer reports an error, such as a cutter error.",
"type": "string"
},
"online": {
"description": "online is whether the printer reports itself online.",
"type": "boolean"
},
"paper": {
"description": "paper is ok, near_end or out.",
"enum": [
"ok",
"near_end",
"out"
],
"type": "string"
},
"reachable": {
"description": "reachable is whether the printer accepted a connection; it is omitted when that is unknown, e.g. after a timeout.",
"type": "boolean"
},
"status": {
"description": "status is ready, not_ready, unknown for a printer that does not answer status requests, unreachable, or timeout when the status read ran out of time.",
"enum": [
"ready",
"not_ready",
"unknown",
"unreachable",
"timeout"
],
"type": "string"
}
},
"required": [
"status"
],
"type": "object"
},
"QueueHealth": {
"description": "QueueHealth is the queue part of the /healthz response.",
"properties": {
"pending": {
"description": "pending is how many jobs wait to be printed.",
"type": "integer"
}
},
"required": [
"pending"
],
"type": "object"
}
},
"securitySchemes": {
"bearerAuth": {
"bearerFormat": "JWT",
"description": "An HS256 token signed with api.secret, as `uberbringer token` issues them.",
"scheme": "bearer",
"type": "http"
}
}
},
"info": {
"description": "Takes print jobs as JSON and prints them on an Epson ESC/POS receipt printer. Every error is JSON with a stable code. Each operation lists the codes it and its middleware answer with; the HTTP server itself can also refuse any request with 400 bad_request, 404 not_found, 405 method_not_allowed, 408 request_timeout, 431 headers_too_large, 501 not_implemented. Responses from /healthz and every /api/v1 route carry Cache-Control: no-store. Generated from the route table; do not edit.",
"license": {
"identifier": "EUPL-1.2",
"name": "EUPL-1.2"
},
"title": "Überbringer HTTP API",
"version": "v1"
},
"openapi": "3.1.0",
"paths": {
"/": {
"get": {
"description": "The project's name, description and authors, and the version and build of the running daemon.",
"operationId": "getInfo",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/IndexResponse"
}
}
},
"description": "The running build"
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Server Error. internal_error: internal server error.",
"x-uberbringer-codes": [
"internal_error"
]
}
},
"security": [],
"summary": "Version information",
"tags": [
"meta"
]
}
},
"/api/v1/jobs/{id}": {
"get": {
"description": "The status of a queued, printing or finished job. The last queue.history finished jobs are kept.",
"operationId": "getJob",
"parameters": [
{
"description": "The job's ID, a job_ TypeID.",
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/JobStatus"
}
}
},
"description": "The job's status"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Unauthorized. unauthorized: missing or invalid bearer token.",
"headers": {
"WWW-Authenticate": {
"description": "The challenge: Bearer realm=\"uberbringer\", with error=\"invalid_token\" when a token was sent but is not valid.",
"schema": {
"type": "string"
}
}
},
"x-uberbringer-codes": [
"unauthorized"
]
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Not Found. job_not_found: job not found.",
"x-uberbringer-codes": [
"job_not_found"
]
},
"429": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Too Many Requests. rate_limited: too many requests, try again later.",
"headers": {
"Retry-After": {
"description": "How many seconds to wait before the client's next request is let through.",
"schema": {
"minimum": 1,
"type": "integer"
}
}
},
"x-uberbringer-codes": [
"rate_limited"
]
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Server Error. internal_error: internal server error.",
"x-uberbringer-codes": [
"internal_error"
]
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Job status",
"tags": [
"print"
]
}
},
"/api/v1/modules": {
"get": {
"description": "Every module the module routes take, sorted by name.",
"operationId": "listModules",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModuleList"
}
}
},
"description": "The modules"
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Unauthorized. unauthorized: missing or invalid bearer token.",
"headers": {
"WWW-Authenticate": {
"description": "The challenge: Bearer realm=\"uberbringer\", with error=\"invalid_token\" when a token was sent but is not valid.",
"schema": {
"type": "string"
}
}
},
"x-uberbringer-codes": [
"unauthorized"
]
},
"429": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Too Many Requests. rate_limited: too many requests, try again later.",
"headers": {
"Retry-After": {
"description": "How many seconds to wait before the client's next request is let through.",
"schema": {
"minimum": 1,
"type": "integer"
}
}
},
"x-uberbringer-codes": [
"rate_limited"
]
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Server Error. internal_error: internal server error.",
"x-uberbringer-codes": [
"internal_error"
]
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "List the modules",
"tags": [
"modules"
]
}
},
"/api/v1/preview": {
"post": {
"description": "Validates the job as /api/v1/print does, renders it and reads the lines back from the rendered bytes. It prints nothing and fetches no images. The answer is JSON with the lines' styles when the Accept header prefers application/json to text/plain (for example application/json or application/*), and plain text otherwise.",
"operationId": "previewJob",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Job"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PreviewResponse"
}
},
"text/plain; charset=utf-8": {
"schema": {
"type": "string"
}
}
},
"description": "The lines the printer would print"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Bad Request. invalid_job: invalid job.",
"x-uberbringer-codes": [
"invalid_job"
]
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Unauthorized. unauthorized: missing or invalid bearer token.",
"headers": {
"WWW-Authenticate": {
"description": "The challenge: Bearer realm=\"uberbringer\", with error=\"invalid_token\" when a token was sent but is not valid.",
"schema": {
"type": "string"
}
}
},
"x-uberbringer-codes": [
"unauthorized"
]
},
"413": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Request Entity Too Large. body_too_large: request body is too large.",
"x-uberbringer-codes": [
"body_too_large"
]
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Unprocessable Entity. too_many_lines: receipt would print too many lines.",
"x-uberbringer-codes": [
"too_many_lines"
]
},
"429": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Too Many Requests. rate_limited: too many requests, try again later.",
"headers": {
"Retry-After": {
"description": "How many seconds to wait before the client's next request is let through.",
"schema": {
"minimum": 1,
"type": "integer"
}
}
},
"x-uberbringer-codes": [
"rate_limited"
]
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Server Error. internal_error: internal server error.",
"x-uberbringer-codes": [
"internal_error"
]
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Show the lines a job prints, without printing it",
"tags": [
"print"
]
}
},
"/api/v1/preview/{module}": {
"post": {
"description": "Builds the receipt as /api/v1/print/{module} does and answers as /api/v1/preview does: JSON with the lines' styles when the Accept header prefers application/json to text/plain, and plain text otherwise. It prints nothing and fetches no images.",
"operationId": "previewModule",
"parameters": [
{
"description": "The module's name, e.g. note. GET /api/v1/modules lists them.",
"in": "path",
"name": "module",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "How many copies to print, each cut separately: a whole number, 1-5. Default 1.",
"in": "query",
"name": "copies",
"required": false,
"schema": {
"type": "string"
}
},
{
"description": "Reserved for a second printer: only default is accepted. Any other query parameter is refused.",
"in": "query",
"name": "printer",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModulePayload"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PreviewResponse"
}
},
"text/plain; charset=utf-8": {
"schema": {
"type": "string"
}
}
},
"description": "The lines the printer would print"
},
"204": {
"description": "The module had nothing to print"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Bad Request. invalid_payload: invalid payload; invalid_query: invalid query parameter; unknown_printer: unknown printer.",
"x-uberbringer-codes": [
"invalid_payload",
"invalid_query",
"unknown_printer"
]
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Unauthorized. unauthorized: missing or invalid bearer token.",
"headers": {
"WWW-Authenticate": {
"description": "The challenge: Bearer realm=\"uberbringer\", with error=\"invalid_token\" when a token was sent but is not valid.",
"schema": {
"type": "string"
}
}
},
"x-uberbringer-codes": [
"unauthorized"
]
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Not Found. module_not_found: module not found.",
"x-uberbringer-codes": [
"module_not_found"
]
},
"413": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Request Entity Too Large. body_too_large: request body is too large.",
"x-uberbringer-codes": [
"body_too_large"
]
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Unprocessable Entity. module_failed: module built an invalid receipt; too_many_lines: receipt would print too many lines.",
"x-uberbringer-codes": [
"module_failed",
"too_many_lines"
]
},
"429": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Too Many Requests. rate_limited: too many requests, try again later.",
"headers": {
"Retry-After": {
"description": "How many seconds to wait before the client's next request is let through.",
"schema": {
"minimum": 1,
"type": "integer"
}
}
},
"x-uberbringer-codes": [
"rate_limited"
]
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Server Error. internal_error: internal server error.",
"x-uberbringer-codes": [
"internal_error"
]
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Show the lines a module's receipt prints, without printing it",
"tags": [
"modules"
]
}
},
"/api/v1/print": {
"post": {
"description": "Validates the whole job and queues it. The worker renders it in full before anything is sent to the printer, and fetches its images then, so a broken image URL shows up as a failed job.",
"operationId": "printJob",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Job"
}
}
},
"required": true
},
"responses": {
"202": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/JobStatus"
}
}
},
"description": "The job is queued",
"headers": {
"Location": {
"description": "The job's URL, which answers with its status.",
"schema": {
"type": "string"
}
}
}
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Bad Request. invalid_job: invalid job.",
"x-uberbringer-codes": [
"invalid_job"
]
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Unauthorized. unauthorized: missing or invalid bearer token.",
"headers": {
"WWW-Authenticate": {
"description": "The challenge: Bearer realm=\"uberbringer\", with error=\"invalid_token\" when a token was sent but is not valid.",
"schema": {
"type": "string"
}
}
},
"x-uberbringer-codes": [
"unauthorized"
]
},
"413": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Request Entity Too Large. body_too_large: request body is too large.",
"x-uberbringer-codes": [
"body_too_large"
]
},
"429": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Too Many Requests. rate_limited: too many requests, try again later.",
"headers": {
"Retry-After": {
"description": "How many seconds to wait before the client's next request is let through.",
"schema": {
"minimum": 1,
"type": "integer"
}
}
},
"x-uberbringer-codes": [
"rate_limited"
]
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Server Error. internal_error: internal server error.",
"x-uberbringer-codes": [
"internal_error"
]
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Service Unavailable. queue_full: print queue is full, try again shortly; shutting_down: server is shutting down.",
"headers": {
"Retry-After": {
"description": "Sent with queue_full: how many seconds to wait before trying again.",
"schema": {
"minimum": 1,
"type": "integer"
}
}
},
"x-uberbringer-codes": [
"queue_full",
"shutting_down"
]
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Queue a print job",
"tags": [
"print"
]
}
},
"/api/v1/print/{module}": {
"post": {
"description": "The module named in the path builds a receipt from the body, its own payload, which is decoded strictly: an unknown field or one of the wrong type is refused, with every problem listed. The receipt is then validated and queued as on /api/v1/print. A module with nothing to print answers 204.",
"operationId": "printModule",
"parameters": [
{
"description": "The module's name, e.g. note. GET /api/v1/modules lists them.",
"in": "path",
"name": "module",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "How many copies to print, each cut separately: a whole number, 1-5. Default 1.",
"in": "query",
"name": "copies",
"required": false,
"schema": {
"type": "string"
}
},
{
"description": "Reserved for a second printer: only default is accepted. Any other query parameter is refused.",
"in": "query",
"name": "printer",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModulePayload"
}
}
},
"required": true
},
"responses": {
"202": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/JobStatus"
}
}
},
"description": "The receipt is queued",
"headers": {
"Location": {
"description": "The job's URL, which answers with its status.",
"schema": {
"type": "string"
}
}
}
},
"204": {
"description": "The module had nothing to print"
},
"400": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Bad Request. invalid_payload: invalid payload; invalid_query: invalid query parameter; unknown_printer: unknown printer.",
"x-uberbringer-codes": [
"invalid_payload",
"invalid_query",
"unknown_printer"
]
},
"401": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Unauthorized. unauthorized: missing or invalid bearer token.",
"headers": {
"WWW-Authenticate": {
"description": "The challenge: Bearer realm=\"uberbringer\", with error=\"invalid_token\" when a token was sent but is not valid.",
"schema": {
"type": "string"
}
}
},
"x-uberbringer-codes": [
"unauthorized"
]
},
"404": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Not Found. module_not_found: module not found.",
"x-uberbringer-codes": [
"module_not_found"
]
},
"413": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Request Entity Too Large. body_too_large: request body is too large.",
"x-uberbringer-codes": [
"body_too_large"
]
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Unprocessable Entity. module_failed: module built an invalid receipt.",
"x-uberbringer-codes": [
"module_failed"
]
},
"429": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Too Many Requests. rate_limited: too many requests, try again later.",
"headers": {
"Retry-After": {
"description": "How many seconds to wait before the client's next request is let through.",
"schema": {
"minimum": 1,
"type": "integer"
}
}
},
"x-uberbringer-codes": [
"rate_limited"
]
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Server Error. internal_error: internal server error.",
"x-uberbringer-codes": [
"internal_error"
]
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Service Unavailable. queue_full: print queue is full, try again shortly; shutting_down: server is shutting down.",
"headers": {
"Retry-After": {
"description": "Sent with queue_full: how many seconds to wait before trying again.",
"schema": {
"minimum": 1,
"type": "integer"
}
}
},
"x-uberbringer-codes": [
"queue_full",
"shutting_down"
]
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Queue the receipt a module builds from its payload",
"tags": [
"modules"
]
}
},
"/healthz": {
"get": {
"description": "Reads the printer's real-time status. A printer that looks not ready is read again 750 ms later, and only a problem that is still there gives 503. A printer that does not answer status requests is reported as status unknown with 200.",
"operationId": "getHealth",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HealthResponse"
}
}
},
"description": "The printer is reachable and ready, or does not report status"
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Server Error. internal_error: internal server error.",
"x-uberbringer-codes": [
"internal_error"
]
},
"503": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HealthResponse"
}
}
},
"description": "The printer is unreachable, not ready, or did not answer in time"
}
},
"security": [],
"summary": "Printer and queue health",
"tags": [
"health"
]
}
},
"/openapi.json": {
"get": {
"description": "The OpenAPI 3.1 document of this API, generated from its route table, as the running build serves it.",
"operationId": "getOpenAPI",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OpenAPIDocument"
}
}
},
"description": "The document"
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Server Error. internal_error: internal server error.",
"x-uberbringer-codes": [
"internal_error"
]
}
},
"security": [],
"summary": "This API's OpenAPI document",
"tags": [
"meta"
]
}
},
"/robots.txt": {
"get": {
"operationId": "getRobots",
"responses": {
"200": {
"content": {
"text/plain; charset=utf-8": {
"schema": {
"type": "string"
}
}
},
"description": "A robots.txt that allows everything"
},
"500": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
},
"description": "Internal Server Error. internal_error: internal server error.",
"x-uberbringer-codes": [
"internal_error"
]
}
},
"security": [],
"summary": "Robots exclusion file",
"tags": [
"meta"
]
}
}
},
"tags": [
{
"name": "health"
},
{
"name": "meta"
},
{
"name": "modules"
},
{
"name": "print"
}
]
}