QRdx
HelpGuidesDevelopersReact librarySelf-hosting

Render a barcode image from a JSON body

The same image as GET /barcode, with the same fields as JSON, so the value never appears in a URL or a log of one. Not cached (Cache-Control: no-store). No key needed; it shares the 300 requests a minute per IP address with GET.

POST
/barcode

Request Body

application/json
  1. body
format*string

The symbology: ean13 (EAN-13), ean8 (EAN-8), upca (UPC-A), upce (UPC-E), code128 (Code 128), code39 (Code 39), itf14 (ITF-14), gs1-128 (GS1-128), datamatrix (Data Matrix), pdf417 (PDF417), aztec (Aztec)

Value in"ean13""ean8""upca""upce""code128""code39""itf14""gs1-128""datamatrix""pdf417""aztec"
data*string

The number or text to encode. Retail numbers (EAN, UPC, ITF-14, GS1 GTINs and SSCCs) can leave the check digit off and it's added; a wrong one is an error.

Length1 <= length <= 1000
type?string

File type: svg (default), png, jpg, webp, avif, pdf or eps. Raster images are scale pixels per module; SVG, PDF and EPS are vectors at one point per module (0.353 mm).

Default"svg"
Value in"png""jpg""webp""avif""svg""pdf""eps"
fg?string

Bar and text color (default 000000) as hex, such as 000000 (in URLs leave out the # or encode it as %23)

Lengthlength <= 7
bg?string

Background color (default ffffff) as hex, such as 000000 (in URLs leave out the # or encode it as %23)

Lengthlength <= 7
scale?integer

Pixels per module in raster images (1-10, default 4)

Range1 <= value <= 10
height?number

Bar height of linear barcodes in millimetres at the vector size (5-60; default depends on the format)

Range5 <= value <= 60
quietZone?integer

Blank margin in modules: left and right of linear barcodes (up to 20), all round 2D codes (up to 10). Defaults to the format's minimum.

Range0 <= value <= 20
text?boolean

Print the digits or text under linear barcodes (default true)

rotate?|||

Clockwise rotation in degrees: 0, 90, 180 or 270 (default 0)

Response Body

The image or file. Cache-Control: no-store.

response?string
Example Request
curl -X POST 'https://api.qrdx.dev/v1/barcode' \  -H 'Content-Type: application/json' \  -d '{  "format": "gs1-128",  "data": "(01)09501101530003(17)261231(10)AB-123",  "type": "png",  "scale": 3}'
Example Response
"<svg width=\"129.333mm\" height=\"55.333mm\" shape-rendering=\"crispEdges\" viewBox=\"0 0 388 166\" xmlns=\"http://www.w3.org/2000/svg\">…</svg>"

Last updated on