Ir a la referencia de la API

Para tu flujo de trabajo

Tus etiquetas. Tus datos. Una API.

Conecta tus diseños de etiquetas guardados a tu aplicación de almacén, ERP o scripts. Genera ZPL, PNG y PDF con datos variables o prepara un lote para imprimir.

El acceso a la API requiere Pro. Esta referencia es pública.

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
Etiquetas personales guardadasClaves de API con permisosZPL · PNG · PDF
Referencia técnica · Inglés

La referencia técnica y los ejemplos de código siguientes están en inglés.

01 / GET STARTED

From a saved design to useful output.

  1. 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.
  2. 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.
  3. 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.

Base URL & authentication

Base URL
https://<project>.supabase.co/functions/v1/label-api
Authentication headers
HeaderValue
x-api-keyYour zplc_… key.
AuthorizationBearer zplc_… is an alternative. If both headers are set, x-api-key takes precedence.
Content-Typeapplication/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).

List response
{
  "data": [{
    "id": "6f3d79d2-18f0-445f-b1d7-706988ecaf22",
    "name": "Shelf label", "width": 80, "height": 50,
    "dpi": 203, "revision": 4, "output_format": "vector",
    "created_at": "2026-08-01T10:00:00.000Z",
    "updated_at": "2026-08-12T08:30:00.000Z"
  }],
  "pagination": {
    "limit": 50, "offset": 0, "total": 1, "next_offset": null
  }
}

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).

POST/labels/{label_id}/render

Render with variable data

Required scope: render

Render body
{
  "variables": { "sku": "A-77", "price": "9.99" },
  "format": "zpl"
}
Render response formats
formatResponseProcessing
zpltext/plainDefault. Substitutes the saved ZPL.
pngimage/pngSends substituted ZPL to Labelary.
pdfapplication/pdfSends substituted ZPL to Labelary.

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.

POST/labels/{label_id}/print

Build a print-ready batch

Required scope: print

Print-job body
{
  "records": [
    { "sku": "A-77", "price": "9.99" },
    { "sku": "A-78", "price": "12.50" }
  ],
  "copies": 2
}

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
TokenDefaultFormatted 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
LimitMaximum
Active keys per account5
JSON request body65,536 bytes (64 KiB)
Variables per record50 keys · 80 characters per key · 1,000 per value
List pagination100 results · offset 10,000
Print-ready job25 record objects · records × copies ≤ 100 labels
Stored/output ZPL for render and print2,097,152 JavaScript string units (about 2 MiB for ASCII); includes the whole print job
Stored ZPL complexity for render and print10,000 command prefixes
PNG/PDF render surface16 million pixels · 12,000 dots per dimension
Saved dimensions for PNG/PDF10–1,000 mm per dimension, subject to pixel limits
Labelary response / timeout32 MiB · 15 seconds
Dynamic barcode processing128 marked fields · 4,096 dots per raster dimension · 8,388,608 re-encoded pixels shared across a print job
Deployment-wide credential guards6,000 prechecks/minute · 6,000 unknown keys/minute

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
StatusMeaning / next step
400Invalid JSON, UUID, pagination, variables, format or print parameters. Correct the request.
401Missing, malformed or unknown key. Check the server credential.
403Pro entitlement is inactive, or the key lacks the required scope.
404Route or personal label was not found for this account.
405Use the method documented for the route.
408Reading the request body timed out.
409No stored ZPL, invalid saved size, or dynamic Bitmap ZPL. Review and re-save the design.
413Body, output, dimensions or processing complexity exceeds a bound. Reduce the job or label.
422Invalid barcode values / unresolved barcode tokens, or field_transform_invalid from saved transforms.
429Rate budget exceeded. Wait Retry-After seconds.
500Database, entitlement or account/key limiter check failed.
502Labelary failed, or returned an invalid or oversized artifact.
503Deployment credential limiter unavailable. Request fails closed; wait Retry-After seconds.
504Labelary render request or response timed out.
422 barcode response
{
  "error": "Variable substitution produced invalid barcode content.",
  "fields": [{
    "symbology": "EAN13", "template": "{sku}",
    "value": "A-77", "reason": "EAN-13 needs 12 or 13 digits"
  }]
}
06 / INTEGRATIONS

Start with a small, readable client.

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.

Python

Python 3.10+, standard library only. Artifact.data is bytes; Artifact.text decodes ZPL as UTF-8.

Descargar cliente

n8n: render a saved label

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.

  1. Replace the example project URL and REPLACE_WITH_LABEL_UUID in the HTTP Request node.
  2. 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.
  3. Use a saved Vector ZPL label containing {sku} and {price}, or edit the example variables to match your label.
  4. 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.
Descargar flujo n8n