Deterministic · 1 Credit (Up to 20 Barcodes) · Strict Zero Retention

Barcode Generation API (POST /v1/barcode-generate)

Generate deterministic SVG and PNG barcodes—GS1-128, GS1 DataMatrix, GS1 Digital Link (Sunrise 2027), PDF417, Code 128, Code 39 VIN, ITF-14, EAN-13, and UPC-A—with pre-billing GS1 AI & check-digit validation and 20-item batching for 1 credit.

API Quick Facts

Strict Zero Data Retention
Endpoint
POSThttps://api.structocr.com/v1/barcode-generate
Authentication
x-api-key HTTP header (auto-created on signup)
Pricing & Free Tier
1 credit per request (single or batch of up to 20 barcodes) ($0.0058–$0.01 / request (up to 20 barcodes)). Prepaid packs from $5, no subscription, credits never expire. 200 free credits on signup.
Data Retention
Strict Zero Data Retention — zero LLM calls; input payloads and rendered barcodes are never stored
Supported Inputs
JSON body (`symbology` + `data`, or `items[]` up to 20): outputs SVG or PNG (`output: 'json' | 'raw'`)
Structured Output
Deterministic GS1-128, GS1 DataMatrix, GS1 Digital Link (Sunrise 2027), PDF417, Code 128, Code 39 (with vin_mode), ITF-14, EAN-13 & UPC-A with pre-billing GS1 AI & Modulo-10 check-digit validation
Scope Boundary
Deterministic barcode generation and GS1 syntax/check-digit validation only; does not register GTINs with GS1.

Quickstart & Examples

curl -X POST https://api.structocr.com/v1/barcode-generate \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "symbology": "gs1-128",
    "data": "(01)09506000134352(17)271231(10)LOT42",
    "format": "svg",
    "options": { "scale": 3, "include_text": true }
  }'

Request Parameters

ParameterTypeDescription
symbologystring (required in single mode)One of: gs1-128, gs1-datamatrix, gs1-digital-link, pdf417, code128, code39, itf14, ean13, upca.
datastring (required in single mode)Barcode payload up to 2,000 characters. Use parenthesized AIs for gs1-128 / gs1-datamatrix and https:// URI for gs1-digital-link.
itemsarray (batch mode)Array of 1–20 barcode objects ({ id?, symbology, data, format?, vin_mode?, options? }). Entire batch costs 1 credit.
format"svg" | "png"Output image format (default "svg"). PNG is returned Base64-encoded in JSON mode or raw bytes in raw mode.
output"json" | "raw"Default "json". Pass "raw" on single-item requests to receive raw image/svg+xml or image/png bytes directly.
vin_modebooleanOptional for code39: enforces 17-character ISO 3779 VIN format and 9th-position check digit before billing.
options.scalenumber (1–6)Module scaling factor (default 3).
options.heightnumber (4–100)Bar height in millimeters for 1D symbologies (default 14).
options.include_textbooleanShow human-readable text below 1D barcodes (default true for 1D, false for 2D).
options.paddinginteger (0–40)Quiet-zone padding around the symbol (default 10).
options.fg_color / bg_color6-digit hex stringForeground and background colors (default "000000" / "ffffff").
options.columns / eclevelintegerPDF417 only: data columns (1–30) and Reed-Solomon error correction level (0–8).
options.symbol"qr" | "datamatrix"gs1-digital-link only: choose 2D QR Code (default) or GS1 DataMatrix.

Validation Error Codes (0 Credits Charged)

HTTPError CodeMeaning & Recovery
400BATCH_LIMIT_EXCEEDEDMore than 20 items supplied in items[]. Split into batches of <= 20. (0 credits charged)
400UNSUPPORTED_SYMBOLOGYSymbology is not in the supported list. (0 credits charged)
400RAW_OUTPUT_NOT_SUPPORTED_FOR_BATCHoutput="raw" is only supported for single-item requests. (0 credits charged)
422INVALID_GS1_CHECK_DIGITGTIN-14, SSCC-18, or GLN check digit failed Modulo-10 validation; issues[0].suggestion provides the corrected string. (0 credits charged)
422INVALID_GS1_DATEDate AI (11/13/15/16/17) is not a valid YYMMDD date. (0 credits charged)
422MISSING_GS1_PARENTHESESgs1-128 / gs1-datamatrix requires parenthesized Application Identifiers like (01)...(10).... (0 credits charged)
422INVALID_VIN_CHECK_DIGITcode39 with vin_mode=true failed the 9th-character ISO 3779 VIN check digit. (0 credits charged)
402INSUFFICIENT_CREDITSAccount balance is below 1 credit; includes top_up_url.

Free Browser Generators & Related Guides

Frequently Asked Questions

Does batching 20 barcodes really cost only 1 credit?
Yes. Whether you send a single barcode request or an items[] array with up to 20 barcodes (mixing symbologies and SVG/PNG formats), the entire request consumes exactly 1 credit.
What happens if one item in a 20-item batch has an invalid GS1 check digit?
Every item in the batch is validated before billing. If any item fails validation, the endpoint returns HTTP 422 with the exact item index (for example items[3].(01)) and a fix suggestion, and 0 credits are deducted.
Is POST /v1/barcode-generate zero data retention?
Yes. Input payloads and rendered barcode images are never written to disk or stored in usage_logs.raw_response.