Skip to main content

Documentation · API v1

API documentation

Everything you need to generate ZPL labels with a single API call.

The API is also described in OpenAPI 3.1, for generating a client or importing it into a tool such as Postman: openapi.json.

Quick Start

Generate your first label. Replace YOUR_API_KEY with the key from your dashboard.

curl -X POST https://api.zeepler.com/v1/zeeplify \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "size": "4x2"
    },
    "data": {
      "product": "Widget Pro",
      "sku": "WDG-001"
    },
    "templates": [
      {
        "type": "Text",
        "dataPath": "product",
        "coords": [
          50,
          30
        ],
        "font": "0,40"
      },
      {
        "type": "BarCode",
        "dataPath": "sku",
        "coords": [
          50,
          100
        ],
        "style": "code128"
      }
    ]
  }'

Authentication

Every request carries your API key in the x-api-key header. Generate one in your dashboard; it starts with zpl_. A missing, unknown or disabled key is answered with 401. Send it to the host of the region your account was created in: api.zeepler.com for the United States, or api.ca.zeepler.com for Canada. A key is unknown in the other region, so it gets a 401 there.

http
POST /v1/zeeplify
Host: api.zeepler.com
x-api-key: zpl_your_api_key
Content-Type: application/json

Checking a key

GET /v1/me checks a key without generating a label, so it costs nothing. It answers your plan, the labels used this month, and your monthly cap, which is null when there is none. A bad key gets the same 401 as above, and it counts toward the same rate limit.

http
GET /v1/me
Host: api.zeepler.com
x-api-key: zpl_your_api_key
json
{
  "plan": "free",            // "free", "card" or "invoice"
  "labelsThisMonth": 3,
  "cap": 40                  // null when uncapped
}

Request Body

The request body contains your label data and templates.

configobjectrequired

Label configuration

json
{
  "size": "4x2"  // 1x0.5, 2x1, 2.25x1.25, 3x1, 4x2 or 4x6
  // "lang" is optional and only takes "zpl", which is the default
}
dataobjectrequired

Your label data (any key-value pairs)

json
{
  "product": "Widget Pro",
  "sku": "WDG-001",
  "price": "$29.99"
}
templatesarrayrequired

Array of elements to render on the label

Template Types

Each template defines an element on your label. Use dataPath to reference values from your data object.

Text

json
{
  "type": "Text",
  "dataPath": "product",     // Key from your data object
  "coords": [50, 30],        // [x, y] position in dots
  "font": "0,40",            // Optional: font name, height, width
  "maxLength": 22,           // Optional: truncate; text does not wrap
  // "serial": {"increment": 1}, // Optional: count the trailing digits
                             // up on each of config.copies
  "align": "center"          // Optional: left (default), center, right.
                             // center and right keep x as the margin
                             // on both sides
  // "orientation": "R"      // Optional: N (default), R (a quarter turn
                             // clockwise), I (upside down), B (a quarter
                             // turn the other way). R, I and B need a
                             // font and allow only align left
}

BarCode

json
{
  "type": "BarCode",
  "dataPath": "sku",
  "coords": [50, 80],
  "style": "code128"         // Optional: code128 (default), code93, ean13,
                             // code39, i2of5, upca, ean8, codabar,
                             // gs1-128, hibc.
                             // ean13 takes 12 or 13 digits, upca 11 or
                             // 12, ean8 7 or 8, i2of5 an even number.
                             // gs1-128 takes (01)...(17)...(10)...;
                             // hibc takes HIBC primary data, and
                             // zeepler adds the + and check character
  // "height": 100,          // Optional: bar height in dots, 10 to the
                             // label height less the text under the
                             // bars (27 for ean13, upca, ean8; 22 for
                             // code39, codabar; 21 for code93; 20 for
                             // i2of5; for hibc, its symbology's; for
                             // gs1-128, which scales its text, 82 at
                             // moduleWidth 2).
                             // Default 59 for code128, 100 for the others
  // "fullAscii": false      // code93 only: send the value unchanged.
                             // By default lower case and punctuation are
                             // sent as Zebra's full-ASCII pairs
  // "moduleWidth": 3,       // Optional: narrowest bar, 1 to 10 dots.
                             // Default 3 for ean13, upca, ean8, else 2
  // "ratio": 3,             // code39, i2of5, codabar, and hibc with
                             // symbology code39: wide bars to narrow,
                             // 2, 2.5 (default) or 3
  // "hri": "above",         // Optional: none, below, above. Default
                             // none for code128, below for the others
  // "checkDigit": true,     // code39, i2of5: the printer adds its check
                             // digit (i2of5 then takes an odd count)
  // "start": "B",           // codabar: start and stop characters,
  // "stop": "D",            // A to D (default A)
  // "symbology": "code39",  // hibc: code128 (default) or code39
  // "serial": {"increment": 1}, // Optional: as on Text, but not on
                             // gs1-128 or hibc
  // "align": "center"       // Optional: left (default), center, right.
                             // center ignores x; right ends the bars
                             // x dots from the label's right edge.
                             // gs1-128 takes left only
  // "orientation": "R"      // Optional: N (default), R, I, B, as Text.
                             // Turned R or B, height runs across the
                             // label, so the label width caps it
}

QRCode

json
{
  "type": "QRCode",
  "dataPath": "url",
  "coords": [200, 30],
  "magnification": 5         // Required: size, 1-10
}

Response

On success the API returns ZPL as text/plain, ready to send to a Zebra printer at 203 dpi. This is the exact response to the quick start above.

zpl
^XA^MCY^XZ
    ^XA
    ^SZ2
    ^MMT
    ^MNY
    ^LL406
    ^PW812
    ^LH0,0
^CF0,40^FO50,30^FDWidget Pro^FS
^BY2,2,59^FO50,100^BCN,,N,N,N,A^FDWDG-001^FS
^XZ

When any value has an accented or other non-ASCII character, the label also carries ^CI28, which tells the printer the text is UTF-8. It needs Zebra firmware x.14 or later. Before it ends, the label sets the printer back to ^CI0, the factory default. If your printer is set to a different code page, set it again in your next label.

Status Codes

200Success - ZPL returned
400Invalid body - every problem is listed with its field
401Missing, unknown or disabled API key
402Free monthly labels used - an account without a card can generate 40 a month; add a card in the dashboard
429Too many requests - wait the seconds in the Retry-After header - or monthly spending limit reached
500Our fault, not yours - retry

Label Sizes

Coordinate system uses dots (203 DPI). Origin (0,0) is top-left.

1" x 0.5"

203 x 101 dots

Good for: Small parts and cable tags

2" x 1"

406 x 203 dots

Good for: Price tags, bins and shelves

2.25" x 1.25"

456 x 253 dots

Good for: Specimen bags, evidence and general labels

3" x 1"

609 x 203 dots

Good for: Product labels, asset tags

4" x 2"

812 x 406 dots

Good for: Shipping labels, detailed info

4" x 6"

812 x 1218 dots

Good for: Carrier shipping labels

Complete Example

A shipping label with product name, SKU barcode and QR code.

json
1{
2 "config": {
3 "size": "4x2"
4 },
5 "data": {
6 "product": "Widget Pro",
7 "sku": "WDG-001",
8 "url": "https://example.com/track/12345"
9 },
10 "templates": [
11 {
12 "type": "Text",
13 "dataPath": "product",
14 "coords": [
15 50,
16 30
17 ],
18 "font": "0,40"
19 },
20 {
21 "type": "BarCode",
22 "dataPath": "sku",
23 "coords": [
24 50,
25 100
26 ],
27 "style": "code128"
28 },
29 {
30 "type": "QRCode",
31 "dataPath": "url",
32 "coords": [
33 560,
34 30
35 ],
36 "magnification": 6
37 }
38 ]
39}

And what the API returns for it:

zpl
^XA^MCY^XZ
    ^XA
    ^SZ2
    ^MMT
    ^MNY
    ^LL406
    ^PW812
    ^LH0,0
^CF0,40^FO50,30^FDWidget Pro^FS
^BY2,2,59^FO50,100^BCN,,N,N,N,A^FDWDG-001^FS
^BY2,2,0^FO560,30^BQN,2,6^FDQA,https://example.com/track/12345^FS
^XZ

Integration guides

Worked labels for public-sector workflows, each with the request, the ZPL it returns, and what to check before going live.

Starter app

zeepler-web-starter is an open-source (MIT) web app to fork as the start of your own integration. It checks your key with GET /v1/me, builds a label from a form, and shows the ZPL it gets back, ready to copy. One file defines the label and one file talks to the API, so changing either is a small edit.

Your key stays in your browser and goes only to the zeepler API. Read the Security section of its README before you deploy a copy for other people.

ZPL how-to

Answers to common ZPL questions, in plain ZPL first and then as a zeepler request.

  • QR code size in ZPL

    How ^BQ magnification sets the size of a QR code, and how to work out the size in dots.

  • Printing ^, ~ and _ in ZPL

    Why a caret or tilde in your data cuts the field short, and how ^FH prints them.

  • Font size in ZPL

    Setting text height with ^A and ^CF, converting points to dots, and why ^CF carries over.

  • Send ZPL to a Zebra printer from C#

    Send ZPL from .NET to a network printer on port 9100, or to a USB printer through the Windows spooler, without the driver redrawing it.

  • Code 128 barcodes in ZPL

    Set a Code 128 barcode's width and height with ^BY and ^BC, work out its width in dots, and pick subsets A, B and C.

  • Accented characters in ZPL (^CI28)

    Print é, ç, ô and € with ^CI28, switch the printer back with ^CI0, and what to do on older firmware.

  • Send ZPL to a Zebra printer from Python

    Send ZPL from Python to a network printer on port 9100, or to a USB printer through the Windows spooler, without the driver redrawing it.

  • Change a barcode to a QR code in ZPL

    Swap ^BC for ^BQ, start the field data with QA, so the first characters scan, and reset the ^BY left over from the barcode.

  • Send ZPL to a Zebra printer from Node.js

    Send ZPL from Node.js to a network printer on port 9100 or to a USB printer through a Windows printer share, and print from a web page through your server.

  • Label size and origin in ZPL (^PW, ^LL, ^LH)

    Set the label size in dots with ^PW and ^LL, move 0,0 with ^LH, and stop the last label's settings moving this one.

  • Templates in ZPL: store a format with ^DF, fill it with ^XF

    Store a label layout on the printer with ^DF and ^FN, fill it with ^XF, and what prints when a field or the format is missing.

  • Several labels in one ZPL job

    Send several different labels in one job, stop each one inheriting the last one's font and barcode settings, and number a run with ^SN and ^PQ.

  • EAN-13 and Code 93 barcodes in ZPL

    Print EAN-13 with ^BE and Code 93 with ^BA, and the data each one changes: a replaced check digit, and characters Code 93 cannot hold.

  • Print copies of a ZPL label with ^PQ

    Print several copies of one label with ^PQ, why ^PQ after ^XZ prints only one, and each serial number twice with ^SN.

  • Center text in ZPL with ^FB

    Center text of any length with ^FB, why centered text sits a little left, and text too long for the block.

  • Center or right-align a barcode in ZPL

    Right-align a barcode with the third value of ^FO, center one by working out its width, and why ^FB does not move it.

  • Wrap text and new lines in ZPL

    Wrap long text with ^FB, start a new line with \&, and stop ^FB writing over its last line or cutting text off.

  • Rotate text and barcodes in ZPL

    Turn text and barcodes with N, R, I and B, where ^FO and ^FT put a turned field, ^FW and ^POI, and why both stay set.

  • Preview ZPL without a printer

    See a label before printing it with Labelary's viewer or API, what zeepler's playground shows, and what no preview can tell you.

  • Boxes, lines, underline and bold in ZPL (^GB)

    Draw boxes and lines with ^GB, print white on black with ^FR, underline text with a line, and make text bolder.

  • Logos and images in ZPL (^GF, ~DG, ^XG)

    Print a logo with ^GF, turn a PNG into hex, keep it under the size limit, and store it once with ~DG to print with ^XG.

  • GS1-128 barcodes in ZPL, with the check digit

    Print GS1-128 with ^BC and FNC1, work out the mod 10 check digit of a GTIN or SSCC, separate fields that vary in length, and what the printer adds itself.

  • 300 dpi printers, and the same ZPL on 203 and 300 dpi

    Why a 203 dpi label prints smaller at 300 dpi, scaling it by 1.5 and what does not scale exactly, ^MU in millimetres, and reading the printer's resolution.

  • Comments in ZPL: ^FX

    Write a comment with ^FX, why a caret inside one runs as a command, comments outside ^XA and ^XZ, and why // is not a comment.

  • Emulate a Zebra printer for testing

    A stand-in printer on port 9100 in a few lines of Python or Node.js, pointing your send code at it, checking what it caught in Labelary, and what a stand-in cannot test.

  • Convert ZPL to PDF or PNG

    Labelary's API turns ZPL into a PDF, one label to a page, or a PNG of one label: curl, Python and Node.js, its limits, and what it means to send it your labels.

  • Convert a PDF to ZPL

    Draw each page of the PDF as dots at the printer's resolution and send them as ^GF: a Python script, sizing, grey, the ^GF size limit, and why the label prints as a picture.

  • Convert EPL to ZPL

    Translate an EPL2 label to ZPL by hand: each common EPL command and its ZPL equivalent, one label translated line by line, what does not carry over, and switching a printer's language.

  • Convert HTML to ZPL

    Two ways from an HTML label to ZPL: draw the page in a headless browser and send the dots as ^GF (a Node.js script), or write the label as ZPL fields, with which HTML and CSS ideas carry over and which do not.

Need Help?

Having trouble? Email us - the first reply comes within 2 business days.