Skip to content

xBarcode API Reference

All responses are SVG images (Content-Type: image/svg+xml).

Request Format

GET /{symbology}/{content}?{parameters}
ComponentDescription
symbologyBarcode type (e.g., qr, code128, pdf417)
contentData to encode (URL-encode if necessary)
parametersOptional query parameters to customize output

Common Parameters

The following parameters apply to almost all barcode types:

ParameterTypeDefaultDescription
widthnumber(auto)Force output width (pixels/units)
heightnumber(auto)Force output height
rotatenumber0Rotation angle (0, 90, 180, 270)
marginnumber0Quiet zone margin (in modules). Alias: m
fghex000000Foreground color (barcode bars)
bghexffffffBackground color

1D Barcodes

Supported symbologies: code128, ean13, ean8, upca, upce, code39, code93, codabar, itf, msi, and more.

Example:

GET /code128/ABC-1234?height=80

Bearer Bars

1D barcodes support optional bearer bars (horizontal support bars), commonly used for ITF-14 or visual styling.

ParameterTypeDefaultDescription
bearerstringnoneShape: top_bottom, top_only, bottom_only
thicknessnumber0Bearer bar thickness (modules/pixels)
quietnumber10Gap between barcode and bearer bars

Examples:

GET /itf/123456?bearer=top_bottom&thickness=5   (ITF-14 style)
GET /code128/TEST?bearer=top_bottom&thickness=2 (Visual styling)

2D Barcodes

QR Code

Endpoint: /qr/{content}

ParameterTypeDefaultDescription
eclstringMError correction level: L, M, Q, H
versionnumber(auto)Fixed version (1–40). Omit for auto-sizing.

Example:

GET /qr/https://example.com?ecl=H

GS1 QR Code

Endpoint: /gs1_qr/{content}

Generates GS1-compliant QR Codes using FNC1 mode. See GS1 Guide for details.

DataMatrix

Endpoint: /datamatrix/{content}

ParameterTypeDefaultDescription
shapestringsquareSymbol shape: square or rect

GS1 DataMatrix

Endpoint: /gs1_datamatrix/{content}

Generates GS1-compliant DataMatrix with FNC1 prefix. See GS1 Guide for details.

PDF417

Endpoint: /pdf417/{content}

ParameterTypeDefaultDescription
colsnumber(auto)Number of data columns (1–30)
rowsnumber(auto)Number of rows (3–90)
eclnumber(auto)Error correction level (0–8)
compactbooleanfalseSet true for Compact/Truncated PDF417

Aztec Code

Endpoint: /aztec/{content}

ParameterTypeDefaultDescription
eclnumber~23Minimum error correction percentage (0–100)
layersnumber(auto)Force specific number of layers

MaxiCode

Endpoint: /maxicode/{content}

ParameterTypeDefaultDescription
modenumber4MaxiCode mode (2, 3, 4, 5)

Error Handling

When barcode generation fails (data too long, invalid characters, etc.), the server returns:

FieldValue
Status Code400 Bad Request
Response BodyPlain text error message (e.g., "Numeric limit exceeded")