Zum Inhalt springen

Submit a batch of print jobs

POST
/api/v1/print/{printer_key}/batch
curl --request POST \
--url https://example.com/api/v1/print/example/batch \
--header 'Content-Type: application/json' \
--header 'X-Label-Hub-Key: <X-Label-Hub-Key>' \
--data '{ "half_cut_override": true, "items": [ { "content_type": "qr_only", "data": { "items": [], "primary_id": "example", "qr_payload": "example", "secondary": [], "title": "example" }, "lookup": { "app": "example", "identifier": "example" }, "options": { "auto_cut": true, "copies": 1, "half_cut": false, "high_resolution": false, "last_page": true } } ], "printer_slug": "example" }'

Validates all items and enqueues the batch as one tape run — no per-item errors are returned. The labels (copies included) print in sub-jobs of at most 50; each further sub-job waits for POST /api/v1/batches/{batch_id}/continue. Inside a sub-job the labels go out in groups of 10 with a status check after each; when a group fails, the run stops (see GET /api/v1/batches/{batch_id}). A tape end stops it when the printer reports it: a PT sets the SNMP noPaper bit; whether a QL-820NWB reports the end of a DK roll is not verified, so on a QL the check reliably catches only an unreachable printer and an open cover. Any validation failure or hardware precondition (printer_offline, cover_open, unsupported_tape, no_tape_loaded, content_type_data_mismatch) rejects the whole batch with the appropriate 4xx status code. A page printer (IPP) answers 409 media_kind_mismatch. A printer holds at most LABELYARD_MAX_QUEUED_RUNS_PER_PRINTER (default 5) runs and a key at most LABELYARD_MAX_QUEUED_RUNS_PER_KEY (default 20); a run counts until it is over. A run that waits for /continue or a reprint counts against its key only. Over a cap the batch answers 429 too-many-queued-runs.

printer_key
required
Printer Key

Printer slug or UUID

string

Printer slug or UUID

Media typeapplication/json
BatchRequest

Top-level POST /api/v1/print/{slug_or_uuid}/batch body.

object
half_cut_override
Half Cut Override

Override half_cut for all items in this batch. If the printer backend does not support half_cut (e.g. QL-Series), the value is forced to False and a warning is logged.

Any of:
boolean
items
required
Items
Array<object>
>= 1 items <= 500 items
PrintRequest

POST /api/v1/print body.

Either data (RawLabelData) or lookup (PrintLookupRequest) is provided. Exactly one of the two must be present.

object
content_type
required
ContentType

Tape-independent semantic content types for label rendering.

string
Allowed values: qr_only qr_one_line qr_two_lines qr_three_lines text_one_line text_two_lines qr_with_listing
data
Any of:
RawLabelData

Raw label payload accepted when the client supplies data directly.

Mirrors LabelData minus source_app (set server-side to ‘manual’). All content fields are optional — ContentType-specific validation happens in LayoutEngine._validate_data.

Every free text is bounded at the request (the same caps as sheet items): 512 characters per text and QR payload, at most 10 secondary lines and 100 items. A label shows far less; the renderer shortens what does not fit (#258 security review).

object
items
Items
Array<object>
default: <= 100 items
RawListingItem

One listing row of raw label data, with bounded text.

object
item
required
Item
string
<= 512 characters
qr_payload
Qr Payload
Any of:
string
<= 512 characters
primary_id
Primary Id
Any of:
string
<= 512 characters
qr_payload
Qr Payload
Any of:
string
<= 512 characters
secondary
Secondary
Array<string>
default: <= 10 items
title
Title
Any of:
string
<= 512 characters
lookup
Any of:
PrintLookupRequest

Resolve label data via an integration plugin.

object
app
required
App
string
identifier
required
Identifier
string
options
PrintOptions

Per-print options — copies, cut behaviour, resolution, layout.

object
auto_cut
Auto Cut
boolean
default: true
copies
Copies
integer
default: 1 >= 1 <= 10
half_cut
Half Cut
boolean
high_resolution
High Resolution
boolean
last_page
Last Page
boolean
default: true
layout_preset
Any of:
QlLayoutPreset

The built-in QL 62 mm across-width layouts (docs/design/ql-layout-presets).

string
Allowed values: compact small_qr standard
orientation
Any of:
LabelOrientation

How the label content runs on endless tape.

string
Allowed values: across along
printer_slug
Printer Slug

Optional: Slug des Ziel-Druckers (muss mit URL-Path übereinstimmen).

Any of:
string

Successful Response

Media typeapplication/json
BatchResponse

202 Response für erfolgreich akzeptierte Batch (auch wenn 0 Items queued).

object
batch_id
required
Batch Id
string format: uuid
job_ids
required
Job Ids
Array<string>
label_job_ids
Label Job Ids

The job of every label (copies included) in print order (#277). The labels are printed in sub-jobs of sub_job_size; each further sub-job waits for POST /api/v1/batches/{batch_id}/continue.

Array<string>
printer_id
required
Printer Id
string format: uuid
queued_at
required
Queued At
string
sub_job_size
required
Sub Job Size

Labels per sub-job (#277).

integer

Example generated

{
"batch_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"job_ids": [
"example"
],
"label_job_ids": [
"example"
],
"printer_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"queued_at": "example",
"sub_job_size": 1
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string

Example generated

{
"detail": [
{
"ctx": {},
"input": "example",
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}