Generate a Barcode
Batch Generator
Add multiple barcodes and download them as a single PDF or ZPL file.
Printable Label Sheets
Create print-ready label sheets with barcodes sized for thermal printers. Supports Zebra, Brother QL, and DYMO LabelWriter presets.
Create a Sheet
POST /sheets
Content-Type: application/json
# Using a label preset (default TTL: 1 day)
curl -X POST /sheets \
-H "Content-Type: application/json" \
-d '{
"id": "warehouse-42",
"label_preset": "zebra_2x1",
"barcodes": [
{"type": "code128", "data": "SKU-001", "label_text": "Widget A"},
{"type": "code128", "data": "SKU-002", "label_text": "Widget B"},
{"type": "qr", "data": "https://example.com/item/3"}
]
}'
# With custom TTL (7 days) and custom dimensions (mm)
curl -X POST /sheets \
-H "Content-Type: application/json" \
-d '{
"id": "custom-labels",
"ttl": "7d",
"label_width_mm": 62,
"label_height_mm": 29,
"barcodes": [
{"type": "code128", "data": "ITEM-100", "label_text": "Custom label"}
]
}'
Response (201 Created)
{
"id": "warehouse-42",
"url": "/sheets/warehouse-42",
"barcode_count": 3,
"label_preset": "zebra_2x1",
"label_width_mm": 50.8,
"label_height_mm": 25.4,
"expires_at": "2026-02-11T13:00:00Z"
}
View & Print
GET /sheets/{id}
GET /sheets/{id}?view=dense
Opens a print-ready HTML page. Click "Print Labels" or press Ctrl+P — each barcode prints on one physical label with zero margins.
Use ?view=dense for a compact view that shows a single label preview with a summary count. Ideal for embedding in iframes. All labels are still included when printing.
Combine with ?preset= to re-layout, e.g. /sheets/{id}?view=dense&preset=zebra_4x6.
Sheet Request Fields
| Field | Required | Description |
|---|---|---|
id | No | Custom ID (alphanumeric, hyphens, dots, max 64 chars). Auto-generated UUID if omitted. |
ttl | No | How long the sheet is kept. 1d–60d (default: 1d). Accepts days (7d) or hours (48h). |
label_preset | * | Preset key (e.g. zebra_2x1). Required if no raw dimensions. |
label_width_mm | * | Label width in mm. Overrides preset if both given. |
label_height_mm | * | Label height in mm. Overrides preset if both given. |
barcodes | Yes | Array of barcode entries (at least one). |
barcodes[].type | Yes | Barcode type (qr, code128, etc.) |
barcodes[].data | Yes | Content to encode |
barcodes[].label_text | No | Custom text below barcode (empty = no label) |
Label Presets
All supported presets are also available as a machine-readable JSON file: GET /presets.json
| Preset Key | Name | Size (mm) | Brand |
|---|---|---|---|
zebra_4x6 | Shipping Label | 101.6 x 152.4 | Zebra |
zebra_2x1 | Product/Barcode | 50.8 x 25.4 | Zebra |
zebra_2.25x1.25 | Retail Shelf | 57.15 x 31.75 | Zebra |
zebra_3x1 | Warehouse (narrow) | 76.2 x 25.4 | Zebra |
zebra_3x2 | Warehouse | 76.2 x 50.8 | Zebra |
zebra_4x2 | Address | 101.6 x 50.8 | Zebra |
zebra_4x3 | Pallet/Compliance | 101.6 x 76.2 | Zebra |
zebra_2x2 | Square / QR | 50.8 x 50.8 | Zebra |
zebra_1x1 | Small Square | 25.4 x 25.4 | Zebra |
brother_29x90 | Standard Address | 29 x 90 | Brother QL |
brother_62x29 | Small Shipping | 62 x 29 | Brother QL |
brother_62x100 | Shipping | 62 x 100 | Brother QL |
brother_29x42 | Small Label | 29 x 42 | Brother QL |
brother_17x54 | Return Address | 17 x 54 | Brother QL |
brother_23x23 | Square | 23 x 23 | Brother QL |
dymo_89x28 | Address (30252) | 89 x 28.6 | DYMO |
dymo_101x59 | Shipping (30256) | 101.6 x 58.7 | DYMO |
dymo_54x101 | Shipping alt (30323) | 54 x 101.6 | DYMO |
dymo_57x32 | Multipurpose (30334) | 57.15 x 31.75 | DYMO |
dymo_25x25 | Small Square (30332) | 25.4 x 25.4 | DYMO |
dymo_51x19 | Return Address (30330) | 50.8 x 19.05 | DYMO |
Single Barcode
GET /barcode/{type}/{data}?width=200&height=200&dpi=72&label_text=My+Label&format=png
Returns a barcode image. All query params are optional. Set label_text to render custom text below the barcode.
Output Formats
| Format | Query Param | Content-Type | Description |
|---|---|---|---|
| PNG | format=png (default) | image/png | Raster image, ideal for web and print |
| ZPL | format=zpl | text/plain | Zebra Programming Language, for thermal printers |
Examples
# QR code (PNG)
curl -o qr.png /barcode/qr/hello-world
# Code128 with custom size
curl -o code.png "/barcode/code128/ABC-123?width=400&height=150"
# ZPL output for Zebra printers
curl "/barcode/code128/ABC-123?format=zpl"
# ZPL with label text
curl -o label.zpl "/barcode/ean13/5901234123457?format=zpl&label_text=My+Product"
# Embed in HTML
<img src="/barcode/ean13/5901234123457" />
Supported Types
qr code128 code39 code93
ean13 ean8 codabar aztec
datamatrix pdf417 2of5
Batch (PDF or ZPL)
POST /barcode/batch
Content-Type: application/json
Returns multiple barcodes as a single file. Defaults to PDF (grid layout); set "format": "zpl" for concatenated ZPL labels.
PDF Example
curl -o barcodes.pdf -X POST /barcode/batch \
-H "Content-Type: application/json" \
-d '{
"page_size": "A4",
"columns": 3,
"barcodes": [
{"type": "qr", "data": "First"},
{"type": "qr", "data": "Second"},
{"type": "code128", "data": "ITEM-001"}
]
}'
ZPL Example
curl -o barcodes.zpl -X POST /barcode/batch \
-H "Content-Type: application/json" \
-d '{
"format": "zpl",
"barcodes": [
{"type": "code128", "data": "ITEM-001"},
{"type": "ean13", "data": "5901234123457", "label_text": "EAN Product"}
]
}'
| Field | Default | Description |
|---|---|---|
format | pdf | pdf or zpl |
page_size | A4 | A4, Letter, or Legal (PDF only) |
columns | 1 | Grid columns (PDF only) |
barcodes[].type | required | Barcode format |
barcodes[].data | required | Content to encode |
barcodes[].width | per type | Pixel width |
barcodes[].height | per type | Pixel height |
barcodes[].dpi | 72 | Dots per inch (PNG/PDF only) |
barcodes[].label_text | "" | Custom text below barcode (empty = no label) |
Configuration
All via environment variables:
| Variable | Default | Description |
|---|---|---|
PORT | 8080 | Listen port |
HOST | 0.0.0.0 | Listen address |
CACHE_ENABLED | false | Enable disk cache |
CACHE_DIR | /data/cache | Cache directory |
CACHE_MAX_SIZE_MB | 1024 | Max cache size |
DEFAULT_DPI | 72 | Default DPI |
MAX_BATCH_SIZE | 100 | Max barcodes per batch |
LOG_LEVEL | info | debug, info, warn, error |
STORAGE_BACKEND | memory | Sheet storage backend: memory or tigris |
BUCKET_NAME | — | Tigris bucket name (required when backend is tigris) |
SHEET_DEFAULT_TTL | 24h | Default sheet lifetime (1d) |
SHEET_MIN_TTL | 24h | Minimum allowed sheet TTL |
SHEET_MAX_TTL | 1440h | Maximum allowed sheet TTL (60d) |
Other Endpoints
| Endpoint | Description |
|---|---|
POST /sheets | Create a printable label sheet |
GET /sheets/{id} | View/print a label sheet |
| GET /presets.json | Label preset definitions (JSON) |
GET /healthz | Liveness probe |
GET /readyz | Readiness probe |
| GET /swagger/ | Interactive API docs |