Print a label when a 3PL order is packed
At a packing station, the scan that closes the carton should submit the label. No dialog, one printer_code for that bench.
For 3PL packing stations
Overview
A 3PL bench already scans the order to say it is packed. That scan is the moment the 4 by 6 label must peel. The WMS, not the browser on the scanner, should POST the label that the carrier or your renderer just produced.
Give each bench its own printer_code. A shared code prints on the wrong line. Store the job id on the shipment so a jam can be reprinted with a new key without guessing which request failed.
PDF labels go through the driver. ZPL labels go raw. Do not convert a carrier PDF into ZPL on the fly unless you have a tested converter.
Integration steps
- 01
Decide the printer before the click
Map the station, store, or line to a printer_code from GET /v1/printers. Do not ask the operator to pick a dialog.
- 02
Create the document in your system
PDF for driver printers, raw ZPL or ESC/POS when the device speaks that language.
- 03
POST when the business event happens
Pack, pay, check-in, or scan. Not on every autosave. Use the business id as Idempotency-Key.
- 04
Show the job result where the work is
queued is not done. Surface AGENT_OFFLINE and PRINT_ERROR to the person at the bench.
Node.js
// Pack event: 4x6 label
const res = await fetch('https://api.printbase.cloud/v1/print-jobs', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PRINTBASE_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': idempotencyKey,
},
body: JSON.stringify({
printer_code: Number(process.env.PRINTER_CODE),
content_type: 'pdf',
content: pdf.toString('base64'),
copies: 1,
}),
});
if (!res.ok) throw new Error(`PrintBase ${res.status}: ${await res.text()}`);
const job = await res.json();
// { id: "job_abc", status: "queued" }
Details for this setup
Bench mapping
The scan gun does not choose the printer. The bench id on the scan does. The agent prints only what you send; it does not fetch the document from the platform for you.
Two documents
A packing slip and a label are two jobs if they are two printers. The agent prints only what you send; it does not fetch the document from the platform for you.
Questions
Does the API know what a carton is?
No. You send the file when your WMS says the carton is closed.
Multiple labels per carton?
One job per file, or copies if they are identical. Put the carton id in the idempotency key.
The station PC sleeps between waves?
Wake it. AGENT_OFFLINE means that agent is gone. The call is still POST /v1/print-jobs with a Bearer API key, and HTTP 201 means queued rather than printed.
Is there a WMS plugin?
No. Call the API from the pack event. The call is still POST /v1/print-jobs with a Bearer API key, and HTTP 201 means queued rather than printed.
Free plan: 100 jobs a month on one computer, no card.