API Documentation

Complete reference for the BarGen API

Introduction

The BarGen API generates barcodes and QR codes in SVG, PNG, PDF and EPS formats through simple HTTP requests.

Base URL

https://api.bargen.pro/

Authentication

Every API request requires an API key, which can be generated from your dashboard.

The key must be sent in the X-API-Key header:

curl -H "X-API-Key: your-api-key" \
  "https://api.bargen.pro/v1/barcode/qrcode?data=Hello"

Generate Barcode

GET https://api.bargen.pro/v1/barcode/{type}

Parameters

Parameter Type Required Default Description
type string Yes - Barcode type (in URL path)
data string Yes - Data to encode
scale integer No 2 Scale factor (1-10)
height integer No - Height in pixels (1D codes)
width integer No - Width in modules (2D codes)
color string No 000000 Foreground color hex
bgcolor string No ffffff Background color hex
includetext boolean No true Show text below barcode
fontsize integer No 14 Font size for text (8-24)
ecl string No M Error correction level (QR only) (L/M/Q/H)
format string No svg Output format: svg (all plans), png, pdf, eps (Pro/Enterprise)
pngzoom float No 1 PNG zoom factor (0.5-10). Use 2-3 for retina, 5+ for print (Pro/Enterprise)

Supported Types

qrcode
code128
code39
ean13
ean8
upca
upce
itf12
itf14
itf16
gls-ecsomag
codabar
datamatrix
pdf417
aztec
gs1-128
gs1-datamatrix
microqr
imb
rms4cc
kix
postnet
planet
maxicode
dotcode

Example Request

# SVG (default)
curl -H "X-API-Key: your-key" \
  "https://api.bargen.pro/v1/barcode/qrcode?data=https://example.com&scale=4"

# PNG standard resolution (Pro/Enterprise)
curl -H "X-API-Key: your-key" -o barcode.png \
  "https://api.bargen.pro/v1/barcode/qrcode?data=https://example.com&format=png"

# PNG print quality - 5x zoom (Pro/Enterprise)
curl -H "X-API-Key: your-key" -o barcode-hires.png \
  "https://api.bargen.pro/v1/barcode/ean13?data=5901234123457&format=png&pngzoom=5"

Response

SVG - Returns SVG image with Content-Type: image/svg+xml

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" ...>
  ...
</svg>

PNG/PDF/EPS - Binary image data (Pro/Enterprise)

Content-Type: image/png | application/pdf | application/postscript

Error Codes

Code Meaning
400Bad request (invalid parameters)
401Missing or invalid API key
402Monthly request limit reached — upgrade your plan
403Your plan does not include this barcode type or format
404Unknown endpoint
500Server error

Rate Limits

Monthly request limits depend on your plan: Free 1,000, Pro 10,000, Business 100,000, and Enterprise unlimited. Exceeding your limit returns a 402 response until the next billing period.