API-Dokumentation

Vollständige Referenz für die BarGen API

Einführung

Die BarGen API generiert Barcodes und QR-Codes in den Formaten SVG, PNG, PDF und EPS über einfache HTTP-Anfragen.

Basis-URL

https://api.bargen.pro/

Authentifizierung

Jede API-Anfrage benötigt einen API-Schlüssel, den Sie in Ihrem Dashboard generieren können.

Der Schlüssel muss im Header X-API-Key gesendet werden:

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

Barcode generieren

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

Parameter

Parameter Typ Erforderlich Standard Beschreibung
type string Yes - Barcode-Typ (im URL-Pfad)
data string Yes - Zu kodierende Daten
scale integer No 2 Skalierungsfaktor (1-10)
height integer No - Höhe in Pixeln (1D-Codes)
width integer No - Breite in Modulen (2D-Codes)
color string No 000000 Vordergrundfarbe (Hex)
bgcolor string No ffffff Hintergrundfarbe (Hex)
includetext boolean No true Text unter dem Barcode anzeigen
fontsize integer No 14 Schriftgröße für Text (8-24)
ecl string No M Fehlerkorrekturstufe (nur QR) (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)

Unterstützte Typen

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

Beispielanfrage

# 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"

Antwort

SVG - Gibt ein SVG-Bild mit Content-Type: image/svg+xml zurück

<?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

Fehlercodes

Code Meaning
400Ungültige Anfrage (fehlerhafte Parameter)
401Fehlender oder ungültiger API-Schlüssel
402Monatliches Anfragelimit erreicht — bitte upgraden Sie Ihren Plan
403Ihr Plan enthält diesen Barcode-Typ oder dieses Format nicht
404Unbekannter Endpunkt
500Serverfehler

Anfragelimits

Die monatlichen Anfragelimits richten sich nach Ihrem Plan: Free 1.000, Pro 10.000, Business 100.000 und Enterprise unbegrenzt. Bei Überschreitung Ihres Limits erhalten Sie bis zum nächsten Abrechnungszeitraum eine 402-Antwort.