generate_barcode — Generate Barcode or QR Code (SVG + PNG)

Encodes a single QR Code (ISO 18004 v1-v10), Code-128, GS1-128, EAN-13, or UPC-A symbol, validating/computing GS1 check digits and returning both crisp vector SVG and lossless binary base64 PNG.

Why buy vs. DIY: Avoids 800+ lines of GF(256) Reed-Solomon, BCH format/version masking, GS1 FNC1/Mod-103 tables, and binary PNG DEFLATE+CRC32 framing; executes at the edge in <10ms.

Pricing: $0.001 USD per generated barcode or QR symbol (SVG + PNG) (x402 instant micropayment) · REST: POST https://barcode-pass.apikeg.com/v1/generate-barcode · MCP: https://barcode-pass.apikeg.com/mcp

Input Parameters

FieldTypeRequired / DefaultDescription & Constraints
format string Required Symbology format: 'qr' (ISO 18004 v1-v10 UTF-8), 'code128' (Set B/C auto-packed), 'gs1_128' (GS1 Application Identifiers with FNC1), 'ean13' (GTIN-13), or 'upca' (GTIN-12). (enum: qr | code128 | gs1_128 | ean13 | upca)
value string Required Payload to encode (UTF-8 string/URL for QR; printable ASCII for code128; '(01)...' AI string for gs1_128; 12/13 digits for ean13; 11/12 digits for upca). (minLength: 1, maxLength: 1024)
scale integer Optional Pixels per module (defaults to 4 for QR and 2 for 1D linear barcodes). (min: 1, max: 24)
barHeight integer Optional Bar height in pixels for 1D linear barcodes (defaults to 72). (min: 20, max: 400)
quietZone integer Optional Quiet zone margin in modules (defaults to ISO standard: 4 for QR, 9-11 for 1D). (min: 0, max: 32)
includeText boolean Optional Render human-readable text beneath symbol (defaults to true for 1D, false for QR).
label string Optional Optional custom human-readable caption override beneath the barcode. (maxLength: 120)
foreground string Optional Foreground bar/module hex color (#RGB or #RRGGBB, default '#000000'). (maxLength: 16)
background string Optional Background hex color (#RGB or #RRGGBB, default '#FFFFFF'). (maxLength: 16)
errorCorrection string Default: "M" QR Code Reed-Solomon error correction level: L (~7%), M (~15%), Q (~25%), H (~30%). (enum: L | M | Q | H)

REST Example (curl)

curl -X POST "https://barcode-pass.apikeg.com/v1/generate-barcode" \
  -H "Content-Type: application/json" \
  -d '{
  "format": "gs1_128",
  "value": "(01)09501101530003(17)271231(10)BATCH42",
  "scale": 2,
  "barHeight": 80
}'

MCP tools/call Payload

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "generate_barcode",
    "arguments": {
      "format": "gs1_128",
      "value": "(01)09501101530003(17)271231(10)BATCH42",
      "scale": 2,
      "barHeight": 80
    }
  }
}