Barcode API

Generate a Barcode

Batch Generator

Add multiple barcodes and download them as a single PDF or ZPL file.

Single Barcode

GET /barcode/{type}/{data}?width=200&height=200&dpi=72&label=true&format=png

Returns a barcode image. All query params are optional. Set label=true to render the data value as text below the barcode.

Output Formats

FormatQuery ParamContent-TypeDescription
PNGformat=png (default)image/pngRaster image, ideal for web and print
ZPLformat=zpltext/plainZebra 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=true"

# 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", "label": false}
    ]
  }'

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": true}
    ]
  }'
FieldDefaultDescription
formatpdfpdf or zpl
page_sizeA4A4, Letter, or Legal (PDF only)
columns1Grid columns (PDF only)
barcodes[].typerequiredBarcode format
barcodes[].datarequiredContent to encode
barcodes[].widthper typePixel width
barcodes[].heightper typePixel height
barcodes[].dpi72Dots per inch (PNG/PDF only)
barcodes[].labeltrueShow text label below barcode

Configuration

All via environment variables:

VariableDefaultDescription
PORT8080Listen port
HOST0.0.0.0Listen address
CACHE_ENABLEDfalseEnable disk cache
CACHE_DIR/data/cacheCache directory
CACHE_MAX_SIZE_MB1024Max cache size
DEFAULT_DPI72Default DPI
MAX_BATCH_SIZE100Max barcodes per batch
LOG_LEVELinfodebug, info, warn, error

Other Endpoints

EndpointDescription
GET /healthzLiveness probe
GET /readyzReadiness probe
GET /swagger/Interactive API docs