Barcode Encoder

API key v1

Render Code 128, Code 39, EAN, UPC, ITF-14 and Codabar barcodes as PNG, SVG or JPEG.

Encodes a value as a 1D barcode and returns the image bytes directly, so the URL can be used as an <img src> from your own backend, or a JSON envelope with a temporary hosted link when resp=json is set. Check digits are verified for EAN and UPC values and computed when you send the number without one.

GET https://api.zactonz.com/barcode/

Parameters

NameTypeDescription
contentrequired string

The value to encode. Each symbology has its own alphabet and length, listed under the type parameter.

type enum

code128 (printable ASCII, up to 80 characters), code39 (digits, capitals and - . $ / + %), code93, ean13 (12 digits, or 13 with the check digit), ean8 (7 or 8 digits), upca (11 or 12 digits), upce (6 to 8 digits), itf14 (13 or 14 digits), codabar (a start and stop letter A to D around digits).

code128code39code93ean13ean8upcaupceitf14codabar
format enum

png (default), svg or jpg.

pngsvgjpg
scale integer

Width of the narrowest bar in pixels, 1 to 10.

Default 2
height integer

Bar height in pixels, 20 to 300.

Default 60
color string

Bar colour as six hex digits.

Default 000000
bgcolor string

Background colour as six hex digits.

Default ffffff
resp enum

image streams the bytes. json stores the image for 24 hours and returns its link with the dimensions.

imagejson

Send parameters in the query string.

Response

OK

FieldTypeDescription
status integer

200 on success.

data object

The result.

data.barcode string

Temporary link to the rendered image.

data.type string

Symbology used.

data.content string

Value encoded.

data.format string

Image format.

data.width integer

Pixel width, null for SVG.

data.height integer

Pixel height, null for SVG.

data.expires_in integer

Seconds the link stays valid.

Status codes

The outcome is reported in the JSON status field. See Errors & status codes for the general rules.

400 Bad request

content is missing, or it does not fit the chosen symbology. The message says which rule failed.

401 Unauthorized

The Authorization header is missing or the key is not recognised.

403 Forbidden

The key is not licensed for this product.

429 Too many requests

The per-minute rate or the plan quota is exhausted. Retry after the seconds given in Retry-After.

Notes

Images are returned with Cache-Control: public, max-age=86400. Hosted links from resp=json stay valid for 24 hours.