Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

Barcode Generator API

Generate a 1D barcode as SVG: EAN-13, UPC-A, EAN-8 (check digit added or verified), Code 128 or Code 39.

POST /api/v1/tools/barcode-generatorMCP barcode_generatorGenerators

Create EAN-13, UPC-A, EAN-8, Code 128 and Code 39 barcodes with automatic check digits and readable text. Download them as sharp SVG or PNG files.

Input

Send these as a JSON object. Unknown fields are rejected.

value
The data. EAN-13: 12 or 13 digits. UPC-A: 11 or 12 digits. EAN-8: 7 or 8 digits. Code 128: printable ASCII, up to 80 characters. Code 39: A–Z, 0–9, space and - . $ / + %. (string, up to 80 characters, required)
symbology
Barcode type. (string, one of ean13, upca, ean8, code128, code39, default "code128")
code39Check
Code 39 only: append the optional mod 43 check character. (boolean, default false)
barHeight
Bar height in modules (narrowest bar widths). (integer, 10 to 200, default 50)
showText
Print the human-readable text under the bars. (boolean, default true)
scale
Pixels per module in the SVG width and height. (integer, 1 to 10, default 2)
curl https://pithlab.com/api/v1/tools/barcode-generator \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"value":"400638133393","symbology":"ean13"}'
Example response
{
  "ok": true,
  "result": {
    "text": "4 006381 333931",
    "modules": "10100011010100111010111101111010001001011001101010100001010000101000010111010010000101100110101",
    "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 117 NaN\" width=\"NaN\" height=\"NaN\" shape-rendering=\"crispEdges\"><rect width=\"117\" height=\"NaN\" fill=\"#fff\"/><g fill=\"#000\"><rect x=\"11\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"13\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"17\" y=\"0\" width=\"2\" height=\"NaN\"/><rect x=\"20\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"22\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"25\" y=\"0\" width=\"3\" height=\"NaN\"/><rect x=\"29\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"31\" y=\"0\" width=\"4\" height=\"NaN\"/><rect x=\"36\" y=\"0\" width=\"4\" height=\"NaN\"/><rect x=\"41\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"45\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"48\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"50\" y=\"0\" width=\"2\" height=\"NaN\"/><rect x=\"54\" y=\"0\" width=\"2\" height=\"NaN\"/><rect x=\"57\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"59\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"61\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"66\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"68\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"73\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"75\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"80\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"82\" y=\"0\" width=\"3\" height=\"NaN\"/><rect x=\"86\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"89\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"94\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"96\" y=\"0\" width=\"2\" height=\"NaN\"/><rect x=\"100\" y=\"0\" width=\"2\" height=\"NaN\"/><rect x=\"103\" y=\"0\" width=\"1\" height=\"NaN\"/><rect x=\"105\" y=\"0\" width=\"1\" height=\"NaN\"/></g></svg>"
  }
}