Połącz zapisane projekty etykiet z aplikacją magazynową, systemem ERP lub skryptami. Generuj ZPL, PNG i PDF ze zmiennymi danymi lub przygotuj partię do druku.
Dostęp do API wymaga Pro. Dokumentacja jest publiczna.
SAVED DESIGN → VARIABLE OUTPUTEXAMPLE
POST /labels/…/render
{ "variables": { "sku": "A-77" } }
200 OKtext/plain
^XA
^FO24,24^A0N,36,36^FD A-77 ^FS
^XZ
YOUR SAVED DESIGNYOUR PRINTER TRANSPORT
Zapisane etykiety osobisteKlucze API z uprawnieniamiZPL · PNG · PDF
Dokumentacja techniczna · Angielski
Poniższa dokumentacja techniczna i przykłady kodu są w języku angielskim.
01 / GET STARTED
From a saved design to useful output.
Save a personal label. Add placeholders such as {sku} and {price}. For API-time variables, review the editor’s fidelity warnings and save as Vector ZPL.
Create a key in Dashboard → API & Integrations. API access needs active Pro entitlement, including Team membership or an admin grant. Choose Render only for this example; Full label API is needed to list, read or build print jobs. Copy the key when it is shown: it is displayed once.
Set your server environment. Copy the exact API base URL and the saved label’s UUID from your account. Set ZPLCRAFT_BASE_URL, ZPLCRAFT_API_KEY and LABEL_ID, then run an example below.
curl
# Set ZPLCRAFT_BASE_URL, ZPLCRAFT_API_KEY and LABEL_ID
# in your server's environment. Copy the base URL from the dashboard.
curl --fail-with-body \
"$ZPLCRAFT_BASE_URL/labels/$LABEL_ID/render" \
-H "x-api-key: $ZPLCRAFT_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"variables":{"sku":"A-77","price":"9.99"},"format":"zpl"}' \
--output label.zpl
Download the small JavaScript or Python client in Clients & n8n before running its example. Keep keys on your server; do not ship them in browser or mobile apps.
Bearer zplc_… is an alternative. If both headers are set, x-api-key takes precedence.
Content-Type
application/json for POST bodies.
Account boundary
Every operation accesses personal labels owned by the key’s account. Team-space labels are excluded, including for keys created by Team members. There is no arbitrary-source ZPL/PDF upload endpoint in this API.
02 / REFERENCE
Five operations. Explicit scopes.
Full label API keys receive labels:list, labels:read, render and print. Render-only and historical keys receive only render. Revoking a key prevents further access.
GET/labels?limit=50&offset=0
List saved labels
Required scope: labels:list
Returns metadata ordered by most recent update, then ID, both descending. Limit defaults to 50 (1–100); offset defaults to 0 (0–10,000).
Dimensions are in millimetres. total may be null. Stop on next_offset: null; never request an offset above 10,000.
GET/labels/{label_id}
Read the stored artifact
Required scope: labels:read
Returns { "data": { … } } with the metadata above, a dynamic_tokens string array and the exact saved zpl string (or null). No variables or clock tokens are substituted. The editor’s canvas document is not exposed; a nonempty include query is rejected.
GET/labels/{label_id}/zpl
Download untouched ZPL
Required scope: labels:read
Returns the saved command stream as application/vnd.zebra-zpl. Includes X-ZPLCraft-Output-Format: bitmap|vector. Re-save a label in the editor if no ZPL is stored (409).
Both fields are optional; send {} for the defaults. PNG/PDF uses the saved size and DPI. Each successful response includes X-ZPLCraft-Output-Format, identifying the saved bitmap/vector fidelity mode. The container format does not change that mode.
Use variables for one record or records for a batch, never both. Copies defaults to 1. At most 25 records and 100 resulting labels are allowed. The example returns four labels, in record order, with each record’s copies together.
Returns application/vnd.zebra-zpl with an attachment filename, X-ZPLCraft-Label-Count and X-ZPLCraft-Output-Format.
This returns bytes, not a printer dispatch.
Forward the returned stream using your existing spooler, local print service or configured printer transport. This operation has no remote printer address, delivery status or durable queue.
Compatibility routes
POST / accepts label_id, variables and format; optional action is render (default) or print. Print uses the same records/copies limits. POST /labels/{label_id} is a render alias. GET / lists labels, or reads one when ?label_id=UUID is supplied. Scopes remain the same as the matching primary operation.
03 / VARIABLE DATA
One design, changing values.
{name} matches the corresponding variable case-insensitively. Send string values; keys are trimmed and must be safe, nonempty names. The server also converts other JSON values to strings (null becomes empty text). Saved field transforms run before token substitution.
Automatic tokens
Token
Default
Formatted example
{DATE}
YYYY-MM-DD
{DATE:DD.MM.YYYY}
{TIME}
HH:mm
{TIME:HH:mm:ss}
{DATETIME}
YYYY-MM-DD HH:mm
{DATETIME:YYYY-MM-DD}
{COUNTER}
1
{COUNTER:42} → 42
Time uses the server clock (UTC in the hosted API). Format tokens: YYYY/YY, MM, DD, HH, mm and ss. COUNTER uses its seed; it does not advance across API records or copies. Supply your own serial number variable when each label needs a distinct value.
Text: unmatched placeholders stay unchanged. Inserted values are ZPL hex-escaped; values cannot inject commands. Variable names containing underscores work with raw and saved ^FH-escaped spellings.
Barcodes: missing variables or invalid digits, length, check digit or character set return 422 with field-level details. Native barcodes are substituted in place; marked raster barcodes (such as QR/Data Matrix/PDF417) are re-encoded. A larger payload can grow the symbol from its saved top-left corner.
Older raster barcodes: re-save the design to add re-encoding metadata. Without it, older rasters retain their original values.
Dynamic Bitmap ZPL returns 409.
Pixel-exact Bitmap ZPL has already rasterized text. For API-time variables, review fidelity in the editor and save as Vector ZPL. The error code is bitmap_dynamic_output_incompatible.
04 / CAPACITY
Plan around the shared budget.
The account and each key have a 60-unit, one-minute budget. Every authenticated attempt costs 1 unit. A valid print job costs 5 + record count units total: one record costs 6; 25 records cost 30. Copies do not add rate units. Rotating a key does not reset the account budget.
API limits
Limit
Maximum
Active keys per account
5
JSON request body
65,536 bytes (64 KiB)
Variables per record
50 keys · 80 characters per key · 1,000 per value
List pagination
100 results · offset 10,000
Print-ready job
25 record objects · records × copies ≤ 100 labels
Stored/output ZPL for render and print
2,097,152 JavaScript string units (about 2 MiB for ASCII); includes the whole print job
Stored ZPL complexity for render and print
10,000 command prefixes
PNG/PDF render surface
16 million pixels · 12,000 dots per dimension
Saved dimensions for PNG/PDF
10–1,000 mm per dimension, subject to pixel limits
Labelary response / timeout
32 MiB · 15 seconds
Dynamic barcode processing
128 marked fields · 4,096 dots per raster dimension · 8,388,608 re-encoded pixels shared across a print job
For 429 or 503, wait the Retry-After number of seconds before retrying. The supplied clients do not retry automatically. Do not reuse automatic retries from a byte-generation call to infer whether a physical print succeeded.
05 / RECOVERY
Errors you can act on.
Errors return JSON with an error message. Scope failures may include required_scope; transform and output-mode failures include code; barcode failures include fields.
HTTP error reference
Status
Meaning / next step
400
Invalid JSON, UUID, pagination, variables, format or print parameters. Correct the request.
401
Missing, malformed or unknown key. Check the server credential.
403
Pro entitlement is inactive, or the key lacks the required scope.
404
Route or personal label was not found for this account.
405
Use the method documented for the route.
408
Reading the request body timed out.
409
No stored ZPL, invalid saved size, or dynamic Bitmap ZPL. Review and re-save the design.
413
Body, output, dimensions or processing complexity exceeds a bound. Reduce the job or label.
422
Invalid barcode values / unresolved barcode tokens, or field_transform_invalid from saved transforms.
429
Rate budget exceeded. Wait Retry-After seconds.
500
Database, entitlement or account/key limiter check failed.
502
Labelary failed, or returned an invalid or oversized artifact.
Download these source files into your server project. They cover listing, reading, stored ZPL, rendering and print-job generation. Both preserve status, scope and barcode errors, expose Retry-After, set a 30-second timeout by default and refuse HTTP redirects. HTTPS is required except for localhost development.
JavaScript / TypeScript
Node.js 20+, native fetch. ZPL is text; PNG/PDF uses Uint8Array. Place the type declaration next to the module.
Import the workflow JSON using n8n’s Import from File action. It contains a manual trigger, an HTTP Request node and setup notes, with no embedded credential.
Replace the example project URL and REPLACE_WITH_LABEL_UUID in the HTTP Request node.
Create a Header Auth credential with header name x-api-key and your key as its value. Select this credential in the node. A render-only key is sufficient.
Use a saved Vector ZPL label containing {sku} and {price}, or edit the example variables to match your label.
Execute manually. Download the binary output named label as label.zpl. The workflow stops on HTTP errors; it does not retry or dispatch to a printer.