zpl.tools

Quickstart

Render your first label in under five minutes.

If your integration uses Labelary today, start with the Labelary migration guide instead.

1. Create an API key

  1. Sign in and open your API Keys page.
  2. Click Create API Key.
  3. Copy the key and store it safely. Send it in the X-API-Key header on every request.

Every endpoint except the health check requires a key. The beta has no rate limits, request-size limits, or page-count limits.

2. Render a label

In the path, 8dpmm selects a 203-DPI printer, 4x6 gives the label size in inches, and the trailing 0 selects the first label.

cURL

curl -X POST "https://api.zpl.tools/compatibility/labelary/v1/printers/8dpmm/labels/4x6/0" \
  -H "X-API-Key: your_api_key_here" \
  --data "^XA^FO50,50^A0N,50,50^FDHello World^FS^XZ" \
  -o label.png

Python

import requests

api_key = "your_api_key_here"
zpl = "^XA^FO50,50^A0N,50,50^FDHello World^FS^XZ"

response = requests.post(
    "https://api.zpl.tools/compatibility/labelary/v1/printers/8dpmm/labels/4x6/0",
    headers={"X-API-Key": api_key},
    data=zpl,
)
response.raise_for_status()

with open("label.png", "wb") as f:
    f.write(response.content)

Node

import { writeFile } from 'node:fs/promises';

const apiKey = 'your_api_key_here';
const zpl = '^XA^FO50,50^A0N,50,50^FDHello World^FS^XZ';

const response = await fetch('https://api.zpl.tools/compatibility/labelary/v1/printers/8dpmm/labels/4x6/0', {
    method: 'POST',
    headers: { 'X-API-Key': apiKey },
    body: zpl,
});

if (!response.ok) throw new Error(`Render failed: ${response.status}`);

const bytes = Buffer.from(await response.arrayBuffer());
await writeFile('label.png', bytes);

3. Open the result

label.png shows "Hello World" near the top left of a 4×6 label.

To get a PDF instead, add -H "Accept: application/pdf" and save to label.pdf. To render every label in a document as one multi-page PDF, remove the trailing /0 and request application/pdf.

Next steps