Barcode API
Barcode generator for product, shipping, and inventory labels: GET ?data=&type= and receive a print-ready SVG plus PNG (base64) and a data: URI. Types: code128 (default), ean13, ean8, upca, upce, code39, itf14, gs1-128, codabar, datamatrix, pdf417, aztec. Check digits, quiet zones, and the human-readable line are handled per spec; invalid input for a symbology returns a clear 400. Deterministic, no network. QR codes live at /api/qr.
Parameters
| Name | In | Description | |
|---|---|---|---|
data | query | required | Value to encode (required, up to 500 chars; digits-only types validate length + check digit) |
type | query | Symbology: code128 (default), ean13, ean8, upca, upce, code39, itf14, gs1-128, codabar, datamatrix, pdf417, aztec | |
scale | query | Module width multiplier for the PNG (1-8, default 3) | |
height | query | Bar height for 1D types (4-60, default 12) | |
text_line | query | Set to 'false' to omit the human-readable text under the bars | |
dark | query | Hex color of the bars (default #000000) | |
light | query | Hex background color (default #ffffff) |
Example request
curl "https://api.webbersites.com/api/barcode?data=012345678905&type=upca"
# first call returns 402 + payment requirements; an x402 client pays and retries automaticallyExample response
{
"data": "012345678905",
"type": "upca",
"svg": "<svg …>",
"png_base64": "iVBORw0…",
"data_uri": "data:image/png;base64,…"
}How payment works
There is no signup and no API key. Call the endpoint; it replies 402 Payment Required with machine-readable payment requirements. Your client signs a USDC transfer authorization (EIP-3009, gasless) and retries with the X-PAYMENT header — @x402/fetch does this automatically. See the overview for a working snippet.